@@ -20,6 +20,7 @@ import (
20
20
"testing"
21
21
22
22
"github.com/arduino/arduino-cli/internal/integrationtest"
23
+ "github.com/arduino/go-paths-helper"
23
24
"github.com/stretchr/testify/require"
24
25
)
25
26
@@ -215,3 +216,37 @@ func TestCompileUsingPlatformLocalTxt(t *testing.T) {
215
216
require .Error (t , err )
216
217
require .Contains (t , string (stderr ), "my-compiler-that-does-not-exist" )
217
218
}
219
+
220
+ func TestCompileUsingBoardsLocalTxt (t * testing.T ) {
221
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
222
+ defer env .CleanUp ()
223
+
224
+ _ , _ , err := cli .Run ("update" )
225
+ require .NoError (t , err )
226
+
227
+ _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
228
+ require .NoError (t , err )
229
+
230
+ sketchName := "CompileSketchUsingBoardsLocalTxt"
231
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
232
+ // Usa a made up board
233
+ fqbn := "arduino:avr:nessuno"
234
+
235
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
236
+ require .NoError (t , err )
237
+
238
+ // Verifies compilation fails because board doesn't exist
239
+ _ , stderr , err := cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
240
+ require .Error (t , err )
241
+ require .Contains (t , string (stderr ), "Error during build: Error resolving FQBN: board arduino:avr:nessuno not found" )
242
+
243
+ // Use custom boards.local.txt with made arduino:avr:nessuno board
244
+ boardsLocalTxt := cli .DataDir ().Join ("packages" , "arduino" , "hardware" , "avr" , "1.8.3" , "boards.local.txt" )
245
+ wd , err := paths .Getwd ()
246
+ require .NoError (t , err )
247
+ err = wd .Parent ().Join ("testdata" , "boards.local.txt" ).CopyTo (boardsLocalTxt )
248
+ require .NoError (t , err )
249
+
250
+ _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
251
+ require .NoError (t , err )
252
+ }
0 commit comments