diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:48:15 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:41 -0500 |
commit | 91943ff7038f9c47fb310dbc22150b5664c8fbf7 (patch) | |
tree | 34db142da2cb42b692d8589502234594ee7bc078 /test | |
parent | 47aedc29dcb9871e076f6e4aa82004633af513ef (diff) | |
download | u-boot-91943ff7038f9c47fb310dbc22150b5664c8fbf7.tar.gz u-boot-91943ff7038f9c47fb310dbc22150b5664c8fbf7.tar.bz2 u-boot-91943ff7038f9c47fb310dbc22150b5664c8fbf7.zip |
bootstd: Allow scanning a single bootdev label
We want to support scanning a single label, like 'mmc' or 'usb0'. Add
this feature by plumbing the label through to the iterator, setting a
flag to indicate that only siblings of the initial device should be used.
This means that scanning a bootdev by its name is not supported anymore.
That feature doesn't seem very useful in practice, so it is no great loss.
Add a test for bootdev_find_by_any() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/boot/bootdev.c | 2 | ||||
-rw-r--r-- | test/boot/bootflow.c | 62 |
2 files changed, 61 insertions, 3 deletions
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 679ffc4d8d..1724e34af3 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -626,7 +626,7 @@ static int bootdev_test_next_prio(struct unit_test_state *uts) struct udevice *dev; int ret; - sandbox_set_eth_enable(false); + test_set_eth_enable(false); test_set_skip_delays(true); /* get access to the used hunters */ diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 1a2c54c111..0b3a2fa6ac 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -76,7 +76,6 @@ static int bootflow_cmd(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_cmd, UT_TESTF_DM | UT_TESTF_SCAN_FDT); -#if 0 /* disable for now */ /* Check 'bootflow scan' with a label / seq */ static int bootflow_cmd_label(struct unit_test_state *uts) { @@ -124,7 +123,6 @@ static int bootflow_cmd_label(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_cmd_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT | UT_TESTF_ETH_BOOTDEV); -#endif /* Check 'bootflow scan/list' commands using all bootdevs */ static int bootflow_cmd_glob(struct unit_test_state *uts) @@ -564,6 +562,66 @@ static int bootflow_cmd_menu(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_cmd_menu, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +/* Check searching for a single bootdev using the hunters */ +static int bootflow_cmd_hunt_single(struct unit_test_state *uts) +{ + struct bootstd_priv *std; + + /* get access to the used hunters */ + ut_assertok(bootstd_get_priv(&std)); + + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + + console_record_reset_enable(); + ut_assertok(run_command("bootflow scan -l mmc1", 0)); + ut_assert_nextline("Scanning for bootflows with label 'mmc1'"); + ut_assert_skip_to_line("(1 bootflow, 1 valid)"); + ut_assert_console_end(); + + /* check that the hunter was used */ + ut_asserteq(BIT(MMC_HUNTER) | BIT(1), std->hunters_used); + + return 0; +} +BOOTSTD_TEST(bootflow_cmd_hunt_single, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + +/* Check searching for a uclass label using the hunters */ +static int bootflow_cmd_hunt_label(struct unit_test_state *uts) +{ + struct bootstd_priv *std; + + /* get access to the used hunters */ + ut_assertok(bootstd_get_priv(&std)); + + test_set_skip_delays(true); + test_set_eth_enable(false); + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + + console_record_reset_enable(); + ut_assertok(run_command("bootflow scan -l mmc", 0)); + + /* check that the hunter was used */ + ut_asserteq(BIT(MMC_HUNTER) | BIT(1), std->hunters_used); + + /* check that we got the mmc1 bootflow */ + ut_assert_nextline("Scanning for bootflows with label 'mmc'"); + ut_assert_nextlinen("Seq"); + ut_assert_nextlinen("---"); + ut_assert_nextline("Hunting with: simple_bus"); + ut_assert_nextline("Found 2 extension board(s)."); + ut_assert_nextline("Hunting with: mmc"); + ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); + ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); + ut_assert_nextline( + " 0 syslinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); + ut_assert_nextline("Scanning bootdev 'mmc0.bootdev':"); + ut_assert_skip_to_line("(1 bootflow, 1 valid)"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_cmd_hunt_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + /** * check_font() - Check that the font size for an item matches expectations * |