Skip to content

Commit

Permalink
Fail if a sketch file is a broken symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jan 11, 2024
1 parent f793bb1 commit 719185d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/arduino/sketch/sketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ func (s *Sketch) supportedFiles() (paths.PathList, error) {

files, err := s.FullPath.ReadDirRecursiveFiltered(
paths.AndFilter(
filterOutBrokenLinks,
paths.OrFilter(
filterValidExtensions,
filterOutBrokenLinks,
),
filterOutBuildPaths,
),
paths.AndFilter(
Expand Down
7 changes: 7 additions & 0 deletions internal/integrationtest/compile_4/broken_symlink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ func TestCompileWithBrokenSymLinks(t *testing.T) {
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", sketch.String())
require.NoError(t, err)
})

t.Run("SketchFileBroken", func(t *testing.T) {
sketch, err := paths.New("testdata", "ValidSketchWithBrokenSketchFileSymlink").Abs()
require.NoError(t, err)
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", sketch.String())
require.Error(t, err)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
void setup() {}
void loop() {}

0 comments on commit 719185d

Please sign in to comment.