|
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"
|
@@ -222,6 +224,32 @@ func TestCoreInstallWithoutUpdateIndex(t *testing.T) {
|
222 | 224 | require.Contains(t, string(stdout), "Downloading index: package_index.tar.bz2 downloaded")
|
223 | 225 | }
|
224 | 226 |
|
| 227 | +func TestCoreInstallEsp32(t *testing.T) { |
| 228 | + env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) |
| 229 | + defer env.CleanUp() |
| 230 | + |
| 231 | + // update index |
| 232 | + url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 233 | + _, _, err := cli.Run("core", "update-index", "--additional-urls="+url) |
| 234 | + require.NoError(t, err) |
| 235 | + // install 3rd-party core |
| 236 | + _, _, err = cli. Run( "core", "install", "esp32:[email protected]", "--additional-urls="+url) |
| 237 | + require.NoError(t, err) |
| 238 | + // create a sketch and compile to double check the core was successfully installed |
| 239 | + sketchName := "test_core_install_esp32" |
| 240 | + sketchPath := cli.SketchbookDir().Join(sketchName) |
| 241 | + _, _, err = cli.Run("sketch", "new", sketchPath.String()) |
| 242 | + require.NoError(t, err) |
| 243 | + _, _, err = cli.Run("compile", "-b", "esp32:esp32:esp32", sketchPath.String()) |
| 244 | + require.NoError(t, err) |
| 245 | + // prevent regressions for https://github.com/arduino/arduino-cli/issues/163 |
| 246 | + md5 := md5.Sum(([]byte(sketchPath.String()))) |
| 247 | + sketchPathMd5 := strings.ToUpper(hex.EncodeToString(md5[:])) |
| 248 | + require.NotEmpty(t, sketchPathMd5) |
| 249 | + buildDir := paths.TempDir().Join("arduino-sketch-" + sketchPathMd5) |
| 250 | + require.FileExists(t, buildDir.Join(sketchName+".ino.partitions.bin").String()) |
| 251 | +} |
| 252 | + |
225 | 253 | func TestCoreDownload(t *testing.T) {
|
226 | 254 | env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
|
227 | 255 | defer env.CleanUp()
|
|
0 commit comments