@@ -19,7 +19,9 @@ import (
19
19
"testing"
20
20
21
21
"github.com/arduino/arduino-cli/internal/integrationtest"
22
+ "github.com/arduino/go-paths-helper"
22
23
"github.com/stretchr/testify/require"
24
+ "go.bug.st/testifyjson/requirejson"
23
25
)
24
26
25
27
func TestDebug (t * testing.T ) {
@@ -37,6 +39,7 @@ func TestDebug(t *testing.T) {
37
39
integrationtest.CLISubtests {
38
40
{"Start" , testDebuggerStarts },
39
41
{"WithPdeSketchStarts" , testDebuggerWithPdeSketchStarts },
42
+ {"DebugInformation" , testAllDebugInformation },
40
43
}.Run (t , env , cli )
41
44
}
42
45
@@ -88,3 +91,44 @@ func testDebuggerWithPdeSketchStarts(t *testing.T, env *integrationtest.Environm
88
91
_ , _ , err = cli .Run ("debug" , "-b" , fqbn , "-P" , programmer , filePde .String (), "--info" )
89
92
require .NoError (t , err )
90
93
}
94
+
95
+ func testAllDebugInformation (t * testing.T , env * integrationtest.Environment , cli * integrationtest.ArduinoCLI ) {
96
+ // Create sketch for testing
97
+ sketchPath := cli .DataDir ().Join ("DebuggerStartTest" )
98
+ defer sketchPath .RemoveAll ()
99
+ _ , _ , err := cli .Run ("sketch" , "new" , sketchPath .String ())
100
+ require .NoError (t , err )
101
+
102
+ // Install custom core
103
+ customHw , err := paths .New ("testdata" , "hardware" ).Abs ()
104
+ require .NoError (t , err )
105
+ err = customHw .CopyDirTo (cli .SketchbookDir ().Join ("hardware" ))
106
+ require .NoError (t , err )
107
+
108
+ // Build sketch
109
+ fqbn := "my:samd:my"
110
+ _ , _ , err = cli .Run ("compile" , "-b" , fqbn , sketchPath .String (), "--format" , "json" )
111
+ require .NoError (t , err )
112
+
113
+ // Starts debugger
114
+ jsonDebugOut , _ , err := cli .Run ("debug" , "-b" , fqbn , "-P" , "atmel_ice" , sketchPath .String (), "--info" , "--format" , "json" )
115
+ require .NoError (t , err )
116
+ debugOut := requirejson .Parse (t , jsonDebugOut )
117
+ debugOut .MustContain (`
118
+ {
119
+ "toolchain": "gcc",
120
+ "toolchain_path": "gcc-path",
121
+ "toolchain_prefix": "gcc-prefix",
122
+ "server": "openocd",
123
+ "server_path": "openocd-path",
124
+ "server_configuration": {
125
+ "path": "openocd-path",
126
+ "scripts_dir": "openocd-scripts-dir",
127
+ "scripts": [
128
+ "first",
129
+ "second",
130
+ "third"
131
+ ]
132
+ }
133
+ }` )
134
+ }
0 commit comments