summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
5 dayscmd: Introduce CMD_HELPMichal Simek
Add option to disable help command in size constrained systems to save some space. There is also no need to have ifdefs around CMDLINE because all commands depends on it. And also mark cmd_help dependency in test_help.py. Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/c17f825fb8a74e1d1912a3fd09a9a880c84a8bfd.1751286059.git.michal.simek@amd.com
2025-06-27test/py/test_mmc: wrap multi-argument printf-style stringsBryan Brattlof
Newer versions of python will emit a TypeError about not enough arguments for a format string: FAILED ub/test/py/tests/test_mmc.py::test_mmc_dev - TypeError: not enough arguments for format string FAILED ub/test/py/tests/test_mmc.py::test_mmcinfo - TypeError: not enough arguments for format string FAILED ub/test/py/tests/test_mmc.py::test_mmc_info - TypeError: not enough arguments for format string FAILED ub/test/py/tests/test_mmc.py::test_mmc_rescan - TypeError: not enough arguments for format string FAILED ub/test/py/tests/test_mmc.py::test_mmc_part - TypeError: not enough arguments for format string Add parentheses around all multi argument format strings so all arguments will be passed to the format string Signed-off-by: Bryan Brattlof <bb@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2025-06-26Merge patch series "sandbox: enable CONFIG_CMD_BOOTEFI_SELFTEST by default"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: The sandbox is used for a lot of generic development, we should run the UEFI tests there, too. The TPM emulation on the sandbox is incomplete. Disable the TCG test on sandbox. Link: https://lore.kernel.org/r/20250617061945.9266-1-heinrich.schuchardt@canonical.com
2025-06-26test: disable TCG test on sandboxHeinrich Schuchardt
The TPM emulation on the sandbox is incomplete. Even basic tcg2 functionality like get_capability() fails: lib/efi_selftest/efi_selftest_tcg2.c(886): ERROR: get_manufacturer_id buffer too small failed Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
2025-06-26Merge patch series "mkimage: validate image references in FIT configurations"Tom Rini
Aristo Chen <jj251510319013@gmail.com> says: This series introduces a validation step in mkimage to ensure that all image names referenced under the /configurations node of a FIT source (ITS) are actually defined under the /images node. ### Motivation When using mkimage to build FIT images, it's easy to mistakenly reference nonexistent image nodes in configurations (e.g., referencing a missing `fdt` or `firmware` node). Such issues are often not caught until runtime in U-Boot. This series aims to catch these errors early during FIT image creation by validating the configuration references in mkimage itself. Link: https://lore.kernel.org/r/20250610074121.8308-1-aristo.chen@canonical.com
2025-06-26test: py: add mkimage test for undefined image references in FIT configsAristo Chen
Add a test case to verify that mkimage correctly rejects a FIT source that references a non-existent image from a configuration node. This test introduces a minimal ITS that defines a valid kernel image but references a missing "fdt" image under the /configurations section. The test asserts that mkimage fails with a clear error message, as introduced in the new validation logic. This helps ensure the validation logic behaves correctly and prevents regressions in future FIT enhancements. Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
2025-06-23Merge tag 'v2025.07-rc5' into nextTom Rini
Prepare v2025.07-rc5 With this merge, tighten up the LTO_FLAGS removal we added to not trigger on ARMv7 (which is Thumb-2 and should be fine).
2025-06-17test/py: tests: gpt: add test_gpt_write_part_typePatrick Delaunay
Add sandbox test on gpt command with partition type for known type. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-16Merge tag 'u-boot-dfu-next-20250616' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dfu into next u-boot-dfu-next-20250616 CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/26704 Usb gadget: - Fix ti_musb driver in gadget mode (with DM_USB_GADGET) DFU: - mmc/scsi backends when using 10 or more partitions
2025-06-12test/py: Correct handling of exceptionsSimon Glass
If an Unexpected exception is thrown in a test, an undefined variable error is reported. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 85d7dae377a ("test: Detect dead connections") Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-06-12test/py: Use the correct fixture name in exception handlerSimon Glass
If a BootFail exception is thrown in a test, it is not handled correctly. Use the correct fixture variable 'ubman_fix' to resolve this. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: d9ed4b75add ("test/py: Drop u_boot_ prefix on test files") Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-06-10test: tpm: Skip failing tests on coralSimon Glass
These tests have been failing for some months. Disable them so that a CI run can pass on coral. Further work will be needed to see how to make them pass. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-06-10tpm: Drop unwanted special cases for sandboxSimon Glass
These don't seem to be needed. Add a few notes about what to do next. Also mention parallel tests in at the top of thefile. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-06-10tpm: Convert sandbox-focussed tests to CSimon Glass
Some of the Python tests are a pain because they don't reset the TPM state before each test. Driver model tests do this, so convert the tests to C. This means that these tests won't run on real hardware, but we have tests which do TPM init, so there is still enough coverage. Rename and update the Python tpm_init test to use 'tpm autostart', since this fully initializes the TPM and performs the self tests. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-05-18test: allow testing with NET_LWIP=yHeinrich Schuchardt
Adjust network tests to run with CONFIG_NET_LWIP=y. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-05-18test: allow multiple config options in buildconfigspecHeinrich Schuchardt
In some cases we have alternative configuration options that supply the same functionality, e.g CONFIG_NET and CONFIG_NET_LWIP. Allow to specify all of them as arguments for buildconfigspec() and execute the text if any of these is fulfilled, e.g. @pytest.mark.buildconfigspec('net', 'net_lwip') Update the documentation. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11test/py/test_efi_fit: test fdt and initrdAdriano Cordova
Add tests to check initrd and dtb loading Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
2025-05-11doc: pytest: Document the test_button testTom Rini
Add this test to the documentation. No changes to the test itself were required. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bootmenu testTom Rini
Add this test to the documentation. There was already a function comment that included the argument, so convert it to the right style to be rendered correctly in output. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bind testTom Rini
Add this test to the documentation. None of the functions had comments, so attempt to explain what each does. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_efi_loader testTom Rini
Add this test to the documentation. We need to add a code-block annotation to the example and indent it correctly. We also need to document the do_test_efi_helloworld_net function and that in turn means changing the documentation to test_efi_helloworld_net_http and test_efi_helloworld_net_tftp to reflect what is and isn't done in those functions themselves now. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_bootstage testTom Rini
Add this test to the documentation. We need to move the import to follow the main comment so that it renders correctly, and add a code-block annotation to the example and indent it correctly. Next, neither of the functions had comments themselves, so document them now. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_net testTom Rini
Add this test to the documentation. While the diff appears large at first, the only changes within the test are to move the imports to follow the pydoc comment and then to code-block and indent the example configuration. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11test: test_net_boot: Add more commentsTom Rini
Some of the functions were missing pydoc comments. Add them so they will be included in the documentation. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Document the test_net_boot testTom Rini
Add the test_net_boot.py test to the generated documentation. While most of this was already commented correctly for inclusion the biggest problem was examples of code without a code-block notation. This in turn broke parsing. Add the missing notations. We also must have the comment prior to any import lines or it will not be seen as a comment on the overall file and thus not included. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-05-11doc: pytest: Framework for documenting tests and document test_000_versionTom Rini
In order to easily document pytests, we need to include the autodoc extension. We also need to make sure that for building the docs, CI includes pytest and that we have PYTHONPATH configured such that it will find all of the tests and related files. Finally, we need to have our comments in the test file by in proper pydoc format in order to be included in the output. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-04-24test/py: spi: Prevent to overwrite the reserved memoryLove Kumar
Update SPI negative tests to prevent SF command from overwriting the reserved memory area. Signed-off-by: Love Kumar <love.kumar@amd.com>
2025-04-21Merge patch series "fs: exfat: Flush node before put in read() callback"Tom Rini
This series from Marek Vasut <marex@denx.de> includes a number of fixes to the exFAT filesystem support that he recently added. Link: https://lore.kernel.org/r/20250413085740.5953-1-marex@denx.de
2025-04-21test_fs: Test 'mv' command on exfat and fs_genericMarek Vasut
Enable tests for the generic FS interface 'mv' command against both exfat and fs_generic. Signed-off-by: Marek Vasut <marex@denx.de>
2025-04-21test_fs: Add test -e testMarek Vasut
Add test for the 'test -e' command to check for existence of files. This exercises struct fstype_info .exists callback. Signed-off-by: Marek Vasut <marex@denx.de>
2025-04-14Merge patch series "Static initcalls"Tom Rini
Jerome Forissier <jerome.forissier@linaro.org> says: This series replaces the dynamic initcalls (with function pointers) with static calls, and gets rid of initcall_run_list(), init_sequence_f, init_sequence_f_r and init_sequence_r. This makes the code simpler and the binary slighlty smaller: -2281 bytes/-0.21 % with LTO enabled and -510 bytes/-0.05 % with LTO disabled (xilinx_zynqmp_kria_defconfig). Execution time doesn't seem to change noticeably. There is no impact on the SPL. The inline assembly fixes, although they look unrelated, are triggered on some platforms with LTO enabled. For example: kirkwood_defconfig. CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/25514 Link: https://lore.kernel.org/r/20250404135038.2134570-1-jerome.forissier@linaro.org
2025-04-14common: board: make initcalls staticJerome Forissier
Change board_init_f(), board_init_f_r() and board_init_r() to make static calls instead of iterating over the init_sequence_f, init_sequence_f_r and init_sequence_r arrays, respectively. This makes the code a simpler (and even more so when initcall_run_list() is later removed) and it reduces the binary size as well. Tested with xilinx_zynqmp_kria_defconfig; bloat-o-meter results: - With LTO add/remove: 106/196 grow/shrink: 10/28 up/down: 31548/-33829 (-2281) Total: Before=1070471, After=1068190, chg -0.21% - Without LTO add/remove: 0/54 grow/shrink: 3/0 up/down: 2322/-2832 (-510) Total: Before=1121723, After=1121213, chg -0.05% Execution time does not change in a noticeable way. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2025-04-10test/py: memtest: Fix test for non-trivial parametersAndrew Goodbody
When using non-trivial values for parameters for this test it will cause a spurious failure as the test passes a decimal value to the mtest command which will interpret it as hexadecimal and result in failure as below. test/py/tests/test_memtest.py:66: in test_memtest_ddr assert expected_response in response E AssertionError: assert 'Tested 16 iteration(s) with 0 errors.' in 'Refusing to do empty test\r\nmtest - simple RAM read/write test\r\n\r\nUsage:\r\nmtest [start [end [pattern [iterations]]]]' ----------------------------- Captured stdout call ----------------------------- U-Boot> mtest 134217728 0x8001000 90 0x10 Refusing to do empty test mtest - simple RAM read/write test Usage: mtest [start [end [pattern [iterations]]]] The fix is to ensure that all the parameters to the mtest command are passed as hexadecimal values. Fixes: 22efc1cf276c ("test/py: memtest: Add tests for mtest command") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Love Kumar <love.kumar@amd.com>
2025-04-08Merge patch series "Improve pytest runtime"Tom Rini
Tom Rini <trini@konsulko.com> says: One thing that Simon Glass has noted is that our pytest run time keeps getting longer. Looking at: https://source.denx.de/u-boot/u-boot/-/pipelines/25011/test_report?job_name=sandbox%20test.py%3A%20%5Bfast%20amd64%5D we can see that some of the longest running tests are a little puzzling. It turns out that we have two ways of making filesystem images without requiring root access and one of them is significantly slower than the other. This series changes us from using virt-make-fs to only using the mk_fs helper that currently resides in test_ut.py which uses standard userspace tools. The final result can be seen at: https://source.denx.de/u-boot/u-boot/-/pipelines/25015/test_report?job_name=sandbox%20test.py%3A%20%5Bfast%20amd64%5D and the tests changed here now run much quicker. Link: https://lore.kernel.org/r/20250320140030.2052434-1-trini@konsulko.com
2025-04-08test/py: Rework test_efi_secboot to not use virt-make-fsTom Rini
The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Rework test_efi_capsule to not use virt-make-fsTom Rini
FIXME: Reword more The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. The main change here is that our mount point directory has changed from "test_efi_capsule" to "scratch" and so we need to update other functions too. As the disk image that we get created doesn't have a GPT, invoke sgdisk to do a conversion first. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Rework test_eficonfig to not use virt-make-fsTom Rini
The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. As this test already had a number of internal functions, add a prepare_image function to do this part of the test. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Rework test_efi_bootmgr to not use virt-make-fsTom Rini
The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Fix a problem with setup_imageTom Rini
While we can be passed an image size to use, we always called qemu-img with 20M as the size. Fix this by using the size parameter. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py/tests: Move "setup_image" from test_ut.py to fs_helper.pyTom Rini
The generic function in test_ut.py to create a disk image with partition table can be useful outside of test_ut.py so move it to be available more clearly. To make this a bit more easily used library function, make use of check_call directly rather than calling things though u_boot_utils. In turn, to more easily handle stdin here, use the shell "printf" utility to pass sfdisk the specification to create as we do not have an actual file descriptor to use here. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Rework test_xxd to not use virt-make-fsTom Rini
The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08test/py: Rework test_cat to not use virt-make-fsTom Rini
The problem with using "virt-make-fs" to make a filesystem image is that it is extremely slow. Switch to using the fs_helper functions we have instead from the filesystem tests as these can add files to images and are significantly faster and still do not require root access. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-03test: Add a test for booting Ubuntu 24.04Simon Glass
Now that U-Boot can boot this quickly, using kvm, add a test that the installer starts up correctly. Use the qemu-x86_64 board in the SJG lab. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03test/py: Allow tests to be filtered by roleSimon Glass
Some test can only be run by a particular board in a lab, e.g. because they are loaded with an OS image used by the test. Add a way to specify this in tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03test/py: Add a helper to send charactersSimon Glass
The existing run_command() method is not great for sending things other than U-Boot commands. Add a helper for sending arbitrary strings as well as control characters. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-03test/py: Correct sizing of created disksSimon Glass
At present the disks end up being 1MB shorter than they should be, since dd truncates by default. Move the code into a function and update it to avoid truncation. This resolves various warnings when running sandbox tests, of the form: mmc_bread() MMC: block number 0x9801 exceeds max(0x9800) caused by the FAT partition being scanning. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-02Merge patch series "fs: exfat: Add exfat port based on exfat-fuse"Tom Rini
Marek Vasut <marex@denx.de> says: Import exfat-fuse libexfat, add U-Boot filesystem layer porting glue code and wire exfat support into generic filesystem support code. This adds exfat support to U-Boot. Fill in generic filesystem interface for mkdir and rm commands. Make filesystem tests test the generic interface as well as exfat, to make sure this code does not fall apart. Link: https://github.com/relan/exfat/commits/0b41c6d3560d ("CI: bump FreeBSD to 13.1.") Link: https://lore.kernel.org/r/20250317031418.223019-1-marex@denx.de
2025-04-02test_fs: Add exfat testsMarek Vasut
Add tests for the exfat filesystem. These tests are largely an extension of the FS_GENERIC tests with the following notable exceptions. The filesystem image for exfat tests is generated using combination of exfatprogs mkfs.exfat and python fattools. The fattols are capable of generating exfat filesystem images too, but this is not used, the fattools are only used as a replacement for dosfstools 'mcopy' and 'mdir', which are used to insert files and directories into existing fatfs images and list existing fatfs images respectively, without the need for superuser access to mount such images. The exfat filesystem has no filesystem specific command, there is only the generic filesystem command interface, therefore check_ubconfig() has to special case exfat and skip check for CONFIG_CMD_EXFAT and instead check for CONFIG_FS_EXFAT. Signed-off-by: Marek Vasut <marex@denx.de>
2025-04-02test_fs: Allow testing FS_GENERICMarek Vasut
The generic filesystem interface was so far untested. The interface is similar to the FS specific interfaces with FS specific prefixes, like ext4ls, fatmkdir, ... but it does not have any prefixes, i.e. it provides plain ls, mkdir, ... commands. Extend the test parameters to include 'fs_cmd_prefix' and optionally 'fs_cmd_write' parameters. The 'fs_cmd_prefix' allow specifying the filesystem specific command prefix, like 'ext4' in 'ext4ls'. The 'fs_cmd_write' allows selecting between 'write'/'save' command name for storing files into the filesystem, see last paragraph. Introduce new 'fs_generic' fs_type which is used to parametrize existing tests and run them without any prefixes if detected, thus testing the generic filesystem interface. Use the fatfs as the backing store for the generic FS tests. The check_ubconfig needs to be slightly adjusted to avoid test for CMD_FS_GENERIC_WRITE which does not exist separately from CMD_FS_GENERIC. The CMD_FS_GENERIC does not provide generic 'write' command, instead the generic equivalent command is called 'save' . Add simple ternary oeprator to use 'save' command for CMD_FS_GENERIC tests and '..write' commands for filesystem specific tests. Enable generic filesystem tests for basic/extended/mkdir/unlink tests. Signed-off-by: Marek Vasut <marex@denx.de>
2025-03-30test: use truncate in mk_fs()Heinrich Schuchardt
While the dd command actually writes to the block device the truncate command only updates the metadata (at least on ext4). This is faster and reduces wear on the block device. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>