summaryrefslogtreecommitdiff
path: root/test/boot/bootflow.c
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-07-06 18:26:12 -0600
committerTom Rini <[email protected]>2026-07-06 18:26:12 -0600
commitee5d46b45ec0c63f8f9dd1e816e0dac3452ccc3d (patch)
tree800cd9e204ca027144070101884c0d5d3c00130f /test/boot/bootflow.c
parentece349ade2973e220f524ce59e59711cc919263f (diff)
parenta18265f1ccb7a272721ed4286ed3b5a6182ff424 (diff)
Merge branch 'next'
Diffstat (limited to 'test/boot/bootflow.c')
-rw-r--r--test/boot/bootflow.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 56ee1952357..1cc137c9700 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -19,6 +19,8 @@
#include <mapmem.h>
#ifdef CONFIG_SANDBOX
#include <asm/test.h>
+#include <sandbox_host.h>
+#include <os.h>
#endif
#include <dm/device-internal.h>
#include <dm/lists.h>
@@ -1532,3 +1534,48 @@ static int bootstd_images(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootstd_images, UTF_CONSOLE);
+
+#if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL)
+/*
+ * Check that bootdev scanning does not stop if higher-priority bootdevs
+ * are failed to be hunted.
+ */
+static int bootdev_hunt_fallthrough(struct unit_test_state *uts)
+{
+ struct bootstd_priv *std;
+ struct udevice *dev;
+
+ ut_assertok(bootstd_get_priv(&std));
+ bootstd_test_drop_bootdev_order(uts);
+ test_set_skip_delays(true);
+ bootstd_reset_usb();
+ console_record_reset_enable();
+
+ /*
+ * Create a sandbox block device (BOOTDEVP_4_SCAN_FAST) and mark it as
+ * broken so that bootdev_hunt_prio() returns an error.
+ */
+ ut_asserteq(0, uclass_id_count(UCLASS_HOST));
+ ut_assertok(host_create_device("test", true, DEFAULT_BLKSZ, &dev));
+ ut_assertok(host_set_flags_by_label("test", HOST_FLAG_BROKEN));
+ ut_asserteq(1, uclass_id_count(UCLASS_HOST));
+
+ /*
+ * Scan with hunting.
+ * The sandbox hunter at priority 4 must fail, but the USB hunter at
+ * priority 5 must still be reached.
+ */
+ ut_assertok(run_command("bootflow scan -l", 0));
+
+ ut_assert(!(std->hunters_used & BIT(HOST_HUNTER)));
+ ut_assert_skip_to_line("Hunting with: host");
+
+ /* USB was hunted despite the sandbox hunter failure */
+ ut_assert(std->hunters_used & BIT(USB_HUNTER));
+ ut_assert_skip_to_line("Bus usb@1: 5 USB Device(s) found");
+
+ return 0;
+}
+BOOTSTD_TEST(bootdev_hunt_fallthrough,
+ UTF_DM | UTF_SCAN_FDT | UTF_SF_BOOTDEV | UTF_CONSOLE);
+#endif /* CONFIG_SANDBOX */