[PATCH 4/4] test: bootstd: add firmware-FDT source tests

Simon Glass sjg at chromium.org
Thu Jul 9 22:19:34 CEST 2026


Hi Carlo,

On 2026-07-06T15:06:41, Carlo Caione <ccaione at baylibre.com> wrote:
> test: bootstd: add firmware-FDT source tests
>
> Add sandbox coverage for firmware_fdt_load(): a python fixture builds
> mmc11.img, a GPT disk with A/B 'firmware' partitions whose first
> partition carries a FAT filesystem holding the FIT manifest (fdt.itb:
> a base DTB plus one overlay, with a default configuration that applies
> the overlay and a base-only 'conf-base' configuration).
>
> The tests cover the happy path (default configuration, packed size,
> both fixture properties visible), configuration selection via
> 'fw_fdt_config', and the fail-closed semantics: a missing pinned
> partition and a selector naming a configuration the manifest does not
> ship are fatal errors rather than -ENOENT, an unresolvable
> 'firmware-fdt-source' phandle is -EINVAL, and only a genuinely absent
> source returns -ENOENT.
>
> Signed-off-by: Carlo Caione <ccaione at baylibre.com>
>
> arch/sandbox/dts/test.dts |  24 ++++
>  configs/sandbox_defconfig |   1 +
>  test/boot/Makefile        |   1 +
>  test/boot/firmware_fdt.c  | 292 ++++++++++++++++++++++++++++++++++++++++++++++
>  test/py/tests/test_ut.py  | 110 +++++++++++++++++
>  5 files changed, 428 insertions(+)

> diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
> @@ -614,6 +614,115 @@ def setup_rauc_image(ubman):
> +    mmc_dev = 11
> +    fname = os.path.join(ubman.config.source_dir, f'mmc{mmc_dev}.img')

Every other setup_*_image() puts its image under persistent_data_dir
(or lets DiskHelper do it). Please put mmc11.img in the same place.

I have a pending series to move some of this around...I'll see if I
can send a new version.

> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> @@ -122,6 +123,14 @@
> +             /*
> +              * Not read by U-Boot: the firmware_fdt tests copy this into a
> +              * live 'firmware-fdt-source' property at runtime (and delete
> +              * it afterwards), so the source stays unconfigured for every
> +              * other test. It also keeps a phandle emitted for &fw_fdt.
> +              */
> +             test-fw-fdt-source = <&fw_fdt>;

I don't like this very much. Poking an inert marker into the shared
bootstd node just to keep a phandle alive, then having every test
mutate the live tree to graft the real property in and out, is
fragile - a failed ut_assert() in the middle of a test leaves the
tree half-configured for whatever runs next.

How about creating the whole thing (including adding a phandle) in the test?

> diff --git a/test/boot/firmware_fdt.c b/test/boot/firmware_fdt.c
> @@ -0,0 +1,292 @@
> +BOOTSTD_TEST(firmware_fdt_test_part_mismatch, UTF_DM | UTF_SCAN_FDT);

No coverage for the CONFIG_FIT_BEST_MATCH path advertised in the
cover letter (compatible-based configuration selection against the
control DT). Please add a test - a manifest with two configurations
carrying different compatible strings, where the base compatible
from the control DT picks one of them.

Regards,
Simon


More information about the U-Boot mailing list