Skip orphan handling in U-Boot. We do synchronous journal commits
after each operation, so orphan recovery is not needed. Adding to
the orphan list without proper locking can corrupt the list.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Remove static from ext4_create(), ext4_mkdir(), ext4_symlink(), and
ext4_rename2() and add declarations in ext4.h to allow calling them
from ext4l interface code.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
U-Boot operates in a single-threaded environment without a journal
daemon. Commit transactions synchronously when jbd2_journal_stop()
is called and there are no active handles (t_updates == 0).
This ensures crash-safety by writing journal entries to disk immediately
after each file-operation completes.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The REQ_OP flags (REQ_SYNC, REQ_FUA) use bits 0-1, which collide
with REQ_OP_WRITE (value 1). Move the flags to bits 8+ and add
REQ_OP_MASK to properly separate operation from flags.
Move BH_OwnsData from buffer_head.h to ext4_uboot.h to keep
Linux headers unmodified. Define it as BH_JBDPrivateStart to
avoid conflicts with JBD2 state bits (17-25).
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Split the base_script to separate the ut command from the U-Boot command
sequence. This allows using run_ut() for the vbe_test_fixup test,
reducing duplication and improving consistency.
Cover-letter:
test: py: Convert more tests to use run_ut() helper
This series converts additional Python tests to use the run_ut() helper.
This reduces duplication and makes the tests more concise and consistent.
The ext4l tests are straightforward conversions, while test_vbe.py
requires splitting the U-Boot command script to separate the ut command.
END
Series-to: concept
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Convert test_ext4l.py to use the run_ut() helper instead of manually
building the ut command and checking for failures. This reduces
duplication and makes the tests more concise.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Running the full test suite takes a long time. It would be useful to
distribute tests across multiple sandbox instances to speed up testing.
Add support for running tests in parallel across multiple sandbox
instances. Each worker runs a subset of tests based on its worker ID.
Add -P<n>:<w> option to the ut command where n is the total number of
workers and w is this worker's ID (0 to n-1). Tests are distributed
by index modulo number of workers.
Series-to: u-boot
Series-cc: heinrich
Cover-letter:
test: Various improvements to unit-test infrastructure
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.
END
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add documentation for the return value of the ut command:
- Returns 0 on success if all tests pass
- Returns 1 on failure if any test fails
- Skipped tests do not cause a failure
Also explain when tests may be skipped and how to detect skipped tests
programmatically using the -E flag.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The ut command shows test output but does not provide a machine-readable
indication of whether each individual test passed or failed. External
tools must rely on heuristics like scanning for failure patterns in the
output.
Add a -E flag that emits an explicit result line after each test:
Result: PASS: test_name: file.c
Result: FAIL: test_name: file.c
This allows tools to reliably determine per-test pass/fail status
without fragile pattern matching. The flag is optional to maintain
backward compatibility with existing scripts.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The current argument-parsing logic uses switch (str[1]) which only
processes the second character of each argument. This prevents combining
multiple single-character flags in one argument (e.g., -fm).
Refactor the code to use a for loop that iterates through all characters
in the argument. For flags that take a value (like -r and -I), use goto
to skip the rest of the argument after processing.
This allows combined flags like -fmR instead of requiring -f -m -R.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add -m as an alias for the -f flag which forces manual tests to run.
This provides consistency with external test runners that will use -m
for "manual" tests.
Also update the documentation to explain what manual tests are, and fix
a typo ("types" -> "times") in the -r description.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Running manual unit tests (those with _norun suffix) involves a common
pattern: building the ut command with the -f flag, running it, and
checking for failures. This is verbose and error-prone.
Add a run_ut() method to ConsoleBase that simplifies this. It handles
the command construction, test arguments and failure checking
automatically.
Before:
output = ubman.run_command(
f'ut -f fs fs_test_ext4l_probe_norun fs_image={ext4_image}')
assert 'failures: 0' in output
After:
ubman.run_ut('fs', 'fs_test_ext4l_probe', fs_image=ext4_image)
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
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>
It is annoying to have disk images in the source directory since it
clutters up the working space.
Move spi.bin (used by the SPI tests) into the persistent-data
directory, update the driver and add a comment.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
It is annoying to have disk images in the source directory since it
clutters up the working space.
Remove cur_dir=True from DiskHelper calls so disk images are written to
the persistent-data directory instead.
Move scsi.img too (used by the bootstd tests) and mmc6.img (used by the
MBR tests.
Add a few comments as to where the images are used.
This keeps the source tree clean and puts disk images in the same place
as other test data.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This message is not needed since sphinx is now running in quiet mode.
Series-to: concept
Series-cc: heinrich
Cover-letter:
doc: Silence the sphinx build output
The sphinx/htmldocs build is very noisy, making it hard to see warnings
and errors. This series enables quiet mode for sphinx and removes
various other progress messages, so that only warnings and errors are
shown.
END
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Series-links: 1:93
The "enabling CJK for LaTeX builder" message adds noise to the build
output. Remove the print statement since the functionality is still
enabled.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add -s to the sub-make invocation so that the "Nothing to be done"
message is not shown.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The sphinx output is very noisy. Add -q to SPHINXOPTS so that only
warnings and errors are shown.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Implement ext4l_statfs() to return filesystem statistics using the
ext4 superblock. The function returns block size, total block count,
and free block count.
Add unit test to verify the statfs implementation returns valid data.
Cover-letter:
fs: ext4l: Complete read-only filesystem support (Part I)
This series completes read-only support for the ext4l filesystem driver,
which is a port of the Linux ext4 driver to U-Boot.
The ext4l driver provides more complete ext4 support than the existing
ext4 driver, including proper handling of extents, directory hashing,
and other ext4 features.
Changes include:
Sandbox infrastructure:
- Fix IRQ macros and buffer_head includes for sandbox builds
Core fixes:
- Fix path lookup by implementing proper dentry operations
- Fix fscrypt_match_name to do actual name comparison
Filesystem operations:
- Add directory listing (opendir/readdir/closedir)
- Add file existence check (exists)
- Add file size query (size)
- Add file read support (read)
- Add UUID query (uuid)
- Add filesystem statistics (statfs)
New command:
- Add fsinfo command to display filesystem statistics
Testing:
- Add comprehensive unit tests for all operations
- Enable fsuuid command for sandbox testing
END
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add the fsinfo command to display filesystem statistics including block
size, total blocks, used blocks, and free blocks. Both raw byte counts
and human-readable sizes are shown.
Example output:
=> fsinfo mmc 0:1
Block size: 4096 bytes
Total blocks: 16384 (67108864 bytes, 64 MiB)
Used blocks: 2065 (8458240 bytes, 8.1 MiB)
Free blocks: 14319 (58650624 bytes, 55.9 MiB)
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add infrastructure for obtaining filesystem statistics. This includes:
- struct fs_statfs to hold block size, total blocks, and free blocks
- statfs method in struct fstype_info
- fs_statfs() wrapper function
- fs_statfs_unsupported() stub for filesystems without support
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The filesystem uuid method is not implemented.
Add ext4l_uuid() which returns the filesystem UUID as a string and
wire it into the filesystem operations table. Add a test.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add ext4l_read() function to read file contents. The function resolves
the path to an inode, then reads the file block by block using
ext4_bread() and copies the data to the output buffer.
Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add ext4l_size() function to retrieve the size of a file or directory.
Wire it into the filesystem operations table in fs_legacy.c.
Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Implement ext4l_exists() to check if a file or directory exists on the
filesystem. This uses ext4l_resolve_path() to look up the path and
returns 1 if found, 0 otherwise.
Wire the function into fs_legacy.c and add a basic test.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Implement directory-iteration for the ext4l filesystem driver, allowing
callers to iterate through directory entries one at a time.
Add ext4l_opendir() which opens a directory and returns a stream handle,
ext4l_readdir() which returns the next directory entry, and
ext4l_closedir() which closes the stream and frees resources.
The implementation uses a struct dir_context to capture single entries
from ext4_readdir(), with logic to skip previously returned entries
since the htree code may re-emit them.
Update struct file to include a position.
Wire these functions into fs_legacy.c for the ext4l filesystem type.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Directory entries appear in hash order and mount messages may appear
multiple times during probe operations.
Update tests to skip remaining output after finding expected content.
We could perhaps refine this with more powerful matching, but that is
left for another day.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The fsuuid command is useful for testing filesystem UUID support.
Enable it by default for sandbox builds.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The fscrypt_match_name stub macro always returns 1, causing every
directory entry to match regardless of name. Also d_splice_alias is
a no-op that returns NULL, so the inode found by ext4_lookup is
never associated with the dentry.
Fix fscrypt_match_name to properly compare name lengths and contents.
Fix d_splice_alias, d_instantiate and d_instantiate_new to set
d->d_inode.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Convert the local_irq_* macros to static inline functions to avoid
"unused variable 'flags'" warnings when building with the atomic
operations from asm-generic/atomic.h.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The comment about atomic_t being expected from the including file is
outdated. Include asm-generic/atomic.h directly to provide the atomic_t
type definition.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The previous fix using -T4 is insufficient because queue-based job
distribution does not guarantee one board per thread. Even with 4
threads and 4 boards, a faster thread can finish its board and grab
another from the queue, causing .config to leak between boards in
the same thread's work directory.
Fix by using -P (per-board-out-dir) which gives each board its own
output directory, completely preventing .config leakage regardless
of thread scheduling.
Fixes: 17618b5975 ("buildman: Fix flaky test_kconfig_change test")
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Test declarations should immediately follow the closing brace of the
function they declare, with no blank line in between.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
QEMU comes with its own OpenSBI. For running RISC-V virtual machine
using one of qemu-riscv64_smode_defconfig or
qemu-riscv64_smode_acpi_defconfig is the natural choice.
Add the riscv64 smode configurations to the test scope.
Series-to: concept
Cover-letter:
CI: Tidy up riscv targets
There are some smode options for the QEMU builds, along with some
associated hooks.
This eries pulls these in from upstream, since the previous attempt has
broken qemu-riscv64
END
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
(cherry picked from 703efbb1a5)
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Provide test environments for running
qemu-riscv64_smode and qemu-riscv64_smode_acpi.
These use the OpenSBI implementation provided by QEMU and
pass main u-boot as -kernel parameter.
ACPI is enabled for both boards. We still expect the boards to use
QEMU's device-tree as control device-tree.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
(cherry picked from d94ebdd2c823ce8776723184cda960dcd2954711)
Remove the rva23s64 CPU since we don't have that in our QEMU:
Signed-off-by: Simon Glass <simon.glass@canonical.com>
There is in fact a 'msg' member for Commit, set up by the
Patchstream._close_commit() function. Declare it in the docs and set it
to empty when the Commit is created.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a --quiet-hooks option to suppress display of hook commands to
stdout while still logging them to the HTML log file. This reduces
console noise during test runs.
Cover-letter:
test: pytest and hook improvements
This series includes several improvements to the pytest infrastructure
and test hook configurations:
- Fix the timing check in conftest to properly check if timing is enabled
- Add a --quiet-hooks option to suppress hook command display
- Add and update ellesmere hook config files for various QEMU boards
- Update qemu-riscv64 config for S-mode with OpenSBI
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add configuration files for qemu-riscv32_smode, qemu-riscv64_smode,
qemu-riscv64_smode_acpi, qemu_arm64_acpi, and qemu_arm64_lwip boards.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Update the qemu-riscv64 hook config to use OpenSBI as the BIOS and load
U-Boot as the kernel, which is required for S-mode operation.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>