Skip to content

Commit b77577c

Browse files
Migrate TestGenerateCompileCommandsJsonResilience from test_compile_part_4.py to compile_part_4_test.go
1 parent 4038740 commit b77577c

File tree

16 files changed

+4211
-16
lines changed

16 files changed

+4211
-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+
}

internal/integrationtest/testdata/sketch_simple/build/adafruit.samd.adafruit_feather_m0/sketch_simple.ino.hex

Lines changed: 679 additions & 0 deletions
Large diffs are not rendered by default.

internal/integrationtest/testdata/sketch_simple/build/adafruit.samd.adafruit_feather_m0/sketch_simple.ino.map

Lines changed: 3389 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:00000001FF
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
:100000000C9434000C9446000C9446000C9446006A
2+
:100010000C9446000C9446000C9446000C94460048
3+
:100020000C9446000C9446000C9446000C94460038
4+
:100030000C9446000C9446000C9446000C94460028
5+
:100040000C9448000C9446000C9446000C94460016
6+
:100050000C9446000C9446000C9446000C94460008
7+
:100060000C9446000C94460011241FBECFEFD8E03C
8+
:10007000DEBFCDBF21E0A0E0B1E001C01D92A930FC
9+
:10008000B207E1F70E9492000C94DC000C9400008F
10+
:100090001F920F920FB60F9211242F933F938F93BD
11+
:1000A0009F93AF93BF938091050190910601A0911A
12+
:1000B0000701B09108013091040123E0230F2D378F
13+
:1000C00058F50196A11DB11D2093040180930501EF
14+
:1000D00090930601A0930701B0930801809100015D
15+
:1000E00090910101A0910201B09103010196A11D1F
16+
:1000F000B11D8093000190930101A0930201B09380
17+
:100100000301BF91AF919F918F913F912F910F90DC
18+
:100110000FBE0F901F90189526E8230F0296A11D81
19+
:10012000B11DD2CF789484B5826084BD84B58160DE
20+
:1001300084BD85B5826085BD85B5816085BD8091B2
21+
:100140006E00816080936E0010928100809181002A
22+
:100150008260809381008091810081608093810022
23+
:10016000809180008160809380008091B1008460E4
24+
:100170008093B1008091B00081608093B000809145
25+
:100180007A00846080937A0080917A008260809304
26+
:100190007A0080917A00816080937A0080917A0061
27+
:1001A000806880937A001092C100C0E0D0E0209770
28+
:0C01B000F1F30E940000FBCFF894FFCF99
29+
:00000001FF
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
:020000040000FA
2+
:100000000C9434000C9446000C9446000C9446006A
3+
:100010000C9446000C9446000C9446000C94460048
4+
:100020000C9446000C9446000C9446000C94460038
5+
:100030000C9446000C9446000C9446000C94460028
6+
:100040000C9448000C9446000C9446000C94460016
7+
:100050000C9446000C9446000C9446000C94460008
8+
:100060000C9446000C94460011241FBECFEFD8E03C
9+
:10007000DEBFCDBF21E0A0E0B1E001C01D92A930FC
10+
:10008000B207E1F70E9492000C94DC000C9400008F
11+
:100090001F920F920FB60F9211242F933F938F93BD
12+
:1000A0009F93AF93BF938091050190910601A0911A
13+
:1000B0000701B09108013091040123E0230F2D378F
14+
:1000C00058F50196A11DB11D2093040180930501EF
15+
:1000D00090930601A0930701B0930801809100015D
16+
:1000E00090910101A0910201B09103010196A11D1F
17+
:1000F000B11D8093000190930101A0930201B09380
18+
:100100000301BF91AF919F918F913F912F910F90DC
19+
:100110000FBE0F901F90189526E8230F0296A11D81
20+
:10012000B11DD2CF789484B5826084BD84B58160DE
21+
:1001300084BD85B5826085BD85B5816085BD8091B2
22+
:100140006E00816080936E0010928100809181002A
23+
:100150008260809381008091810081608093810022
24+
:10016000809180008160809380008091B1008460E4
25+
:100170008093B1008091B00081608093B000809145
26+
:100180007A00846080937A0080917A008260809304
27+
:100190007A0080917A00816080937A0080917A0061
28+
:1001A000806880937A001092C100C0E0D0E0209770
29+
:0C01B000F1F30E940000FBCFF894FFCF99
30+
:107E0000112484B714BE81FFF0D085E080938100F7
31+
:107E100082E08093C00088E18093C10086E0809377
32+
:107E2000C20080E18093C4008EE0C9D0259A86E02C
33+
:107E300020E33CEF91E0309385002093840096BBD3
34+
:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4
35+
:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7
36+
:107E6000A2D0813461F49FD0082FAFD0023811F036
37+
:107E7000013811F484E001C083E08DD089C08234E0
38+
:107E800011F484E103C0853419F485E0A6D080C0E4
39+
:107E9000853579F488D0E82EFF2485D0082F10E0AE
40+
:107EA000102F00270E291F29000F111F8ED06801E7
41+
:107EB0006FC0863521F484E090D080E0DECF843638
42+
:107EC00009F040C070D06FD0082F6DD080E0C81688
43+
:107ED00080E7D80618F4F601B7BEE895C0E0D1E017
44+
:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8
45+
:107EF00018F0F601B7BEE89568D007B600FCFDCFD4
46+
:107F0000A601A0E0B1E02C9130E011968C91119780
47+
:107F100090E0982F8827822B932B1296FA010C0160
48+
:107F200087BEE89511244E5F5F4FF1E0A038BF0790
49+
:107F300051F7F601A7BEE89507B600FCFDCF97BE46
50+
:107F4000E89526C08437B1F42ED02DD0F82E2BD052
51+
:107F50003CD0F601EF2C8F010F5F1F4F84911BD097
52+
:107F6000EA94F801C1F70894C11CD11CFA94CF0C13
53+
:107F7000D11C0EC0853739F428D08EE10CD085E9AC
54+
:107F80000AD08FE07ACF813511F488E018D01DD067
55+
:107F900080E101D065CF982F8091C00085FFFCCF94
56+
:107FA0009093C60008958091C00087FFFCCF809118
57+
:107FB000C00084FD01C0A8958091C6000895E0E648
58+
:107FC000F0E098E1908380830895EDDF803219F02E
59+
:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA
60+
:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6
61+
:047FF000FF270994CA
62+
:027FFE00040479
63+
:00000001FF

internal/integrationtest/testdata/sketch_simple/doc.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define TRUE FALSE
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <Arduino.h>
2+
#line 1 {{QuoteCppString .sketch.MainFile.Name}}
3+
void setup() {
4+
5+
}
6+
7+
void loop() {
8+
9+
}
10+
#line 1 {{QuoteCppString (index .sketch.OtherSketchFiles 0).Name}}
11+
12+
#line 1 {{QuoteCppString (index .sketch.OtherSketchFiles 1).Name}}
13+
String hello() {
14+
return "world";
15+
}

internal/integrationtest/testdata/sketch_simple/old.pde

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
String hello() {
2+
return "world";
3+
}

internal/integrationtest/testdata/sketch_simple/s_file.S

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
void setup() {
2+
3+
}
4+
5+
void loop() {
6+
7+
}

internal/integrationtest/testdata/sketch_simple/src/helper.h

Whitespace-only changes.

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)