[PATCH v4 2/2] test: bootdev: scan with a broken high-priority device

Simon Glass sjg at chromium.org
Tue Jun 23 16:49:36 CEST 2026


Hi Denis,

On 2026-06-23T01:49:28, None <dmukhin at ford.com> wrote:
> test: bootdev: scan with a broken high-priority device
>
> Add bootdev_hunt_fallthrough() test to verify that 'bootflow scan -l'
> falls back to a lower-priority bootdev when a higher-priority hunter
> fails.
>
> Introduce a simple 'sandbox-bootdev' device for the test. The new
> bootdev can be configured to produce an error at the hunting stage.
>
> Introduce new host_set_flags_by_label() API and a flags field to
> 'host_sb_plat' to simulate a bootdev hunter failure for the test.
>
> Adjust boot{dev,flow} tests which depend on bootdev hunters.
>
> Signed-off-by: Denis Mukhin <dmukhin at ford.com>
>
> drivers/block/Makefile          |  2 +-
>  drivers/block/host-uclass.c     | 15 +++++++++
>  drivers/block/sandbox-bootdev.c | 73 +++++++++++++++++++++++++++++++++++++++++
>  include/sandbox_host.h          | 18 ++++++++++
>  test/boot/bootdev.c             | 23 ++++++-------
>  test/boot/bootflow.c            | 46 ++++++++++++++++++++++++++
>  test/boot/bootstd_common.h      |  5 ++-
>  7 files changed, 169 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

code-style nits below

> diff --git a/drivers/block/sandbox-bootdev.c b/drivers/block/sandbox-bootdev.c
> @@ -0,0 +1,73 @@
> +/**
> + * sandbox_bootdev_hunt() - Hunt host bootdev.
> + *
> + * Note, this hunter exists for bootdev testing to simulate a fail
> + * mode.  Do not use as an example of a real hunter.
> + *
> + * @info: Hunder details.
> + * @show: Enable extra printouts.
> + *
> + * Returns: 0 if OK, -ve on error (expected by the test)
> + */

Typo: Hunder -> Hunter. Also 'a fail mode' reads better as 'a failure mode'.

> diff --git a/drivers/block/sandbox-bootdev.c b/drivers/block/sandbox-bootdev.c
> @@ -0,0 +1,73 @@
> +             if (plat->flags & HOST_FLAG_BROKEN) {
> +                     ret = -ETIME;
> +                     log_debug("cannot hunt sandbox device '%s': %d\n",
> +                                     plat->label, ret);
> +                     return ret;
> +             }

Please align the continuation with the character after the open
parenthesis (tab + spaces) (patman will check this for you)

> diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
> @@ -1532,3 +1534,47 @@ static int bootstd_images(struct unit_test_state *uts)
> +     ut_assert(!(std->hunters_used & BIT(HOST_HUNTER)));
> +
> +     /* USB was hunted despite the sandbox hunter failure */
> +     ut_assert(std->hunters_used & BIT(USB_HUNTER));
> +     ut_assert_skip_to_line("Bus usb at 1: 5 USB Device(s) found");

It might be worth asserting that 'Hunting with: host' appears before
the USB one, so we know the host hunter was attempted?

Regards,
Simon


More information about the U-Boot mailing list