[Concept,0/9] test: Various improvements to unit-test infrastructure

Message ID 20251229160611.3899708-1-sjg@u-boot.org
Headers
Series test: Various improvements to unit-test infrastructure |

Message

Simon Glass Dec. 29, 2025, 4:05 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>


This series adds several improvements to the unit-test infrastructure:

- Move disk images to the persistent-data directory so they don't
  pollute the source tree
- Add a way to keep pytest-created artefacts for faster iteration on
  C tests
- Add a helper to simplify running manual unit tests from Python
- Allow combined flags with the ut command (e.g. -Efm)
- Add a -E flag to emit machine-readable result lines
- Add a -P flag to distribute tests across parallel workers
- Add -m as an alias for -f (force manual tests)

These changes make it easier to run and debug tests, especially when
iterating on C test code.


Simon Glass (9):
  test: Move disk images to persistent-data directory
  test: Write the SPI image to the persistent-data directory
  test: py: Add --persist flag to keep test artefacts
  test: py: Add run_ut() helper for manual unit tests
  test: ut: Add -m as alias for the -f flag
  test: ut: Refactor argument processing to use a loop
  test: Add a flag to emit per-test result lines
  doc: ut: Document return value
  test: Add parallel test execution support

 doc/develop/py_testing.rst          | 35 ++++++++++++
 doc/usage/cmd/ut.rst                | 38 +++++++++++--
 drivers/mmc/sandbox_mmc.c           | 13 ++++-
 drivers/mtd/spi/sandbox.c           | 14 ++++-
 drivers/scsi/sandbox_scsi.c         | 13 ++++-
 drivers/usb/emul/sandbox_flash.c    | 12 +++-
 include/test/test.h                 |  6 ++
 test/cmd_ut.c                       | 64 ++++++++++++++-------
 test/dm/sf.c                        |  4 +-
 test/py/conftest.py                 |  3 +
 test/py/console_base.py             | 27 +++++++++
 test/py/img/armbian.py              |  2 +-
 test/py/img/common.py               |  2 +-
 test/py/img/efi.py                  |  2 +-
 test/py/tests/test_fit_print.py     |  8 +--
 test/py/tests/test_fs/test_basic.py | 87 +++++++++--------------------
 test/py/tests/test_fs/test_ext4l.py |  4 +-
 test/py/tests/test_upl.py           |  3 +-
 test/py/tests/test_ut.py            | 13 +++--
 test/py/tests/test_vbe.py           |  8 +--
 test/test-main.c                    | 13 +++++
 21 files changed, 252 insertions(+), 119 deletions(-)