aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass2023-10-23 00:02:12 -0700
committerTom Rini2023-10-23 13:05:13 -0400
commit16e19350d91e3c7e916b85b84c0364b20ac193d2 (patch)
treeac17f09394be0ef6959658cc439b04babb8f0902 /test
parent7ae83bfaf437320ec6b6e883bd2896fba784fbf9 (diff)
bootstd: Correct logic for single uclass
The current logic for "bootflow mmc" is flawed since it checks the uclass of the bootdev instead of its parent, the media device. Correct this and add a test that covers this scenario. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Ivan T.Ivanov <iivanov@suse.de>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootdev.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 7228f545e9e..63786174805 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -232,6 +232,19 @@ static int bootdev_test_order(struct unit_test_state *uts)
iter.dev_used[2]->name);
bootflow_iter_uninit(&iter);
+ /* Try a single uclass */
+ ut_assertok(env_set("boot_targets", NULL));
+ ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow));
+ ut_asserteq(2, iter.num_devs);
+
+ /* Now scan pass mmc1 and make sure that only mmc0 shows up */
+ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
+ ut_asserteq(3, iter.num_devs);
+ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name);
+ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name);
+ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name);
+ bootflow_iter_uninit(&iter);
+
return 0;
}
BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT);