Skip to content

Commit 5976053

Browse files
committed
Added tests
1 parent 8522850 commit 5976053

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
go.bug.st/cleanup v1.0.0
3838
go.bug.st/downloader/v2 v2.2.0
3939
go.bug.st/relaxed-semver v0.12.0
40-
go.bug.st/testifyjson v1.1.1
40+
go.bug.st/testifyjson v1.2.0
4141
golang.org/x/term v0.22.0
4242
golang.org/x/text v0.16.0
4343
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157

Diff for: go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ go.bug.st/serial v1.6.1 h1:VSSWmUxlj1T/YlRo2J104Zv3wJFrjHIl/T3NeruWAHY=
221221
go.bug.st/serial v1.6.1/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
222222
go.bug.st/testifyjson v1.1.1 h1:nHotIMK151LF3vYsU/b2RaoVaWCgrf2kvQeGNoZkGaA=
223223
go.bug.st/testifyjson v1.1.1/go.mod h1:nZyy2icFbv3OE3zW3mGVOnC/GhWgb93LRu+29n2tJlI=
224+
go.bug.st/testifyjson v1.2.0 h1:0pAfOUMVCOJ6bb9JcC4UmnACjxwxv2Ojb6Z9chaQBjg=
225+
go.bug.st/testifyjson v1.2.0/go.mod h1:nZyy2icFbv3OE3zW3mGVOnC/GhWgb93LRu+29n2tJlI=
224226
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
225227
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
226228
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=

Diff for: internal/integrationtest/core/core_test.go

+41
Original file line numberDiff line numberDiff line change
@@ -1303,3 +1303,44 @@ func TestCoreHavingIncompatibleDepTools(t *testing.T) {
13031303
require.Contains(t, lines, []string{"incompatible_vendor:avr", "n/a", "Incompatible", "Boards"})
13041304
}
13051305
}
1306+
1307+
func TestReferencedCoreBuildAndRuntimeProperties(t *testing.T) {
1308+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1309+
defer env.CleanUp()
1310+
1311+
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
1312+
require.NoError(t, err)
1313+
1314+
testSketchbook, err := paths.New("testdata", "sketchbook_with_extended_platform").Abs()
1315+
require.NoError(t, err)
1316+
1317+
// Install custom platform
1318+
err = testSketchbook.Join("hardware").CopyDirTo(cli.SketchbookDir().Join("hardware"))
1319+
require.NoError(t, err)
1320+
1321+
// Determine some useful paths
1322+
boardPlatformPath := cli.SketchbookDir().Join("hardware", "test", "avr").String()
1323+
corePlatformPath := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.6").String()
1324+
corePath := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.6", "cores", "arduino").String()
1325+
1326+
// Check runtime variables are populated correctly
1327+
{
1328+
outJson, _, err := cli.Run("board", "details", "-b", "test:avr:test", "--show-properties", "--json")
1329+
require.NoError(t, err)
1330+
out := requirejson.Parse(t, outJson).Query(".build_properties")
1331+
out.ArrayMustContain(`"build.board.platform.path=` + boardPlatformPath + `"`)
1332+
out.ArrayMustContain(`"build.core.platform.path=` + corePlatformPath + `"`)
1333+
out.ArrayMustContain(`"build.core.path=` + corePath + `"`)
1334+
out.ArrayMustContain(`"runtime.platform.path=` + boardPlatformPath + `"`)
1335+
}
1336+
{
1337+
outJson, _, err := cli.Run("board", "details", "-b", "test:avr:test2", "--show-properties", "--json")
1338+
require.NoError(t, err)
1339+
out := requirejson.Parse(t, outJson).Query(".build_properties")
1340+
out.ArrayMustContain(`"build.board.platform.path=` + boardPlatformPath + `"`)
1341+
out.ArrayMustContain(`"build.core.platform.path=` + corePlatformPath + `"`)
1342+
out.ArrayMustContain(`"build.core.path=` + corePath + `"`)
1343+
// https://github.com/arduino/arduino-cli/issues/2616
1344+
out.ArrayMustContain(`"runtime.platform.path=` + corePlatformPath + `"`)
1345+
}
1346+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
test.name=Test Board
3+
test.build.core=arduino:arduino
4+
5+
test2.name=Test 2 Board
6+
test2.build.core=arduino:arduino
7+
test2.runtime.use_core_platform_path_for_runtime_platform_path=true

0 commit comments

Comments
 (0)