summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2026-04-22test: fit: Avoid restarting U-BootSimon Glass
We don't actually need to use the test FDT as the control FDT. It slows down the test since U-Boot needs to be restarted each time. Instead of restarting, update the test to clear memory before it loads the FIT. Rename the data-variable to fdt_data since is it no-longer the control FDT. Signed-off-by: Simon Glass <[email protected]>
2026-04-22test: fit: Drop the fit_signature buildconfigspecSimon Glass
The test_fit test requires buildconfigspec('fit_signature') but does not exercise signature verification. The ITS template includes a signature-1 node, but mkimage only needs TOOLS_FIT_SIGNATURE (a host tool option) to handle it, not CONFIG_FIT_SIGNATURE in the U-Boot binary. Since sandbox does not enable CONFIG_FIT_SIGNATURE, the test is silently skipped on every run. Change the marker to buildconfigspec('fit') which is all the test actually needs. Signed-off-by: Simon Glass <[email protected]>
2026-04-22gunzip: Implement chunked decompressionMarek Vasut
The current gzwrite() implementation is limited to 4 GiB compressed input buffer size due to struct z_stream_s { uInt avail_in } member, which is of type unsigned int. Current gzwrite() implementation sets the entire input buffer size as avail_in and performs decompression of the whole compressed input buffer in one round, which limits the size of input buffer to 4 GiB. Rework the decompression loop to use chunked approach, and decompress the input buffer in up to 4 GiB - 1 kiB avail_in chunks, possibly in multiple decompression rounds. This way, the compressed input buffer size is limited by gzwrite() function 'len' parameter type, which is unsigned long. In case of sandbox build, include parsing of 'gzwrite_chunk' environment variable, so the chunked approach can be thoroughly tested with non default chunk size. For non-sandbox builds, the chunk size is 4 GiB - 1 kiB. The gzwrite test case is extended to test various chunk sizes during gzwrite decompression test. Signed-off-by: Marek Vasut <[email protected]>
2026-04-21Merge patch series "test: Convert tests to use FsHelper and DiskHelper"Tom Rini
Simon Glass <[email protected]> says: This series adds a DiskHelper class and converts most test code to use FsHelper and DiskHelper instead of calling mk_fs() and setup_image() directly. The FsHelper class (already upstream) provides a cleaner interface for creating filesystem images, handling temporary directories and cleanup automatically. The new DiskHelper class builds on this, creating partitioned disk images from one or more FsHelper filesystems. DiskHelper includes a cur_dir flag to place the disk image in the current directory rather than the persistent-data directory. This matches the behaviour of setup_image() which places disk images in source_dir where sandbox expects to find them. This flag is needed for now and should be removed in a follow-up once all tests are migrated to use the persistent-data directory instead. With these helpers, test-setup code becomes shorter, more consistent and easier to follow. Manual sfdisk/dd/cleanup sequences are replaced by a few method calls. The series also fixes a broken fs_obj_fat fixture where a stale size_gran argument is silently causing the test to be skipped. A few EFI test fixtures (efi_capsule, efi_secboot, eficonfig) still use mk_fs() directly; these are left for a follow-up series since they would benefit from a full DiskHelper conversion. Link: https://lore.kernel.org/r/[email protected]
2026-04-21test: Convert test_fs fixtures to use FsHelperSimon Glass
Replace all direct calls to the mk_fs() function with FsHelper in the filesystem test fixtures. Each fixture now creates an FsHelper instance, populates its srcdir with test files, then calls mk_fs() on the object. This removes manual scratch-directory management and cleanup code, since FsHelper handles the source directory and image-file lifecycle. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert setup_rauc_image() to use FsHelperSimon Glass
Use FsHelper and DiskHelper to create the RAUC A/B disk image. This replaces the manual sfdisk and dd commands, making the code shorter and easier to follow. The same boot and root filesystems are added twice to produce the A/B partition layout. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Rename setup_bootflow_image()Simon Glass
The name of this is fairly vague. Use 'extlinux' so that it is clear that it relates to that format. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert test_ut_dm_init() to use FsHelperSimon Glass
Use the helper here, for consistency. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert setup_efi_image() to use FsHelperSimon Glass
Simplify this test-setup code by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert setup_bootflow_image() to use FsHelperSimon Glass
Simplify this test-setup code by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Split out core of Fedora image into a new functionSimon Glass
To permit easier adding of other images, move the Fedora-specific portions of setup_bootflow_image() into a separate function. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert setup_bootmenu_image() to use FsHelperSimon Glass
Simplify this test-setup code by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert test_efi_bootmgr to use FsHelperSimon Glass
Simplify this test by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert test_xxd to use FsHelperSimon Glass
Simplify this test by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Convert test_cat to use FsHelperSimon Glass
Simplify this test by using the helper. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Fix broken fs_obj_fat fixtureSimon Glass
The removal of the size_gran parameter from mk_fs() leaves a stale positional argument (1024) that is now interpreted as the fs_img filename. Since 1024 is an integer, os.path.join() raises TypeError, causing the fixture to silently skip via the bare except clause. Drop the stale argument so the fixture works again. Fixes: d030dc34d67a ("test: fs_helper: Drop the size_gran argument") Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: fs_helper: Skip empty srcdir when creating a filesystemSimon Glass
FsHelper.mk_fs() always creates a srcdir via setup(), then passes it to the module-level mk_fs(). This fails for filesystem types like ext2 that do not support the -d flag, raising ValueError even when no files need to be copied. Pass None for src_dir when the srcdir is empty, so that creating an empty filesystem works for all supported types. Signed-off-by: Simon Glass <[email protected]>
2026-04-21test: Add a helper class to create disk imagesSimon Glass
Provide a way to create disk images which consist of multiple filesystem images. Include a cur_dir option to place the disk image in the current directory rather than in the persistent-data directory. This matches the behaviour of setup_image() which places disk images in source_dir where sandbox expects to find them. This flag is a temporary feature and should be removed once all tests are migrated to use the persistent-data directory instead. Signed-off-by: Simon Glass <[email protected]>
2026-04-17fwu: Move boottime checks to EVT_POST_PREBOOTMichal Simek
Switch fwu_boottime_checks() from EVT_MAIN_LOOP to EVT_POST_PREBOOT because there is no reason to call FWU so early. FWU triggers EFI stack initialization before all devices are visible which prevents the EFI stack from scanning these devices and adding them to EFI variables. Signed-off-by: Michal Simek <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2026-04-17event: Check return value from event_notify_null()Michal Simek
event_notify_null() returns int but its return value is not checked in run_main_loop() and in fwu_mdata tests. Add proper error checking to all unchecked call sites. Signed-off-by: Michal Simek <[email protected]> Reviewed-by: Simon Glass <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2026-04-08cmd/scsi: drop scsi reset commandDavid Lechner
Since commit b630f8b3aefc ("scsi: Forceably finish migration to DM_SCSI") the "scsi reset" command has no possibility of actually resetting any SCSI controller. Drop the command to avoid confusion that the command is actually resetting the SCSI controller. Signed-off-by: David Lechner <[email protected]>
2026-04-07dm: Respect dma-ranges sizeMarek Vasut
Rework dev_phys_to_bus() and dev_bus_to_phys() to respect the size of the area specified in dma-ranges DT property. The area outside of ranges is remapped 1:1, while the area in the ranges is remapped according to the description in the dma-ranges property. Adjust the test to test the area within the remapped range, not area outside the remapped range, which was incorrect. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Markus Schneider-Pargmann <[email protected]>
2026-04-06Merge branch 'next'Tom Rini
2026-04-02cmd: test: add bug-compatibility special case for 'test -n'Rasmus Villemoes
It turns out that there is lots of code in the wild, including in the U-Boot tree itself, which used to rely on test -n $somevar to yield false when $somevar is not defined or empty. See for example all the occurrences of 'test -n $fdtfile'. That was really only a quirk of the implementation that refused calls with argc < 3, and not because it was interpreted as test -n "$somevar" which is how this should be spelled. While not exactly conforming to POSIX, we can accomodate such scripts by special-casing a single argument "-n" to be interpreted as if it comes from code as above with empty $somevar. Since we only just added the ability to test a string for emptiness using the single-argument form, it is very unlikely that there is code doing test "$str" which would now fail if $str happens to be exactly "-n"; such a test should really always be spelled test -n "$str" Fixes: 8b0619579b2 ("cmd: test: fix handling of single-argument form of test") Reported-by: Franz Schnyder <[email protected]> Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2026-03-30test: Correct dependencies for SPL_UNIT_TESTTom Rini
As exposed by "make randconfig", we have an issue with the dependencies for SPL_UNIT_TEST. In order to test SPL_DM_DEVICE_REMOVE we also need to have ensured that SPL_DM is enabled, so select that as well. Signed-off-by: Tom Rini <[email protected]>
2026-03-25Merge patch series "test/py: gpio: cleanups and improvement"Tom Rini
David Lechner <[email protected]> says: I wanted to do some quick tests to make sure gpios were working without having to dig out a schematic. Which means I didn't want to set any GPIO as an output first without checking. So the main point here is the last patch which allows gpio_op_pin to be optional and skip the test instead of failing with exception. This works similar to several other config options that are already optional in this module. I also noticed a few easy things to clean up while I was looking at the file, so there are a couple of extra patches for that. Link: https://lore.kernel.org/r/[email protected]
2026-03-25test/py: gpio: allow omitting gpio_op_pinDavid Lechner
Modify tests that make use of gpio_op_pin from env__gpio_dev_config to be skipped if gpio_op_pin is not provided. This is useful in cases where one might not be sure which GPIOs are safe to use as outputs that can be toggled without causing problems. Signed-off-by: David Lechner <[email protected]>
2026-03-25test/py: gpio: removing trailing semicolonsDavid Lechner
Remove trailing semicolons in test_gpio.py. Python does not require them and they are considered improper style. Signed-off-by: David Lechner <[email protected]>
2026-03-25test/py: gpio: remove unused importsDavid Lechner
Remove unused imports in test_gpio.py. Signed-off-by: David Lechner <[email protected]>
2026-03-25Merge patch series "add [ as alias for test, fix 0/1 argument handling"Tom Rini
Rasmus Villemoes <[email protected]> says: Make 'test' behave a little more like its cousins in other shells, by allowing the [ ... ] spelling, and while here, fix up the handling of a single, non-empty argument to comply with POSIX. Link: https://lore.kernel.org/r/[email protected]
2026-03-25cmd: test: fix handling of single-argument form of testRasmus Villemoes
POSIX states that 0 arguments: Exit false (1). 1 argument: Exit true (0) if $1 is not null; otherwise, exit false. and at least bash and busybox sh behave that way. The current 'argc < 3' does the right thing for a non-existing or empty argv[1], but not for a non-empty argv[1]. Fix that and add corresponding test cases. Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Anshul Dalal <[email protected]>
2026-03-25test: add tests for left-bracket alias for 'test' commandRasmus Villemoes
Duplicate a few of the existing test cases, using the [ spelling, and also ensure that the presence of a matching ] as a separate and last argument is enforced. Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Anshul Dalal <[email protected]>
2026-03-25virtio: Fix virtio initialization sequenceChristian Pötzsch
The virtio spec clearly states in "3.1.1 Driver Requirements: Device Initialization" the sequence a client has to follow after device reset. Because u-boot resets here again, it also needs to set the "acknowledge" bit again even if this was done in virtio_uclass_child_post_bind already once before. Signed-off-by: Christian Pötzsch <[email protected]> Signed-off-by: Adam Lackorzynski <[email protected]> [trini: Add VIRTIO_CONFIG_S_ACKNOWLEDGE flag check to the test] Signed-off-by: Tom Rini <[email protected]>
2026-03-25Merge patch series "virtio: rng: Handle oversized return buffers"Tom Rini
Meet Patel <[email protected]> says: The virtio-rng test to verify effective handling of oversized return buffers checks that an (undocumented) error is raised, instead of the real concern, which is the surrounding buffer integrity following a rng function call. Update the test to check that the other contents of a buffer remain unchanged instead of looking for an error code. Link: https://lore.kernel.org/r/[email protected]
2026-03-25test: dm: virtio_rng: Update virtio-rng testKavin Gunasekara
The virtio-rng test to verify effective handling of oversized return buffers checks that an (undocumented) error is raised, instead of the real concern, which is the surrounding buffer integrity following a rng function call. Update the test to check that the other contents of a buffer remain unchanged instead of looking for an error code. Signed-off-by: Kavin Gunasekara <[email protected]> Signed-off-by: Meet Patel <[email protected]> Reviewed-by: Andre Przywara <[email protected]>
2026-03-23Merge patch series "Provide a class for building filesystem images"Tom Rini
Simon Glass <[email protected]> says: Create a class around mk_fs() to handle the common tasks of image creation, such as managing scratch directories and cleaning up. Start with a few small cleanups to mk_fs(), then convert the helper to use a class. Link: https://lore.kernel.org/r/[email protected]
2026-03-23test: Convert fs_helper to use a classSimon Glass
Create a class around mk_fs() (and later setup_image()) to handle the common tasks of image creation. Many callers of fs_helper.mk_fs() create their own scratch directories while users of fs_helper.setup_image() rely on one being returned. Unify this by adding 'srcdir' as a field while converting to a class. The class delegates to the existing mk_fs() function for the actual filesystem creation, adding lifecycle management for scratch directories and the image file. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-23test: fs_helper: Drop the size_gran argumentSimon Glass
Nothing uses this argument, so make it a constant for now. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Christian Taedcke <[email protected]>
2026-03-23test: Update comment for fs_helper.setup_image()Simon Glass
This function actually allows creating two partitions now, so update its comment to match that. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-23test: fs_helper: Add a quiet flag to mk_fs()Simon Glass
In many cases callers only want to see warnings and errors from the filesystem-creation tools, not their normal output. Add a quiet parameter to mk_fs() that suppresses the output of mkfs and switches mcopy from verbose to quiet mode. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-23test: fs_helper: Allow passing the image filenameSimon Glass
The mk_fs() function always generates its own image filename from the prefix and fs_type. Some callers need to specify a custom leaf name while still keeping the image under the persistent-data directory. Add an fs_img parameter that accepts a leaf filename. When provided, it is joined with persistent_data_dir instead of the default name. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-22tests: FIT: Add "clone" image attack image testTom Rini
Related to the problem resolved with commit 2092322b31cc ("boot: Add fit_config_get_hash_list() to build signed node list"), add a testcase for the problem as well. Reported-by: Apple Security Engineering and Architecture (SEAR) Signed-off-by: Tom Rini <[email protected]>
2026-03-14test/py: add ECPT testsVincent Stehlé
Add a couple of EFI Conformance Profiles Table (ECPT) tests, which exercise the "efidebug ecpt" command. Signed-off-by: Vincent Stehlé <[email protected]> Cc: Tom Rini <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Ilias Apalodimas <[email protected]>
2026-03-09Merge tag 'v2026.04-rc4' into nextTom Rini
Prepare v2026.04-rc4
2026-03-09boot: Add fit_config_get_hash_list() to build signed node listSimon Glass
The hashed-nodes property in a FIT signature node lists which FDT paths are included in the signature hash. It is intended as a hint so should not be used for verification. Add a function to build the node list from scratch by iterating the configuration's image references. Skip properties known not to be image references. For each image, collect the path plus all hash and cipher subnodes. Use the new function in fit_config_check_sig() instead of reading 'hashed-nodes'. Update the test_vboot kernel@ test case: fit_check_sign now catches the attack at signature-verification time (the @-suffixed node is hashed instead of the real one, causing a mismatch) rather than at fit_check_format() time. Update the docs to cover this. The FIT spec can be updated separately. Signed-off-by: Simon Glass <[email protected]> Closes: https://lore.kernel.org/u-boot/[email protected]/ Reported-by: Apple Security Engineering and Architecture (SEAR) Tested-by: Tom Rini <[email protected]>
2026-03-06test: boot: Add test for bootmeth_raucMartin Schwan
Add a simple unit test for testing the RAUC bootmethod. Provide only the very basic tests for now, running a scan and list, to verify correct detection of the RAUC bootmethod. More advanced boot tests of this bootmethod can be added in a separate patch. This requires another mmc image (mmc10) to contain the following partitions: 1. boot A: contains a dummy boot.scr 2. root A: contains an empty root filesystem 3. boot B: contains a dummy boot.scr 4. root B: contains an empty root filesystem The bootmeth_rauc scans all four partitions for existence and expects a boot script in each boot partition. Also add BOOTMETH_RAUC as a dependency on sandbox so that we can test this with: $ ./test/py/test.py -B sandbox --build -k test_ut # build the mmc10.img $ ./test/py/test.py -B sandbox --build -k bootflow_rauc Signed-off-by: Martin Schwan <[email protected]> Reviewed-by: Simon Glass <[email protected]> [trini: mmc9 is now in use, switch to mmc10] Signed-off-by: Tom Rini <[email protected]>
2026-02-23Merge tag 'v2026.04-rc3' into nextTom Rini
Prepare v2026.04-rc3
2026-02-18test: cmd: Add test for zip/unzip/gzwrite commandsMarek Vasut
Add simple test for zip/unzip/gzwrite commands. The test works as follows. First, create three buffers with a bit of space between each of them, fill them with random data, then compress data in buffer 1 into buffer 2, decompress data in buffer 2 either directly into buffer 3 or into MMC 1 and then read them back into buffer 3, and finally compare buffer 1 and buffer 3, they have to be identical. The buffers are filled with random data to detect out of bounds writes. Test for various sizes, both small and large and unaligned. The test uses ut_assert_skip_to_line() to skip over gzwrite progress bar. Since the progress bar updates fill up the console record buffer, increase the size of it to compensate. Reviewed-by: Mattijs Korpershoek <[email protected]> Tested-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
2026-02-17treewide: Clean up DECLARE_GLOBAL_DATA_PTR usagePeng Fan
Remove DECLARE_GLOBAL_DATA_PTR from files where gd is not used, and drop the unnecessary inclusion of asm/global_data.h. Headers should be included directly by the files that need them, rather than indirectly via global_data.h. Reviewed-by: Patrice Chotard <[email protected]> #STMicroelectronics boards and STM32MP1 ram test driver Tested-by: Anshul Dalal <[email protected]> #TI boards Acked-by: Yao Zi <[email protected]> #TH1520 Signed-off-by: Peng Fan <[email protected]>
2026-02-17test: log_filter: Include vsprintf.hPeng Fan
snprintf is used, need to include vsprintf.h. Otherwise there will be build error after asm/global_data.h is removed. Signed-off-by: Peng Fan <[email protected]>