Skip to content

Commit ec32751

Browse files
Migrate TestGenerateCompileCommandsJsonResilience from test_compile_part_4.py to compile_part_4_test.go
1 parent b64acb3 commit ec32751

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
@@ -346,3 +346,27 @@ func TestCompileWithEsp8266BundledLibraries(t *testing.T) {
346346
}
347347
require.NotContains(t, string(stdout), expectedOutput[0]+"\n"+expectedOutput[1]+"\n"+expectedOutput[2]+"\n")
348348
}
349+
350+
func TestGenerateCompileCommandsJsonResilience(t *testing.T) {
351+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
352+
defer env.CleanUp()
353+
354+
_, _, err := cli.Run("update")
355+
require.NoError(t, err)
356+
357+
// check it didn't fail with esp32@2.0.1 that has a prebuild hook that must run:
358+
// https://github.com/arduino/arduino-cli/issues/1547
359+
url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
360+
_, _, err = cli.Run("core", "update-index", "--additional-urls="+url)
361+
require.NoError(t, err)
362+
_, _, err = cli.Run("core", "install", "esp32:esp32@2.0.1", "--additional-urls="+url)
363+
require.NoError(t, err)
364+
sketchPath := cli.CopySketch("sketch_simple")
365+
_, _, err = cli.Run("compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketchPath.String())
366+
require.NoError(t, err)
367+
368+
// check it didn't fail on a sketch with a missing include
369+
sketchPath = cli.CopySketch("sketch_with_missing_include")
370+
_, _, err = cli.Run("compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketchPath.String())
371+
require.NoError(t, err)
372+
}

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)