From: Simon Glass Date: Sat, 30 Jul 2022 21:52:36 +0000 (-0600) Subject: bootstd: Check building without global bootmeths X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=11361c596585bff7530e993e2d6c88c2766c0913;p=u-boot.git bootstd: Check building without global bootmeths Use the sandbox_flattree build to check that everything works correctly with BOOTMETH_GLOBAL disabled. Update the tests as needed. Signed-off-by: Simon Glass --- diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index a71ce77c40..6d62feeb08 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -11,6 +11,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +# CONFIG_BOOTMETH_VBE is not set CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_BOOTSTAGE_FDT=y @@ -206,6 +207,7 @@ CONFIG_RSA_VERIFY_WITH_PKEY=y CONFIG_TPM=y CONFIG_LZ4=y CONFIG_ERRNO_STR=y +# CONFIG_CMD_BOOTEFI_BOOTMGR is not set CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index d2c42e8b06..85305234e0 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -12,7 +12,9 @@ #include #include #include +#ifdef CONFIG_SANDBOX #include +#endif #include #include #include @@ -321,6 +323,7 @@ static int bootflow_iter(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_iter, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +#if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL) /* Check using the system bootdev */ static int bootflow_system(struct unit_test_state *uts) { @@ -344,6 +347,7 @@ static int bootflow_system(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_system, UT_TESTF_DM | UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +#endif /* Check disabling a bootmethod if it requests it */ static int bootflow_iter_disable(struct unit_test_state *uts) @@ -388,6 +392,9 @@ BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT); /* Check 'bootflow scan' with a bootmeth ordering including a global bootmeth */ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) { + if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) + return 0; + ut_assertok(bootstd_test_drop_bootdev_order(uts)); /* diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c index ae216293d6..fb62731339 100644 --- a/test/boot/bootmeth.c +++ b/test/boot/bootmeth.c @@ -23,9 +23,11 @@ static int bootmeth_cmd_list(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 0 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" 1 1 efi EFI boot from an .efi file"); - ut_assert_nextline(" glob 2 firmware0 VBE simple"); + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(3 bootmeths)"); + ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ? + "(3 bootmeths)" : "(2 bootmeths)"); ut_assert_console_end(); return 0; @@ -57,9 +59,11 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 0 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" - 1 efi EFI boot from an .efi file"); - ut_assert_nextline(" glob 2 firmware0 VBE simple"); + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(3 bootmeths)"); + ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ? + "(3 bootmeths)" : "(2 bootmeths)"); ut_assert_console_end(); /* Check the -a flag with the reverse order */ @@ -70,9 +74,11 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 1 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" 0 1 efi EFI boot from an .efi file"); - ut_assert_nextline(" glob 2 firmware0 VBE simple"); + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(3 bootmeths)"); + ut_assert_nextline(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ? + "(3 bootmeths)" : "(2 bootmeths)"); ut_assert_console_end(); /* Now reset the order to empty, which should show all of them again */ @@ -80,7 +86,8 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_console_end(); ut_assertnull(env_get("bootmeths")); ut_assertok(run_command("bootmeth list", 0)); - ut_assert_skip_to_line("(3 bootmeths)"); + ut_assert_skip_to_line(IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) ? + "(3 bootmeths)" : "(2 bootmeths)"); /* Try reverse order */ ut_assertok(run_command("bootmeth order \"efi syslinux\"", 0)); @@ -97,6 +104,9 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_console_end(); /* Try with global bootmeths */ + if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) + return 0; + ut_assertok(run_command("bootmeth order \"efi firmware0\"", 0)); ut_assert_console_end(); ut_assertok(run_command("bootmeth list", 0));