Skip to content

Commit 3398548

Browse files
committed
Added test for improved support for esp32:esp32
#163
1 parent deed2e2 commit 3398548

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

cli/cli_test.go

+33
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,39 @@ board_manager:
396396
require.NotZero(t, exitCode)
397397
}
398398

399+
func Test3rdPartyCoreIntegration(t *testing.T) {
400+
// override SetUp dirs
401+
tmp := tmpDirOrDie()
402+
defer os.RemoveAll(tmp)
403+
os.Setenv("ARDUINO_SKETCHBOOK_DIR", tmp)
404+
currSketchbookDir = tmp
405+
406+
configFile := filepath.Join(currDataDir, "arduino-cli.yaml")
407+
err := ioutil.WriteFile(configFile, []byte(`
408+
board_manager:
409+
additional_urls:
410+
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
411+
`), os.FileMode(0644))
412+
require.NoError(t, err, "writing dummy config "+configFile)
413+
414+
// Update index and install esp32:esp32
415+
exitCode, _ := executeWithArgs("--config-file", configFile, "core", "update-index")
416+
require.Zero(t, exitCode)
417+
exitCode, d := executeWithArgs("--config-file", configFile, "core", "install", "esp32:esp32")
418+
require.Zero(t, exitCode)
419+
require.Contains(t, string(d), "installed")
420+
421+
// Build a simple sketch and check if all artifacts are copied
422+
tmpSketch := paths.New(currSketchbookDir).Join("Blink")
423+
err = paths.New("testdata/Blink").CopyDirTo(tmpSketch)
424+
require.NoError(t, err, "copying test sketch into temp dir")
425+
exitCode, d = executeWithArgs("--config-file", configFile, "compile", "-b", "esp32:esp32:esp32", tmpSketch.String())
426+
require.Zero(t, exitCode)
427+
require.True(t, tmpSketch.Join("Blink.esp32.esp32.esp32.bin").Exist())
428+
require.True(t, tmpSketch.Join("Blink.esp32.esp32.esp32.elf").Exist())
429+
require.True(t, tmpSketch.Join("Blink.esp32.esp32.esp32.partitions.bin").Exist()) // https://github.com/arduino/arduino-cli/issues/163
430+
}
431+
399432
func TestCoreCommandsIntegration(t *testing.T) {
400433
// override SetUp dirs
401434
tmp := tmpDirOrDie()

cli/testdata/Blink/Blink.ino

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
void setup() {}
3+
void loop() {}

0 commit comments

Comments
 (0)