Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Migrate TestCompileUsingPlatformLocalTxt from test_compile_part_3.py …
…to compile_part_3_test.go
  • Loading branch information
MatteoPologruto committed Oct 13, 2022
commit 33dd1e014cf7baf07331098dc246ed1273498ac2
32 changes: 32 additions & 0 deletions internal/integrationtest/compile/compile_part_3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,35 @@ func TestCompileWithOnlyCompilationDatabaseFlag(t *testing.T) {
// Verifies no binaries are exported
require.NoDirExists(t, buildPath.String())
}

func TestCompileUsingPlatformLocalTxt(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()

_, _, err := cli.Run("update")
require.NoError(t, err)

_, _, err = cli.Run("core", "install", "arduino:avr@1.8.3")
require.NoError(t, err)

sketchName := "CompileSketchUsingPlatformLocalTxt"
sketchPath := cli.SketchbookDir().Join(sketchName)
fqbn := "arduino:avr:uno"

_, _, err = cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)

// Verifies compilation works without issues
_, _, err = cli.Run("compile", "--clean", "-b", fqbn, sketchPath.String())
require.NoError(t, err)

// Overrides default platform compiler with an unexisting one
platformLocalTxt := cli.DataDir().Join("packages", "arduino", "hardware", "avr", "1.8.3", "platform.local.txt")
err = platformLocalTxt.WriteFile([]byte("compiler.c.cmd=my-compiler-that-does-not-exist"))
require.NoError(t, err)

// Verifies compilation now fails because compiler is not found
_, stderr, err := cli.Run("compile", "--clean", "-b", fqbn, sketchPath.String())
require.Error(t, err)
require.Contains(t, string(stderr), "my-compiler-that-does-not-exist")
}
24 changes: 0 additions & 24 deletions test/test_compile_part_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,6 @@
# assert "Skipping dependencies detection for precompiled library Arduino_TensorFlowLite" in result.stdout


def test_compile_using_platform_local_txt(run_command, data_dir):
assert run_command(["update"])

assert run_command(["core", "install", "arduino:avr@1.8.3"])

sketch_name = "CompileSketchUsingPlatformLocalTxt"
sketch_path = Path(data_dir, sketch_name)
fqbn = "arduino:avr:uno"

assert run_command(["sketch", "new", sketch_path])

# Verifies compilation works without issues
assert run_command(["compile", "--clean", "-b", fqbn, sketch_path])

# Overrides default platform compiler with an unexisting one
platform_local_txt = Path(data_dir, "packages", "arduino", "hardware", "avr", "1.8.3", "platform.local.txt")
platform_local_txt.write_text("compiler.c.cmd=my-compiler-that-does-not-exist")

# Verifies compilation now fails because compiler is not found
res = run_command(["compile", "--clean", "-b", fqbn, sketch_path])
assert res.failed
assert "my-compiler-that-does-not-exist" in res.stderr


def test_compile_using_boards_local_txt(run_command, data_dir):
assert run_command(["update"])

Expand Down