Skip to content

Commit b3c561d

Browse files
committed
Added integration test
1 parent d940a3d commit b3c561d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: internal/integrationtest/compile_1/compile_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"crypto/md5"
2020
"encoding/hex"
2121
"encoding/json"
22+
"fmt"
2223
"os"
2324
"sort"
2425
"strings"
@@ -1220,6 +1221,28 @@ func buildWithCustomBuildPath(t *testing.T, env *integrationtest.Environment, cl
12201221
// Run build twice, to verify the build still works when the build directory is present at the start
12211222
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", "--build-path", buildPath.String(), sketchPath.String())
12221223
require.NoError(t, err)
1224+
1225+
// Run again a couple of times with a different build path, to verify that old build
1226+
// path is not copied back in the sketch build recursively.
1227+
// https://github.com/arduino/arduino-cli/issues/2266
1228+
secondBuildPath := sketchPath.Join("build2")
1229+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", "--build-path", secondBuildPath.String(), sketchPath.String())
1230+
require.NoError(t, err)
1231+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", "--build-path", buildPath.String(), sketchPath.String())
1232+
require.NoError(t, err)
1233+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", "--build-path", secondBuildPath.String(), sketchPath.String())
1234+
require.NoError(t, err)
1235+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", "--build-path", buildPath.String(), sketchPath.String())
1236+
require.NoError(t, err)
1237+
1238+
// Print build path content for debugging purposes
1239+
bp, _ := buildPath.ReadDirRecursive()
1240+
fmt.Println("Build path content:")
1241+
for _, file := range bp {
1242+
fmt.Println("> ", file.String())
1243+
}
1244+
1245+
require.False(t, buildPath.Join("sketch", "build2", "sketch").Exist())
12231246
})
12241247

12251248
t.Run("SameAsSektch", func(t *testing.T) {

0 commit comments

Comments
 (0)