Skip to content

Commit 116bfd9

Browse files
Migrate TestGenerateCompileCommandsJsonResilience from test_compile_part_4.py to compile_part_4_test.go
1 parent 9ca8a7b commit 116bfd9

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

internal/integrationtest/compile/compile_part_4_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,27 @@ func TestCompileWithEsp8266BundledLibraries(t *testing.T) {
342342
}
343343
require.NotContains(t, string(stdout), expectedOutput[0]+"\n"+expectedOutput[1]+"\n"+expectedOutput[2]+"\n")
344344
}
345+
346+
func TestGenerateCompileCommandsJsonResilience(t *testing.T) {
347+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
348+
defer env.CleanUp()
349+
350+
_, _, err := cli.Run("update")
351+
require.NoError(t, err)
352+
353+
// check it didn't fail with esp32@2.0.1 that has a prebuild hook that must run:
354+
// https://github.com/arduino/arduino-cli/issues/1547
355+
url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
356+
_, _, err = cli.Run("core", "update-index", "--additional-urls="+url)
357+
require.NoError(t, err)
358+
_, _, err = cli.Run("core", "install", "esp32:esp32@2.0.1", "--additional-urls="+url)
359+
require.NoError(t, err)
360+
sketchPath := cli.CopySketch("sketch_simple")
361+
_, _, err = cli.Run("compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketchPath.String())
362+
require.NoError(t, err)
363+
364+
// check it didn't fail on a sketch with a missing include
365+
sketchPath = cli.CopySketch("sketch_with_missing_include")
366+
_, _, err = cli.Run("compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketchPath.String())
367+
require.NoError(t, err)
368+
}

test/test_compile_part_4.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ def test_compile_manually_installed_platform_using_boards_local_txt(run_command,
5050
assert run_command(["compile", "--clean", "-b", fqbn, sketch_path])
5151

5252

53-
def test_generate_compile_commands_json_resilience(run_command, data_dir, copy_sketch):
54-
assert run_command(["update"])
55-
56-
# check it didn't fail with esp32@2.0.1 that has a prebuild hook that must run:
57-
# https://github.com/arduino/arduino-cli/issues/1547
58-
url = "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
59-
assert run_command(["core", "update-index", f"--additional-urls={url}"])
60-
assert run_command(["core", "install", "esp32:esp32@2.0.1", f"--additional-urls={url}"])
61-
sketch_path = copy_sketch("sketch_simple")
62-
assert run_command(["compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketch_path])
63-
64-
# check it didn't fail on a sketch with a missing include
65-
sketch_path = copy_sketch("sketch_with_missing_include")
66-
assert run_command(["compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketch_path])
67-
68-
6953
def test_compile_sketch_with_tpp_file_include(run_command, copy_sketch):
7054
assert run_command(["update"])
7155

0 commit comments

Comments
 (0)