|
16 | 16 | package core_test
|
17 | 17 |
|
18 | 18 | import (
|
| 19 | + "crypto/md5" |
| 20 | + "encoding/hex" |
19 | 21 | "fmt"
|
20 | 22 | "runtime"
|
21 | 23 | "sort"
|
@@ -237,6 +239,32 @@ func TestCoreInstallWithoutUpdateIndex(t *testing.T) {
|
237 | 239 | require.Contains(t, string(stdout), "Downloading index: package_index.tar.bz2 downloaded")
|
238 | 240 | }
|
239 | 241 |
|
| 242 | +func TestCoreInstallEsp32(t *testing.T) { |
| 243 | + env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) |
| 244 | + defer env.CleanUp() |
| 245 | + |
| 246 | + // update index |
| 247 | + url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 248 | + _, _, err := cli.Run("core", "update-index", "--additional-urls="+url) |
| 249 | + require.NoError(t, err) |
| 250 | + // install 3rd-party core |
| 251 | + _, _, err = cli. Run( "core", "install", "esp32:[email protected]", "--additional-urls="+url) |
| 252 | + require.NoError(t, err) |
| 253 | + // create a sketch and compile to double check the core was successfully installed |
| 254 | + sketchName := "test_core_install_esp32" |
| 255 | + sketchPath := cli.SketchbookDir().Join(sketchName) |
| 256 | + _, _, err = cli.Run("sketch", "new", sketchPath.String()) |
| 257 | + require.NoError(t, err) |
| 258 | + _, _, err = cli.Run("compile", "-b", "esp32:esp32:esp32", sketchPath.String()) |
| 259 | + require.NoError(t, err) |
| 260 | + // prevent regressions for https://github.com/arduino/arduino-cli/issues/163 |
| 261 | + md5 := md5.Sum(([]byte(sketchPath.String()))) |
| 262 | + sketchPathMd5 := strings.ToUpper(hex.EncodeToString(md5[:])) |
| 263 | + require.NotEmpty(t, sketchPathMd5) |
| 264 | + buildDir := paths.TempDir().Join("arduino-sketch-" + sketchPathMd5) |
| 265 | + require.FileExists(t, buildDir.Join(sketchName+".ino.partitions.bin").String()) |
| 266 | +} |
| 267 | + |
240 | 268 | func TestCoreDownload(t *testing.T) {
|
241 | 269 | env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
|
242 | 270 | defer env.CleanUp()
|
|
0 commit comments