mbox series

[v2,0/6] fitimage selftests: stop hardcoding DISTRO/MACHINE, drop meta-yocto-bsp dependency

Message ID 20260619112046.125876-1-adrian.freihofer@siemens.com
Headers show
Series fitimage selftests: stop hardcoding DISTRO/MACHINE, drop meta-yocto-bsp dependency | expand

Message

AdrianF June 19, 2026, 11:17 a.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Changes in comparison to v1:
- 2 of 3 patches got merged already, this is just the last one of v1
- Split it into 6 smaller commits
  - Final result is equal
  - oe-selftest was run for all commits, for no-distro and for poky

Note: These 6 patches replace the commit
  "oeqa/selftest/fitimage: use the provided DISTRO and MACHINE, skip if
  unsupported"
  on today's master-next.



The fitimage selftests had two fundamental issues:

- dependency on meta-yocto-bsp
Several tests referenced `beaglebone-yocto` and the `bbb-dtbs-as-ext` recipe,
both of which live in meta-yocto-bsp, not in OE-core. The tests simply could
not pass in a plain OE-core setup.

- hardcoded MACHINE overrides the caller's configuration
Every test wrote `MACHINE = "beaglebone-yocto"` unconditionally into
`selftest.inc`. This means that regardless of what MACHINE the user or
autobuilder had configured, the tests always built for beaglebone. There are
two consequences:

This results in a false sense of test coverage:

- The test result says nothing about whether the active machine works — it
  reports a pass for a machine that was silently substituted.
- In environments that configure the machine via OE_FRAGMENTS, bitbake
  `bb.fatal()`s on a non-weak `MACHINE` assignment, so the tests fail
  immediately without even attempting to build.

This series fixes both problems. Tests no longer write `MACHINE` to the config;
instead they read the active machine at runtime via `get_bb_var("MACHINE")` and
look it up in a new `_MACHINE_SETTINGS` dict. If the machine is not listed, the
test calls `self.skipTest()` — keeping the suite green while making it obvious
which machines are covered. Several correctness fixes follow naturally from
exercising real per-machine code paths (conditional `sign-images`, `setup-1` on
x86, graceful fallback when no key-holding DTB exists). The `bbb-dtbs-as-ext`
recipe is replaced by a machine-agnostic `test-dtbs-as-ext`.
That also means that the FIT image tests are now skipped for most machines,
which is not ideal. But if the FIT image infrastructure is used on those
machines, then the tests can be enabled by adding the appropriate settings to
`_MACHINE_SETTINGS` later on.

Adrian Freihofer (6):
  oe-selftest: fitimage: replace _gen_random_file with _gen_elf64_dummy
  oe-selftest: fitimage: add machine-agnostic test-dtbs-as-ext recipe
  oe-selftest: fitimage: replace bbb-dtbs-as-ext with test-dtbs-as-ext
  oe-selftest: fitimage: replace MACHINE==qemux86-64 guards with
    KERNEL_SETUP_BIN
  oe-selftest: fitimage: add machine settings table and skip helpers
  oe-selftest: fitimage: stop hardcoding MACHINE and DISTRO in tests

 .../recipes-test/ext-dtb/bbb-dtbs-as-ext.bb   |  29 -
 .../ext-dtb/files/BBORG_RELAY-00A2.dts        |  49 --
 .../ext-dtb/files/am335x-bonegreen-ext.dts    |  14 -
 .../recipes-test/ext-dtb/files/test-ext.dts   |  17 +
 .../ext-dtb/files/test-overlay.dts            |  14 +
 .../recipes-test/ext-dtb/test-dtbs-as-ext.bb  |  25 +
 meta/lib/oeqa/selftest/cases/fitimage.py      | 536 +++++++++++++-----
 7 files changed, 459 insertions(+), 225 deletions(-)
 delete mode 100644 meta-selftest/recipes-test/ext-dtb/bbb-dtbs-as-ext.bb
 delete mode 100644 meta-selftest/recipes-test/ext-dtb/files/BBORG_RELAY-00A2.dts
 delete mode 100644 meta-selftest/recipes-test/ext-dtb/files/am335x-bonegreen-ext.dts
 create mode 100644 meta-selftest/recipes-test/ext-dtb/files/test-ext.dts
 create mode 100644 meta-selftest/recipes-test/ext-dtb/files/test-overlay.dts
 create mode 100644 meta-selftest/recipes-test/ext-dtb/test-dtbs-as-ext.bb