Unverified Commit 95cfd654 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Allow optional programmer in debug (#2540)

parent 01de174c
...@@ -169,15 +169,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl ...@@ -169,15 +169,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
} }
} }
if req.GetProgrammer() == "" { if req.GetProgrammer() != "" {
return nil, &arduino.MissingProgrammerError{} if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
} toolProperties.Merge(p.Properties)
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok { } else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
toolProperties.Merge(p.Properties) toolProperties.Merge(refP.Properties)
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok { } else {
toolProperties.Merge(refP.Properties) return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
} else { }
return nil, &arduino.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
} }
var importPath *paths.Path var importPath *paths.Path
......
...@@ -65,12 +65,6 @@ func TestGetCommandLine(t *testing.T) { ...@@ -65,12 +65,6 @@ func TestGetCommandLine(t *testing.T) {
pme, release := pm.NewExplorer() pme, release := pm.NewExplorer()
defer release() defer release()
{
// Check programmer required
_, err := getCommandLine(req, pme)
require.Error(t, err)
}
{ {
// Check programmer not found // Check programmer not found
req.Programmer = "not-existent" req.Programmer = "not-existent"
......
...@@ -336,9 +336,6 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli ...@@ -336,9 +336,6 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
} }
func testDebugCheck(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) { 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") out, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice")
require.NoError(t, err) require.NoError(t, err)
require.Contains(t, string(out), "The given board/programmer configuration supports debugging.") require.Contains(t, string(out), "The given board/programmer configuration supports debugging.")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment