Skip to content

Allow optional programmer in debug command #2544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
}
}

if req.GetProgrammer() == "" {
return nil, &cmderrors.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, &cmderrors.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, &cmderrors.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