Skip to content

Commit 80d8dbb

Browse files
Migrate TestCompileWithOnlyCompilationDatabaseFlag from test_compile_part_3.py to compile_part_3_test.go
1 parent 4cdd9f1 commit 80d8dbb

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

internal/integrationtest/compile/compile_part_3_test.go

+40
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,43 @@ func TestCompileSketchCaseMismatchFails(t *testing.T) {
143143
require.Error(t, err)
144144
require.Contains(t, string(stderr), "Error opening sketch:")
145145
}
146+
147+
func TestCompileWithOnlyCompilationDatabaseFlag(t *testing.T) {
148+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
149+
defer env.CleanUp()
150+
151+
_, _, err := cli.Run("update")
152+
require.NoError(t, err)
153+
154+
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
155+
require.NoError(t, err)
156+
157+
sketchName := "CompileSketchOnlyCompilationDatabaseFlag"
158+
sketchPath := cli.SketchbookDir().Join(sketchName)
159+
fqbn := "arduino:avr:uno"
160+
161+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
162+
require.NoError(t, err)
163+
164+
// Verifies no binaries exist
165+
buildPath := sketchPath.Join("build")
166+
require.NoDirExists(t, buildPath.String())
167+
168+
// Compile with both --export-binaries and --only-compilation-database flags
169+
_, _, err = cli.Run("compile", "--export-binaries", "--only-compilation-database", "--clean", "-b", fqbn, sketchPath.String())
170+
require.NoError(t, err)
171+
172+
// Verifies no binaries are exported
173+
require.NoDirExists(t, buildPath.String())
174+
175+
// Verifies no binaries exist
176+
buildPath = cli.SketchbookDir().Join("export-dir")
177+
require.NoDirExists(t, buildPath.String())
178+
179+
// Compile by setting the --output-dir flag and --only-compilation-database flags
180+
_, _, err = cli.Run("compile", "--output-dir", buildPath.String(), "--only-compilation-database", "--clean", "-b", fqbn, sketchPath.String())
181+
require.NoError(t, err)
182+
183+
// Verifies no binaries are exported
184+
require.NoDirExists(t, buildPath.String())
185+
}

test/test_compile_part_3.py

-36
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,6 @@
3939
# assert "Skipping dependencies detection for precompiled library Arduino_TensorFlowLite" in result.stdout
4040

4141

42-
def test_compile_with_only_compilation_database_flag(run_command, data_dir):
43-
assert run_command(["update"])
44-
45-
assert run_command(["core", "install", "arduino:[email protected]"])
46-
47-
sketch_name = "CompileSketchOnlyCompilationDatabaseFlag"
48-
sketch_path = Path(data_dir, sketch_name)
49-
fqbn = "arduino:avr:uno"
50-
51-
assert run_command(["sketch", "new", sketch_path])
52-
53-
# Verifies no binaries exist
54-
build_path = Path(sketch_path, "build")
55-
assert not build_path.exists()
56-
57-
# Compile with both --export-binaries and --only-compilation-database flags
58-
assert run_command(
59-
["compile", "--export-binaries", "--only-compilation-database", "--clean", "-b", fqbn, sketch_path]
60-
)
61-
62-
# Verifies no binaries are exported
63-
assert not build_path.exists()
64-
65-
# Verifies no binaries exist
66-
build_path = Path(data_dir, "export-dir")
67-
assert not build_path.exists()
68-
69-
# Compile by setting the --output-dir flag and --only-compilation-database flags
70-
assert run_command(
71-
["compile", "--output-dir", build_path, "--only-compilation-database", "--clean", "-b", fqbn, sketch_path]
72-
)
73-
74-
# Verifies no binaries are exported
75-
assert not build_path.exists()
76-
77-
7842
def test_compile_using_platform_local_txt(run_command, data_dir):
7943
assert run_command(["update"])
8044

0 commit comments

Comments
 (0)