@@ -261,42 +261,6 @@ func TestCompileWithConflictingLibrariesInclude(t *testing.T) {
261
261
require .Contains (t , string (stdout ), expectedOutput [0 ]+ "\n " + expectedOutput [1 ]+ "\n " + expectedOutput [2 ]+ "\n " )
262
262
}
263
263
264
- func TestCompileWithInvalidBuildOptionJson (t * testing.T ) {
265
- env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
266
- defer env .CleanUp ()
267
-
268
- _ , _ , err := cli .Run ("update" )
269
- require .NoError (t , err )
270
-
271
- _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
272
- require .NoError (t , err )
273
-
274
- sketchName := "CompileInvalidBuildOptionsJson"
275
- sketchPath := cli .SketchbookDir ().Join (sketchName )
276
- fqbn := "arduino:avr:uno"
277
-
278
- // Create a test sketch
279
- _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
280
- require .NoError (t , err )
281
-
282
- // Get the build directory
283
- md5 := md5 .Sum (([]byte (sketchPath .String ())))
284
- sketchPathMd5 := strings .ToUpper (hex .EncodeToString (md5 [:]))
285
- require .NotEmpty (t , sketchPathMd5 )
286
- buildDir := paths .TempDir ().Join ("arduino-sketch-" + sketchPathMd5 )
287
-
288
- _ , _ , err = cli .Run ("compile" , "-b" , fqbn , sketchPath .String (), "--verbose" )
289
- require .NoError (t , err )
290
-
291
- // Breaks the build.options.json file
292
- buildOptionsJson := buildDir .Join ("build.options.json" )
293
- err = buildOptionsJson .WriteFile ([]byte ("invalid json" ))
294
- require .NoError (t , err )
295
-
296
- _ , _ , err = cli .Run ("compile" , "-b" , fqbn , sketchPath .String (), "--verbose" )
297
- require .NoError (t , err )
298
- }
299
-
300
264
func TestCompileWithEsp32BundledLibraries (t * testing.T ) {
301
265
// Some esp cores have have bundled libraries that are optimize for that architecture,
302
266
// it might happen that if the user has a library with the same name installed conflicts
@@ -449,46 +413,6 @@ func TestCompileSketchWithIppFileInclude(t *testing.T) {
449
413
require .NoError (t , err )
450
414
}
451
415
452
- func TestCompileWithRelativeBuildPath (t * testing.T ) {
453
- env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
454
- defer env .CleanUp ()
455
-
456
- _ , _ , err := cli .Run ("update" )
457
- require .NoError (t , err )
458
-
459
- _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
460
- require .NoError (t , err )
461
-
462
- sketchName := "sketch_simple"
463
- sketchPath := cli .CopySketch (sketchName )
464
- fqbn := "arduino:avr:uno"
465
-
466
- buildPath := paths .New (".." ).Join ("build_path" )
467
- workingDir := cli .SketchbookDir ().Join ("working_dir" )
468
- err = workingDir .Mkdir ()
469
- require .NoError (t , err )
470
- cli .SetWorkingDir (workingDir )
471
- _ , _ , err = cli .Run ("compile" , "-b" , fqbn , "--build-path" , buildPath .String (), sketchPath .String (), "-v" )
472
- require .NoError (t , err )
473
- cli .SetWorkingDir (env .RootDir ())
474
-
475
- absoluteBuildPath := cli .SketchbookDir ().Join ("build_path" )
476
- builtFiles , err := absoluteBuildPath .ReadDir ()
477
- require .NoError (t , err )
478
- require .Contains (t , builtFiles [8 ].String (), sketchName + ".ino.eep" )
479
- require .Contains (t , builtFiles [9 ].String (), sketchName + ".ino.elf" )
480
- require .Contains (t , builtFiles [10 ].String (), sketchName + ".ino.hex" )
481
- require .Contains (t , builtFiles [11 ].String (), sketchName + ".ino.with_bootloader.bin" )
482
- require .Contains (t , builtFiles [12 ].String (), sketchName + ".ino.with_bootloader.hex" )
483
- require .Contains (t , builtFiles [0 ].String (), "build.options.json" )
484
- require .Contains (t , builtFiles [1 ].String (), "compile_commands.json" )
485
- require .Contains (t , builtFiles [2 ].String (), "core" )
486
- require .Contains (t , builtFiles [3 ].String (), "includes.cache" )
487
- require .Contains (t , builtFiles [4 ].String (), "libraries" )
488
- require .Contains (t , builtFiles [6 ].String (), "preproc" )
489
- require .Contains (t , builtFiles [7 ].String (), "sketch" )
490
- }
491
-
492
416
func TestCompileWithoutUploadAndFqbn (t * testing.T ) {
493
417
env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
494
418
defer env .CleanUp ()
@@ -550,91 +474,3 @@ func TestCompileWithKnownPlatformNotInstalled(t *testing.T) {
550
474
// Verifies command to fix error is shown to user
551
475
require .Contains (t , string (stderr ), "Try running `arduino-cli core install arduino:avr`" )
552
476
}
553
-
554
- func TestCompileWithFakeSecureBootCore (t * testing.T ) {
555
- env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
556
- defer env .CleanUp ()
557
-
558
- _ , _ , err := cli .Run ("update" )
559
- require .NoError (t , err )
560
-
561
- _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
562
- require .NoError (t , err )
563
-
564
- sketchName := "SketchSimple"
565
- sketchPath := cli .SketchbookDir ().Join (sketchName )
566
- fqbn := "arduino:avr:uno"
567
-
568
- _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
569
- require .NoError (t , err )
570
-
571
- // Verifies compilation works
572
- _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
573
- require .NoError (t , err )
574
-
575
- // Overrides default platform adding secure_boot support using platform.local.txt
576
- avrPlatformPath := cli .DataDir ().Join ("packages" , "arduino" , "hardware" , "avr" , "1.8.3" , "platform.local.txt" )
577
- testPlatformName := "platform_with_secure_boot"
578
- wd , err := paths .Getwd ()
579
- require .NoError (t , err )
580
- err = wd .Parent ().Join ("testdata" , testPlatformName , "platform.local.txt" ).CopyTo (avrPlatformPath )
581
- require .NoError (t , err )
582
-
583
- // Overrides default board adding secure boot support using board.local.txt
584
- avrBoardPath := cli .DataDir ().Join ("packages" , "arduino" , "hardware" , "avr" , "1.8.3" , "boards.local.txt" )
585
- err = wd .Parent ().Join ("testdata" , testPlatformName , "boards.local.txt" ).CopyTo (avrBoardPath )
586
- require .NoError (t , err )
587
-
588
- // Verifies compilation works with secure boot disabled
589
- stdout , _ , err := cli .Run ("compile" , "--clean" , "-b" , fqbn + ":security=none" , sketchPath .String (), "-v" )
590
- require .NoError (t , err )
591
- require .Contains (t , string (stdout ), "echo exit" )
592
-
593
- // Verifies compilation works with secure boot enabled
594
- stdout , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn + ":security=sien" , sketchPath .String (), "-v" )
595
- require .NoError (t , err )
596
- require .Contains (t , string (stdout ), "Default_Keys/default-signing-key.pem" )
597
- require .Contains (t , string (stdout ), "Default_Keys/default-encrypt-key.pem" )
598
-
599
- // Verifies compilation does not work with secure boot enabled and using only one flag
600
- _ , stderr , err := cli .Run (
601
- "compile" ,
602
- "--clean" ,
603
- "-b" ,
604
- fqbn + ":security=sien" ,
605
- sketchPath .String (),
606
- "--keys-keychain" ,
607
- cli .SketchbookDir ().String (),
608
- "-v" ,
609
- )
610
- require .Error (t , err )
611
- require .Contains (t , string (stderr ), "Flag --sign-key is mandatory when used in conjunction with flag --keys-keychain" )
612
-
613
- // Verifies compilation works with secure boot enabled and when overriding the sign key and encryption key used
614
- keysDir := cli .SketchbookDir ().Join ("keys_dir" )
615
- err = keysDir .Mkdir ()
616
- require .NoError (t , err )
617
- signKeyPath := keysDir .Join ("my-sign-key.pem" )
618
- _ , err = signKeyPath .Create ()
619
- require .NoError (t , err )
620
- encryptKeyPath := cli .SketchbookDir ().Join ("my-encrypt-key.pem" )
621
- _ , err = encryptKeyPath .Create ()
622
- require .NoError (t , err )
623
- stdout , _ , err = cli .Run (
624
- "compile" ,
625
- "--clean" ,
626
- "-b" ,
627
- fqbn + ":security=sien" ,
628
- sketchPath .String (),
629
- "--keys-keychain" ,
630
- keysDir .String (),
631
- "--sign-key" ,
632
- "my-sign-key.pem" ,
633
- "--encrypt-key" ,
634
- "my-encrypt-key.pem" ,
635
- "-v" ,
636
- )
637
- require .NoError (t , err )
638
- require .Contains (t , string (stdout ), "my-sign-key.pem" )
639
- require .Contains (t , string (stdout ), "my-encrypt-key.pem" )
640
- }
0 commit comments