test: py: Add --persist flag to keep test artefacts

When iterating on C test code, the Python fixtures that create disk
images run each time, even though the images have not changed. This
slows down the development cycle unnecessarily.

Add a -P/--persist option to prevent cleanup of test-generated files
like disk images. This allows re-running C tests directly, without
re-running the Python fixture each time.

Update the ext4l test to respect the persist flag.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-28 20:47:21 -07:00
committed by Simon Glass
parent 0f1d14835b
commit 1dd04b3fcb
3 changed files with 12 additions and 2 deletions

View File

@@ -246,6 +246,13 @@ Command-line options
sets the directory used to store persistent test data. This is test data that
may be re-used across test runs, such as file-system images.
-P, --persist
prevents cleanup of test-generated files like disk images after the test run
completes. This is useful when iterating on C test code, allowing you to
re-run the C tests without re-running the Python fixture that creates the
test images. Note that this must be individually supported by each test, e.g.
with a check against u_boot_config.persist before removing images.
--timing
shows a histogram of test duration, at the end of the run. The columns are: