Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 25a071c

Browse filesBrowse files
committed
Added integration test
1 parent 184df3c commit 25a071c
Copy full SHA for 25a071c

File tree

2 files changed

+79
-0
lines changed
Filter options

2 files changed

+79
-0
lines changed

‎internal/integrationtest/debug/debug_test.go

Copy file name to clipboardExpand all lines: internal/integrationtest/debug/debug_test.go
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import (
1919
"testing"
2020

2121
"github.com/arduino/arduino-cli/internal/integrationtest"
22+
"github.com/arduino/go-paths-helper"
2223
"github.com/stretchr/testify/require"
24+
"go.bug.st/testifyjson/requirejson"
2325
)
2426

2527
func TestDebug(t *testing.T) {
@@ -37,6 +39,7 @@ func TestDebug(t *testing.T) {
3739
integrationtest.CLISubtests{
3840
{"Start", testDebuggerStarts},
3941
{"WithPdeSketchStarts", testDebuggerWithPdeSketchStarts},
42+
{"DebugInformation", testAllDebugInformation},
4043
}.Run(t, env, cli)
4144
}
4245

@@ -88,3 +91,44 @@ func testDebuggerWithPdeSketchStarts(t *testing.T, env *integrationtest.Environm
8891
_, _, err = cli.Run("debug", "-b", fqbn, "-P", programmer, filePde.String(), "--info")
8992
require.NoError(t, err)
9093
}
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+
}
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
my.name=My Cool Board
2+
my.vid.0=0x2341
3+
my.pid.0=0x804e
4+
my.upload_port.0.vid=0x2341
5+
my.upload_port.0.pid=0x804e
6+
my.upload.tool=bossac
7+
my.upload.tool.default=bossac
8+
my.upload.tool.network=arduino_ota
9+
my.upload.protocol=sam-ba
10+
my.upload.maximum_size=262144
11+
my.upload.maximum_data_size=32768
12+
my.upload.use_1200bps_touch=true
13+
my.upload.wait_for_upload_port=true
14+
my.upload.native_usb=true
15+
my.build.mcu=cortex-m0plus
16+
my.build.f_cpu=48000000L
17+
my.build.usb_product="Arduino MKR1000"
18+
my.build.usb_manufacturer="Arduino LLC"
19+
my.build.board=SAMD_MY
20+
my.build.core=arduino:arduino
21+
my.build.extra_flags=-DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ {build.usb_flags}
22+
my.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
23+
my.build.openocdscript=openocd_scripts/arduino_zero.cfg
24+
my.build.variant=arduino:mkr1000
25+
my.build.vid=0x2341
26+
my.build.pid=0x804e
27+
28+
my.debug.toolchain.path=gcc-path
29+
my.debug.toolchain.prefix=gcc-prefix
30+
my.debug.server.openocd.path=openocd-path
31+
my.debug.server.openocd.scripts_dir=openocd-scripts-dir
32+
my.debug.server.openocd.script=
33+
my.debug.server.openocd.scripts.0=first
34+
my.debug.server.openocd.scripts.1=second
35+
my.debug.server.openocd.scripts.2=third

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.