diff options
author | Simon Glass <sjg@chromium.org> | 2022-07-30 15:52:36 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-12 08:17:11 -0400 |
commit | 11361c596585bff7530e993e2d6c88c2766c0913 (patch) | |
tree | a48635e5ee5f96dc53464f826f10a93791d9d5d2 | |
parent | 228fe57ad20343dd9ff25ad103b6af3602aea602 (diff) | |
download | u-boot-11361c596585bff7530e993e2d6c88c2766c0913.zip u-boot-11361c596585bff7530e993e2d6c88c2766c0913.tar.gz u-boot-11361c596585bff7530e993e2d6c88c2766c0913.tar.bz2 |
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 <sjg@chromium.org>
-rw-r--r-- | configs/sandbox_flattree_defconfig | 2 | ||||
-rw-r--r-- | test/boot/bootflow.c | 7 | ||||
-rw-r--r-- | test/boot/bootmeth.c | 24 |
3 files changed, 26 insertions, 7 deletions
diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index a71ce77..6d62fee 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 d2c42e8..8530523 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -12,7 +12,9 @@ #include <bootmeth.h> #include <bootstd.h> #include <dm.h> +#ifdef CONFIG_SANDBOX #include <asm/test.h> +#endif #include <dm/lists.h> #include <test/suites.h> #include <test/ut.h> @@ -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 ae21629..fb62731 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)); |