@@ -712,3 +712,39 @@ def test_core_with_wrong_custom_board_options_is_loaded(run_command, data_dir):
712
712
+ "skipping loading of boards arduino-beta-dev:platform_with_wrong_custom_board_options:nessuno: "
713
713
+ "malformed custom board options"
714
714
) in res .stderr
715
+
716
+
717
+ def test_core_with_missing_custom_board_options_is_loaded (run_command , data_dir ):
718
+ test_platform_name = "platform_with_missing_custom_board_options"
719
+ platform_install_dir = Path (data_dir , "hardware" , "arduino-beta-dev" , test_platform_name )
720
+ platform_install_dir .mkdir (parents = True )
721
+
722
+ # Install platform in Sketchbook hardware dir
723
+ shutil .copytree (
724
+ Path (__file__ ).parent / "testdata" / test_platform_name , platform_install_dir , dirs_exist_ok = True ,
725
+ )
726
+
727
+ assert run_command ("update" )
728
+
729
+ res = run_command ("core list --format json" )
730
+ assert res .ok
731
+
732
+ cores = json .loads (res .stdout )
733
+ mapped = {core ["id" ]: core for core in cores }
734
+ assert len (mapped ) == 1
735
+ # Verifies platform is loaded except excluding board with missing options
736
+ assert "arduino-beta-dev:platform_with_missing_custom_board_options" in mapped
737
+ boards = {b ["fqbn" ]: b for b in mapped ["arduino-beta-dev:platform_with_missing_custom_board_options" ]["boards" ]}
738
+ assert len (boards ) == 1
739
+ # Verify board with malformed options is not loaded
740
+ assert "arduino-beta-dev:platform_with_missing_custom_board_options:nessuno" not in boards
741
+ # Verify other board is loaded
742
+ assert "arduino-beta-dev:platform_with_missing_custom_board_options:altra" in boards
743
+ # Verify warning is shown to user
744
+ assert (
745
+ "Error initializing instance: "
746
+ + "loading platform release arduino-beta-dev:[email protected] : "
747
+ + "loading boards: "
748
+ + "skipping loading of boards arduino-beta-dev:platform_with_missing_custom_board_options:nessuno: "
749
+ + "malformed custom board options"
750
+ ) in res .stderr
0 commit comments