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 TestCompileAndUploadComboSketchWithMismatchedCasing from test…
…_upload.py to upload_test.go
  • Loading branch information
MatteoPologruto committed Dec 13, 2022
commit b13ed89824c43b0284481c1b07d5af0df89638bf
32 changes: 32 additions & 0 deletions internal/integrationtest/upload/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,35 @@ func TestUploadWithInputDirContainingMultipleBinaries(t *testing.T) {
require.NoError(t, err)
}
}

func TestCompileAndUploadComboSketchWithMismatchedCasing(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("VMs have no serial ports")
}

env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()

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

// Create a sketch
sketchName := "CompileUploadComboMismatchCasing"
sketchPath := cli.SketchbookDir().Join(sketchName)
_, _, err = cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)

// Rename main .ino file so casing is different from sketch name
require.NoError(t, sketchPath.Join(sketchName+".ino").Rename(sketchPath.Join(strings.ToLower(sketchName)+".ino")))

for _, board := range detectedBoards(t, cli) {
// Install core
_, _, err = cli.Run("core", "install", board.core)
require.NoError(t, err)

// Try to compile
_, stderr, err := cli.Run("compile", "--clean", "-b", board.fqbn, "-u", "-p", board.address, sketchPath.String())
require.Error(t, err)
require.Contains(t, string(stderr), "Error opening sketch:")
}
}
22 changes: 0 additions & 22 deletions test/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,6 @@ def test_upload_after_attach(run_command, data_dir, detected_boards):
assert run_command(["upload", sketch_path])


def test_compile_and_upload_combo_sketch_with_mismatched_casing(run_command, data_dir, detected_boards, wait_for_board):
assert run_command(["update"])

# Create a sketch
sketch_name = "CompileUploadComboMismatchCasing"
sketch_path = Path(data_dir, sketch_name)
assert run_command(["sketch", "new", sketch_path])

# Rename main .ino file so casing is different from sketch name
Path(sketch_path, f"{sketch_name}.ino").rename(sketch_path / f"{sketch_name.lower()}.ino")

for board in detected_boards:
# Install core
core = ":".join(board.fqbn.split(":")[:2])
assert run_command(["core", "install", core])

# Try to compile
res = run_command(["compile", "--clean", "-b", board.fqbn, "-u", "-p", board.address, sketch_path])
assert res.failed
assert "Error opening sketch:" in res.stderr


def test_upload_sketch_with_mismatched_casing(run_command, data_dir, detected_boards, wait_for_board):
assert run_command(["update"])

Expand Down