summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)AuthorFilesLines
2022-12-06event: Re-add file paths to the testsTom Rini1-3/+3
Now that we are enforcing dwarf-4 to be used we will have the full file paths present. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-22eficonfig: refactor file selection handlingMasahisa Kojima1-0/+1
eficonfig_select_file_handler() is commonly used to select the file. eficonfig_display_select_file_option() adds an additional menu to clear the selected file. eficonfig_display_select_file_option() is not always necessary for the file selection process, so it must be outside of eficonfig_select_file_handler(). This commit also renames the following functions to avoid confusion. eficonfig_select_file_handler() -> eficonfig_process_select_file() eficonfig_select_file() -> eficonfig_show_file_selection() eficonfig_display_select_file_option() -> eficonfig_process_show_file_option() Finally, test_eficonfig.py need to be updated to get aligned with the above modification. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-11-08dm: Add tests for the sandbox host driverSimon Glass2-2/+10
Add some unit tests for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-08dm: sandbox: Switch over to using the new host uclassSimon Glass1-0/+3
Update the sandbox implementation to use UCLASS_HOST and adjust all the pieces to continue to work: - Update the 'host' command to use the new API - Replace various uses of UCLASS_ROOT with UCLASS_HOST - Disable test_eficonfig since it doesn't work (this should have a unit test to allow this to be debugged) - Update the blk test to use the new API - Drop the old header file Unfortunately it does not seem to be possible to split this change up further. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-08test: Correct pylint warnings in fs_helperSimon Glass1-13/+25
Tidy this up so that pylint is happy. Use hex for the 1MB size and make sure it is not a floating-point value. Add a little main program to allow the code to be tried out, since at present is only called from a long-running test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-08test: Split out mk_fs function into a helperSimon Glass2-52/+60
This function is useful for other tests. Move it into common code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-06test/py: efi_secboot: Remove unnecessary cert-to-efi-hash-list optionMasahisa Kojima1-4/+4
'cert-to-efi-hash-list -t 0' does not work as expected, it produces indeterminate timestamp. $ cert-to-efi-hash-list -t 0 -s 256 db.crt dbx_hash.crl TimeOfRevocation is 0-113-0 00:00:255 If we need the CRL revoked for all the time, just don't specify '-t' option. $ cert-to-efi-hash-list -s 256 db.crt dbx_hash.crl TimeOfRevocation is 0-0-0 00:00:00 Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-31test: dm: Add test cases for FWU Metadata uclassSughosh Ganu2-2/+0
Add test cases for accessing the FWU Metadata on the sandbox platform. The sandbox platform also uses the metadata access driver for GPT partitioned block devices. The FWU feature will be tested on the sandbox64 variant with a raw capsule. Remove the FIT capsule testing from sandbox64 defconfig -- the FIT capsule test will be run on the sandbox_flattree variant. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-31vbe: Add a test for the VBE flow into U-Boot properSimon Glass1-0/+38
Add a test which checks that VBE boots correctly from TPL through to U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31vbe: Use a manual testSimon Glass1-5/+2
Use a manual test for the VBE test, so we can make the pytest and the C unit test work together properly. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31vbe: Add Kconfig options for VPLSimon Glass1-0/+1
Enable the various features needed in VPL, by adding Kconfig options. Update the defconfig for sandbox_vpl so that the build for each phase includes what is needed. Drop LZMA for now and make sure partition support is omitted in SPL, since it is not needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31vbe: Move OS implementation into a separate fileSimon Glass1-1/+0
Move this into its own file so it can be built only by U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31vbe: Rename vbe_fixup to vbe_requestSimon Glass1-1/+1
The vbe_fixup file handles device tree fixups, but these are called OS requests in VBE. Rename the file to reflect its wider purpose. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31test: Support tests which can only be run manuallySimon Glass1-1/+7
At present we normally write tests either in Python or in C. But most Python tests end up doing a lot of checks which would be better done in C. Checks done in C are orders of magnitude faster and it is possible to get full access to U-Boot's internal workings, rather than just relying on the command line. The model is to have a Python test set up some things and then use C code (in a unit test) to check that they were done correctly. But we don't want those checks to happen as part of normal test running, since each C unit tests is dependent on the associate Python tests, so cannot run without it. To acheive this, add a new UT_TESTF_MANUAL flag to use with the C 'check' tests, so that they can be skipped by default when the 'ut' command is used. Require that tests have a name ending with '_norun', so that pytest knows to skip them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29event: Drop the path when checking event-list filenamesSimon Glass1-3/+3
This path does not seem to be present in clang-14 for some reason. Relax the regular expression so that the test works, at least for non-LTO. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-26test: Move to a working version of setuptoolsSimon Glass1-0/+1
The version used on Ubuntu 2022.04 produces a number of warnings: /usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release Same with: 0.1.43ubuntu1 11.4.1ubuntu1 2.22.1ubuntu1 1.1build1 According to [1] this is a bug in setuptools. Employ the workaround for now. [1] https://askubuntu.com/questions/1406952/what-is-the-meaning-of-this- pkgresourcesdeprecationwarning-warning-from-pipenv Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-18vbe: Add a test for VBE device tree fixupsSimon Glass2-1/+127
When a FIT includes some OS requests, U-Boot should process these and add the requested info to corresponding subnodes of the /chosen node. Add a pytest for this, which sets up the FIT, runs bootm and then uses a C unit test to check that everything looks OK. The test needs to run on sandbox_flattree since we don't support device tree fixups on sandbox (live tree) yet. So enable BOOTMETH_VBE and disable bootflow_system(), since EFI is not supported on sandbox_flattree. Add a link to the initial documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-18vbe: Add fixups for a basic set of OS requestsSimon Glass1-0/+1
As a starting point, add support for providing random data, if requested by the OS. Also add ASLR, as a placeholder for now. Signed-off-by: Simon Glass <sjg@chromium.org> (fixed up to use uclass_first_device_err() instead)
2022-10-18test: Move common FIT code into a separate fit_util fileSimon Glass2-70/+99
To avoid duplicating code, create a new fit_util module which provides various utility functions for FIT. Move this code out from the existing test_fit.py and refactor it with addition parameters. Fix up pylint warnings in the conversion. This involves no functional change. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-11cmd: xxd: add new commandRoger Knecht2-0/+58
Add xxd command to print file content as hexdump to standard out Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Roger Knecht <rknecht@pm.me>
2022-10-11cmd: cat: add new commandRoger Knecht2-0/+55
Add cat command to print file content to standard out Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Roger Knecht <rknecht@pm.me>
2022-10-06test: fix some pylint errors in test_efi_secbootHeinrich Schuchardt1-9/+3
* Remove unused import * Provide module docstring Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-25sandbox: Add a test for SCSISimon Glass1-0/+9
Add a simple uclass test for SCSI. It reads the partition table from a disk image and checks that it looks correct. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14test: unit test for eficonfigMasahisa Kojima2-0/+394
Provide a unit test for the eficonfig command. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-13test/py: Support --build when running tests in parallelSimon Glass2-4/+27
At present when -n is used, all workers try to build U-Boot at once. Add a lock to ensure that only one of them builds, with the others using the build that is produced. The lock file is removed on startup. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test/py: Move U-Boot building into a functionSimon Glass1-24/+36
This is a lot of code in a function that is too long. Split out the building code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Make test_gpio_read() independentSimon Glass1-0/+1
This assumes that the GPIO starts as 0 but it does not if test_gpio_input() ran first and test_gpio_exit_statuses() was skipped. This can happen when running tests in parallel. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Mark test_gpt tests as slowSimon Glass1-0/+3
Mark all the tests in this file as slow, since they take a while. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Mark all but the first vboot test as slowSimon Glass1-1/+5
When doing a quick check we don't need to run all the vboot tests. Just run the first one, which is enough to catch most problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Make test_efi_bootmgr() single-threadedSimon Glass1-0/+1
This test seems to fail when run in parallel. Mark it single-threaded to avoid any problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Make test_sqfs_ls() single-threadedSimon Glass1-0/+1
This test seems to interfere with the other test in this file. Mark it single-threaded to avoid any problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Update FIT tests to run in parallelSimon Glass2-2/+7
Use a different temporary dir for each test, to allow them to run in parallel. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Make test_bind_unbind_with_uclass() single-threadedSimon Glass1-0/+1
This test seems to rely on the other test in this file. Mark it single-threaded to avoid any problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test/py: Allow tests to be marked single-threaded onlySimon Glass2-0/+18
Add a new 'singlethread' marker to allow tests to be skipped when running in parallel. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13test: Fix test_pinmux to run in parallelSimon Glass1-0/+1
At present test_pinmux_status() assumes that test_pinmux_dev() has run beforehand. Drop this assumption so we can run the tests in parallel. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-22CI: Move to Ubuntu 2022.04 "Jammy" for CI baseTom Rini1-2/+2
- We now have a new enough sbsigntools in the distro, stop building. - Use the 20220801 tag for Jammy. - Move to pygit2 1.9.2 (current version) as the old one doesn't build on "Jammy". - Add the working directory to the list of safe directories for git. - Move to pytest 6.2.5 to address other issues. - This move exposed a number of minor issues in the existing scripts we used within CI to perform the jobs themselves. The most notable changes here involve using 'set +e / set -e' to enforce when we should or should not make non-zero buildman status be a fatal error. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-12vbe: Support VBE simpleSimon Glass1-1/+1
Add support for VBE simple, which permits firmware update of a single image stored in MMC or another block device. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12event: Add an event for device tree fixupsSimon Glass1-0/+1
At present there is a confusing array of functions that handle the device tree fix-ups needed for booting an OS. We should be able to switch to using events to clean this up. As a first step, create a new event type and call it from the standard place. Note that this event uses the ofnode interface only, since this can support live tree which is more efficient when making lots of updates. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-10test: Add some tests for kconfig.hSimon Glass1-0/+39
The macros in this file are a little confusing and we currently have no tests to check that they work as expected. Add some tests which check the macros in C code. Add a few tests which check that the build errors are generated correctly too, using buildman's -a option. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-07-26test/py: Run simple dm commands without checkingMichal Simek1-0/+8
Just to make sure that dm commands can operate. This was the problem on Microblaze in past without fixing manual relocation. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/e6c4b8b44445c16cee84436627642ccc9886f507.1657191580.git.michal.simek@amd.com
2022-07-26py: tests: Bind should run only on sandboxMichal Simek1-1/+2
Disable test to run on any other platform than sandbox. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/786bfdfda7dee4494e39c3fff699970ecd623116.1657191142.git.michal.simek@amd.com
2022-07-18efi: test/py: repair authenticated capsules testsVincent Stehlé2-0/+5
The UEFI console initialisation has been modified by commit 68edbed454b8 ("efi_loader: initialize console size late"). A corresponding workaround is now necessary for the automated tests, as added to some of the tests already by commit e05bd68ed5fc ("test: work around for EFI terminal size probing"). Add the same workaround to the UEFI authenticated capsules tests to repair them. This can be tested with sandbox_defconfig, sandbox64_defconfig or sandbox_flattree_defconfig, plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-07-11Merge branch 'next'Tom Rini2-170/+176
2022-07-08requirements: Move to atomicwrites==1.4.1Tom Rini1-1/+1
As explained upstream: https://github.com/untitaker/python-atomicwrites/issues/61 there is no longer a 1.3.0 version but the API is unchanged. Move to 1.4.1. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-08requirements: Move to atomicwrites==1.4.1Tom Rini1-1/+1
As explained upstream: https://github.com/untitaker/python-atomicwrites/issues/61 there is no longer a 1.3.0 version but the API is unchanged. Move to 1.4.1. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-05test/py: efi_secboot: add a test for a forged signed imageAKASHI Takahiro3-0/+43
In this test case, a image binary, helloworld.efi.signed, is willfully modified to print a corrupted message while the signature itself is unchanged. This binary must be rejected under secure boot mode. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-06-28test: fix some pylint errors in test_bind.pyHeinrich Schuchardt1-170/+175
* Use spaces not tabs * Limit lines to 100 spaces * Remove an unused import * Sort imports correctly * Add a module description Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-23test/py: test_stackprotector: Disable for ASANAndrew Scull1-0/+1
The stack protector test intentionally overflows a buffer in order to corrupt the stack canary so that it can test that the corruption is detected as expected. However, this is incompatible with ASAN, which detects the buffer overflow and interrupts the test, so disable the test for such configurations. Signed-off-by: Andrew Scull <ascull@google.com>
2022-06-19test: work around for EFI terminal size probingHeinrich Schuchardt2-0/+3
When the UEFI sub-system is initialized it sends an escape sequence to the serial console to determine the terminal size. This stops the run_command_list() function of the console emulation from recognizing the U-Boot command line prompt. Add a 'print -e' command as first command in the command list to work around this issue. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-04efi: test/py: authenticate fit capsulesVincent Stehlé3-6/+280
Add support for the authentication of UEFI capsules containing FIT images. The authentication code is moved out of the function handling raw images into a new function efi_firmware_capsule_authenticate(). The special case for the FMP header coming from edk2 tools is preserved. There is no functional change for capsules containing raw images. The python test for signed capsules with raw images is renamed with no functional change and a new test is added for signed capsules containing FIT images. This can be tested with sandbox64_defconfig or sandbox_flattree_defconfig, plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>