@@ -283,3 +283,43 @@ func TestCompileManuallyInstalledPlatform(t *testing.T) {
283
283
_ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
284
284
require .NoError (t , err )
285
285
}
286
+
287
+ func TestCompileManuallyInstalledPlatformUsingPlatformLocalTxt (t * testing.T ) {
288
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
289
+ defer env .CleanUp ()
290
+
291
+ _ , _ , err := cli .Run ("update" )
292
+ require .NoError (t , err )
293
+
294
+ sketchName := "CompileSketchManuallyInstalledPlatformUsingPlatformLocalTxt"
295
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
296
+ fqbn := "arduino-beta-development:avr:uno"
297
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
298
+ require .NoError (t , err )
299
+
300
+ // Manually installs a core in sketchbooks hardware folder
301
+ gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
302
+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "avr" )
303
+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
304
+ URL : gitUrl ,
305
+ ReferenceName : plumbing .NewTagReferenceName ("1.8.3" ),
306
+ })
307
+ require .NoError (t , err )
308
+
309
+ // Installs also the same core via CLI so all the necessary tools are installed
310
+ _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
311
+ require .NoError (t , err )
312
+
313
+ // Verifies compilation works without issues
314
+ _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
315
+ require .NoError (t , err )
316
+
317
+ // Overrides default platform compiler with an unexisting one
318
+ platformLocalTxt := repoDir .Join ("platform.local.txt" )
319
+ platformLocalTxt .WriteFile ([]byte ("compiler.c.cmd=my-compiler-that-does-not-exist" ))
320
+
321
+ // Verifies compilation now fails because compiler is not found
322
+ _ , stderr , err := cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
323
+ require .Error (t , err )
324
+ require .Contains (t , string (stderr ), "my-compiler-that-does-not-exist" )
325
+ }
0 commit comments