Skip to content

Commit 95cfd65

Browse files
authored
Allow optional programmer in debug (#2540)
1 parent 01de174 commit 95cfd65

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

Diff for: commands/debug/debug_info.go

+8-9
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
169169
}
170170
}
171171

172-
if req.GetProgrammer() == "" {
173-
return nil, &arduino.MissingProgrammerError{}
174-
}
175-
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
176-
toolProperties.Merge(p.Properties)
177-
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
178-
toolProperties.Merge(refP.Properties)
179-
} else {
180-
return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
172+
if req.GetProgrammer() != "" {
173+
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
174+
toolProperties.Merge(p.Properties)
175+
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
176+
toolProperties.Merge(refP.Properties)
177+
} else {
178+
return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
179+
}
181180
}
182181

183182
var importPath *paths.Path

Diff for: commands/debug/debug_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ func TestGetCommandLine(t *testing.T) {
6565
pme, release := pm.NewExplorer()
6666
defer release()
6767

68-
{
69-
// Check programmer required
70-
_, err := getCommandLine(req, pme)
71-
require.Error(t, err)
72-
}
73-
7468
{
7569
// Check programmer not found
7670
req.Programmer = "not-existent"

Diff for: internal/integrationtest/debug/debug_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
336336
}
337337

338338
func testDebugCheck(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
339-
_, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000")
340-
require.Error(t, err)
341-
342339
out, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice")
343340
require.NoError(t, err)
344341
require.Contains(t, string(out), "The given board/programmer configuration supports debugging.")

0 commit comments

Comments
 (0)