summaryrefslogtreecommitdiff
path: root/test/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-07-30 15:52:36 -0600
committerTom Rini <trini@konsulko.com>2022-08-12 08:17:11 -0400
commit11361c596585bff7530e993e2d6c88c2766c0913 (patch)
treea48635e5ee5f96dc53464f826f10a93791d9d5d2 /test/boot
parent228fe57ad20343dd9ff25ad103b6af3602aea602 (diff)
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>
Diffstat (limited to 'test/boot')
-rw-r--r--test/boot/bootflow.c7
-rw-r--r--test/boot/bootmeth.c24
2 files changed, 24 insertions, 7 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index d2c42e8b060..85305234e01 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 ae216293d64..fb627313396 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));