@@ -346,3 +346,27 @@ func TestCompileWithEsp8266BundledLibraries(t *testing.T) {
346
346
}
347
347
require .NotContains (t , string (stdout ), expectedOutput [0 ]+ "\n " + expectedOutput [1 ]+ "\n " + expectedOutput [2 ]+ "\n " )
348
348
}
349
+
350
+ func TestGenerateCompileCommandsJsonResilience (t * testing.T ) {
351
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
352
+ defer env .CleanUp ()
353
+
354
+ _ , _ , err := cli .Run ("update" )
355
+ require .NoError (t , err )
356
+
357
+ // check it didn't fail with esp32@2.0.1 that has a prebuild hook that must run:
358
+ // https://github.com/arduino/arduino-cli/issues/1547
359
+ url := "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
360
+ _ , _ , err = cli .Run ("core" , "update-index" , "--additional-urls=" + url )
361
+ require .NoError (t , err )
362
+ _ , _ , err = cli .Run ("core" , "install" , "esp32:esp32@2.0.1" , "--additional-urls=" + url )
363
+ require .NoError (t , err )
364
+ sketchPath := cli .CopySketch ("sketch_simple" )
365
+ _ , _ , err = cli .Run ("compile" , "-b" , "esp32:esp32:featheresp32" , "--only-compilation-database" , sketchPath .String ())
366
+ require .NoError (t , err )
367
+
368
+ // check it didn't fail on a sketch with a missing include
369
+ sketchPath = cli .CopySketch ("sketch_with_missing_include" )
370
+ _ , _ , err = cli .Run ("compile" , "-b" , "esp32:esp32:featheresp32" , "--only-compilation-database" , sketchPath .String ())
371
+ require .NoError (t , err )
372
+ }
0 commit comments