Skip to content

Commit afa8e14

Browse files
committed
Fixed integration test
1 parent 415c711 commit afa8e14

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

internal/integrationtest/compile_1/compile_test.go

+23-3
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,36 @@ func compileWithSketchWithSymlinkSelfloop(t *testing.T, env *integrationtest.Env
220220
require.NoError(t, err)
221221
require.Contains(t, string(stdout), "Sketch created in: "+sketchPath.String())
222222

223-
// create a symlink that loops on himself
223+
// Create a symlink that loops on himself
224+
//
225+
// /tmp/cli2843369229/Arduino/CompileIntegrationTestSymlinkSelfLoop
226+
// ├── CompileIntegrationTestSymlinkSelfLoop.ino
227+
// └── loop -> /tmp/cli2843369229/Arduino/CompileIntegrationTestSymlinkSelfLoop/loop
228+
//
229+
// in this case the link is "broken", and it will be ignored by the compiler
224230
loopFilePath := sketchPath.Join("loop")
225231
err = os.Symlink(loopFilePath.String(), loopFilePath.String())
226232
require.NoError(t, err)
227233

228-
// Build sketch for arduino:avr:uno
234+
_, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String())
235+
require.NoError(t, err)
236+
237+
// Add a symlink that loops on himself named as a .ino file
238+
//
239+
// /tmp/cli2843369229/Arduino/CompileIntegrationTestSymlinkSelfLoop
240+
// ├── CompileIntegrationTestSymlinkSelfLoop.ino
241+
// ├── loop -> /tmp/cli2843369229/Arduino/CompileIntegrationTestSymlinkSelfLoop/loop
242+
// └── loop.ino -> /tmp/cli2843369229/Arduino/CompileIntegrationTestSymlinkSelfLoop/loop.ino
243+
//
244+
// in this case the new link is "broken" as before, but being part of the sketch will trigger an error.
245+
loopInoFilePath := sketchPath.Join("loop.ino")
246+
err = os.Symlink(loopFilePath.String(), loopInoFilePath.String())
247+
require.NoError(t, err)
248+
229249
_, stderr, err := cli.Run("compile", "-b", fqbn, sketchPath.String())
230250
// The assertion is a bit relaxed in this case because win behaves differently from macOs and linux
231251
// returning a different error detailed message
232-
require.Contains(t, string(stderr), "Can't open sketch:")
252+
require.Contains(t, string(stderr), "Error during build:")
233253
require.Error(t, err)
234254
}
235255
{

0 commit comments

Comments
 (0)