aboutsummaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
2023-06-23test: efi_capsule: Test capsule generation from config fileSughosh Ganu
Support has been added to generate capsules through parameters specified in the config file. To bring this under the testing ambit, make changes in the EFI capsule test logic to generate the capsule files by parsing the config file, when the path to the config file is specified. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2023-06-23test: py: Change capsule authenticate test flowSughosh Ganu
Currently, the keys and the EFI Signature List(ESL) file used for capsule authentication are being generated after the u-boot image has been built. The ESL file is then manually embedded into the platform's DTB for capsule authentication. This flow has been changed through an earlier commit, which embeds the ESL file into the platform's dtb(s) as part of the u-boot build. This requires generating the keys and the ESL file prior to invoking the u-boot build. Bring about the same sequence of generating these files prior to invoking the u-boot build while testing. For testing the EFI capsule functionality through manual invocation of pytest, changes have been made to the configuration to generate the openssl keys and the ESL file prior to u-boot build. For the CI run, the setting up of the test environment is done through the yml files, and involves building u-boot through buildman, followed by running the tests. Make changes in the yml files to generate the keys and ESL file prior to building u-boot. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2023-06-16test: correct architecture in EFI FIT testHeinrich Schuchardt
On arm64 the its we use to generate the test FIT image has arch = "arm"; We should use "arm64" here which is mapped to IH_ARCH_ARM64 via uimage_arch[]. Fixes: 8391f955494e ("test/py: Create a test for launching UEFI binaries from FIT images") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-05-05test/py: IPv6 network discovery testEhsan Mohandesi
Test the IPv6 network discovery feature if indicated by boardenv file. Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
2023-05-05net: dhcp6: Add a sandbox test for dhcp6Sean Edmond
Requires proper environment with DHCP6 server provisioned. Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-04Merge branch '2023-05-03-assorted-updates-and-fixes'Tom Rini
- Various typo fixes, pass -Werror to host tools builds, bdi cleanups, fix hush and local variables, a FSL PCI fix and correct some python in one of the tests.
2023-05-04efi: Rename the base efi self-testSimon Glass
This function uses the same base name as all the others in this file, so it is not easy to run just that one test. Add a _base suffix so that it can be run on its own. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-05-04test: fix pydoc issues for EFI testsHeinrich Schuchardt
Fix issues reported by pydocstyle. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-05-03test: hush_if_test: Add hush variable testStefan Herbrechtsmeier
Add a test for the hush shell variable assignment and clear. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-25pytest: Use --lazy with umountTom Rini
Sometimes when doing tests on real hardware we sometimes run in to the case where some of these mounts haven't been fully flushed. Using the --lazy option with umount will allow us to continue while letting the OS handle flushing the data out still. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-21test: fix launch_efi()Heinrich Schuchardt
We cannot use old_dtb in the finally block if it has not been assigned before the try block. test/py/tests/test_efi_fit.py:458:30: E0601: Using variable 'old_dtb' before assignment (used-before-assignment) Fixes: 8391f955494e ("test/py: Create a test for launching UEFI binaries from FIT images") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-04-21test: fix pylint warning for capsule testsHeinrich Schuchardt
Fix pylint warnings like: * Class inherits from object * Missing module description * Missing class description * First line of comment blank * Superfluous imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-04-04test/py: android: extend abootimg testSafae Ouajih
test_abootimg is extended to include the testing of boot images version 4. For this, boot.img and vendor_boot.img have been generated using mkbootimg tool with setting the header version to 4. This tests: - Getting the header version using abootimg - Extracting the load address of the dtb - Extracting the dtb start address in RAM Running test: $ ./test/py/test.py --bd sandbox --build -k test_abootimg Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04pytest: Update requirements to match sphinx versionsTom Rini
In order to better make use of pip caches, and also for better overall consistency, we should use the same versions of packages in each of our python requirements files. Update pytest to use the newer versions of packages we use in sphinx builds. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-03vbe: Use the correct image filename in the testSimon Glass
At present this inadvertently relies on having a symlink to the correct file from the current directory. Use the correct path to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-02test_vboot.py: include test of fdt_add_pubkey toolRoman Kopytin
Add test_fdt_add_pubkey test which provides simple functionality test which contains such steps: create DTB and FIT files add keys with fdt_add_pubkey to DTB sign FIT image check with fit_check_sign that keys properly added to DTB file Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com> Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com> Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-03-30test: fs: Check fat short file nameStefan Herbrechtsmeier
Ensure that a freshly written fat file with a lower case filename which fits into the upper case 8.3 short filename is not mangeled with a tilde and number. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2023-03-08test: Add concurrencytest to the requirementsSimon Glass
This allows tests to run in parallel and speeds up some tests markedly, particularly with binman. Add it to the requirements. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-27Merge tag 'v2023.04-rc3' into nextTom Rini
Prepare v2023.04-rc3
2023-02-23trace: Relax test requirementsSimon Glass
We expect the profile and bootstage to agree on timing, but when running on slow machines there can be a larger descrepency. Increase the tolerance to fix this. Fixes: 9cea4797aeb ("trace: Add a test") Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14dm: test: Add a test for the various migration combinationsSimon Glass
Test that: - sandbox shows a warning when an unmigrated DT is used - sandbox fails to run when migration is turned off - sandbox_spl fails to build when migration is turned off Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14test: Add a way to set the environment for a pytestSimon Glass
This is useful when we need to control a particular environment variable. Add a way to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14dm: treewide: Complete migration to new driver model schemaSimon Glass
Update various build and test components to use the new schema. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11trace: Add a testSimon Glass
Add a test which runs sandbox, collects a trace and makes sure it can be processed by trace-cmd. This should ensure that this feature continues to work as U-Boot and trace-cmd evolve. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-27mkimage: fit: Support signed configurations in 'auto' FITsMassimo Pegorer
Extend support for signing in auto-generated (-f auto) FIT. Previously, it was possible to get signed 'images' subnodes in the FIT using options -g and -o together with -f auto. This patch allows signing 'configurations' subnodes instead of 'images' ones (which are hashed), using option -f auto-conf instead of -f auto. Adding also -K <dtb> and -r options, will add public key to <dtb> file with required = "conf" property. Summary: -f auto => FIT with crc32 images -f auto -g ... -o ... => FIT with signed images -f auto-conf -g ... -o ... => FIT with sha1 images and signed confs Example: FIT with kernel, two device tree files, and signed configurations; public key (needed to verify signatures) is added to u-boot.dtb with required = "conf" property. mkimage -f auto-conf -A arm -O linux -T kernel -C none -a 43e00000 \ -e 0 -d vmlinuz -b /path/to/first.dtb -b /path/to/second.dtb \ -k /folder/with/key-files -g keyname -o sha256,rsa4096 \ -K u-boot.dtb -r kernel.itb Example: Add public key with required = "conf" property to u-boot.dtb without needing to sign anything. This will also create a useless FIT named unused.itb. mkimage -f auto-conf -d /dev/null -k /folder/with/key-files \ -g keyname -o sha256,rsa4096 -K u-boot.dtb -r unused.itb Signed-off-by: Massimo Pegorer <massimo.pegorer@vimar.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-23part: Add a function to find the first bootable partitionSimon Glass
If a disk has a bootable partition we are expected to use it to locate the boot files. Add a function to find it. To test this, update mmc1 to have two paritions, fixing up other tests accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: core: Support sorting devices with dm treeSimon Glass
Add a -s flag to sort the top-level devices in order of uclass ID. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18test/py: gpt: add test for the gpt partition type GUID identifierEnric Balletbo i Serra
Add sandbox test for the gpt partition type command, the test uses the persistent data test_gpt_disk_image.bin to check that the first partition type GUID that identifies the type of the partition has the "Linux filesystem data" type ( 0FC63DAF-8483-4772-8E79-3D69D8477DE4 ). Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
2023-01-16bootstd: Add a test for the bootstd menuSimon Glass
Add a test which checks that two operating systems can be displayed in a menu, allowing one to be selected. Enable a few things on snow so that the unit tests build. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16sandbox: Enable mmc command and legacy imagesSimon Glass
The mmc command is useful for testing mmc disk images in sandbox, so enable it. We also need to enable legacy images so that we can run tests which use them. Disable it for a few avb tests since MMC is not implemented there yet. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-11test: env: add test for u-boot-initial-env creationMax Krummenacher
Checks that `make u-boot-initial-env` creates the text file u-boot-initial-env and checks that it at least contains `board=<something>`. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31cmd: source: Support specifying config nameSean Anderson
As discussed previously [1,2], the source command is not safe to use with verified boot unless there is a key with required = "images" (which has its own problems). This is because if such a key is absent, signatures are verified but not required. It is assumed that configuration nodes will provide the signature. Because the source command does not use configurations to determine the image to source, effectively no verification takes place. To address this, allow specifying configuration nodes. We use the same syntax as the bootm command (helpfully provided for us by fit_parse_conf). By default, we first try the default config and then the default image. To force using a config, # must be present in the command (e.g. `source $loadaddr#my-conf`). For convenience, the config may be omitted, just like the address may be (e.g. `source \#`). This also works for images (`source :` behaves exactly like `source` currently does). [1] https://lore.kernel.org/u-boot/7d711133-d513-5bcb-52f2-a9dbaa9eeded@prevas.dk/ [2] https://lore.kernel.org/u-boot/042dcb34-f85f-351e-1b0e-513f89005fdd@gmail.com/ Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31test: Add test for source commandSean Anderson
This adds a basic test for FIT image handling by the source command. It's a python test becase we need to run mkimage. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-06event: Re-add file paths to the testsTom Rini
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 Kojima
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-07dm: Add tests for the sandbox host driverSimon Glass
Add some unit tests for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-07dm: sandbox: Switch over to using the new host uclassSimon Glass
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-07test: Correct pylint warnings in fs_helperSimon Glass
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-07test: Split out mk_fs function into a helperSimon Glass
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 Kojima
'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 Ganu
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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-17vbe: Add a test for VBE device tree fixupsSimon Glass
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>