Skip to content

Commit

Permalink
Allow optional programmer in debug (#2540)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Feb 19, 2024
1 parent 01de174 commit 95cfd65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
17 changes: 8 additions & 9 deletions commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
}
}

if req.GetProgrammer() == "" {
return nil, &arduino.MissingProgrammerError{}
}
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
toolProperties.Merge(p.Properties)
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
toolProperties.Merge(refP.Properties)
} else {
return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
if req.GetProgrammer() != "" {
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
toolProperties.Merge(p.Properties)
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
toolProperties.Merge(refP.Properties)
} else {
return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
}
}

var importPath *paths.Path
Expand Down
6 changes: 0 additions & 6 deletions commands/debug/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ func TestGetCommandLine(t *testing.T) {
pme, release := pm.NewExplorer()
defer release()

{
// Check programmer required
_, err := getCommandLine(req, pme)
require.Error(t, err)
}

{
// Check programmer not found
req.Programmer = "not-existent"
Expand Down
3 changes: 0 additions & 3 deletions internal/integrationtest/debug/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
}

func testDebugCheck(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
_, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000")
require.Error(t, err)

out, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice")
require.NoError(t, err)
require.Contains(t, string(out), "The given board/programmer configuration supports debugging.")
Expand Down

0 comments on commit 95cfd65

Please sign in to comment.