aboutsummaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
2022-08-22CI: Move to Ubuntu 2022.04 "Jammy" for CI baseTom Rini
- 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 Glass
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 Glass
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 Glass
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 Simek
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 Simek
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é
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 Rini
2022-07-08requirements: Move to atomicwrites==1.4.1Tom Rini
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 Rini
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 Takahiro
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 Schuchardt
* 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 Scull
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 Schuchardt
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é
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>
2022-06-04test/py: efi_capsule: repair image authentication testVincent Stehlé
Repair the python tests for authenticated EFI capsules, which can be run with sandbox_defconfig plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. - Account for the reset changes done by commit 3e6f81000672 ("efi_loader: test/py: Reset system after capsule update on disk"). - Fix the capsule GUID typo introduced by commit 2e9c3c6965ba ("test: capsule: Modify the capsule tests to use GUID values for sandbox"). Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-05-28test: don't change console timeout in EFI selftest.Heinrich Schuchardt
Changing the console timeout to 500 ms without restoring the original value leads to failures in other tests. As the console timeout change is not necessary for the text input protocol tests remove it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-28test: fix pylint warnings in test_efi_selftest.pyHeinrich Schuchardt
* change format of parameter documentation * avoid superfluous assignments Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-28test: restore timeout after bootmenu unit testHeinrich Schuchardt
In the bootmenu unit test the console timeout is set to 500 ms. Other tests rely on the original timeout. Ensure that the original value is restored. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-26test: fix parsing the mksquashfs version numberHeinrich Schuchardt
Testing with mksquasshfs 4.5.1 results in an error ValueError: could not convert string to float: '4.5.1' Version 4.10 would be considered to be lower than 4.4. Fixes: 04c9813e951f ("test/py: rewrite common tools for SquashFS tests") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-26test/py: test_part: Correct the test case nameBin Meng
Use test_part_types as the name instead of dm_compact. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-26test/py: test_fs: Correct the test case nameBin Meng
Use test_fstypes as the name instead of test_dm_compact. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-26test/py: Reset the console timeout valueBin Meng
Reset the console timeout value as some tests may change its default value during the execution. This fixes the random case timeout issue seen in the U-Boot CI. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-08Merge tag 'efi-2022-07-rc3-2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc3-2 UEFI: * Fix build errors due to - using sed with non-standard extension for regular expression - target architecture not recognized for CROSS_COMPILE=armv7a-* - CONFIG_EVENT not selected * add sha384/512 on certificate revocation Others: * factor out the user input handling in bootmenu command
2022-05-07test/py: Add more test cases for rejecting an EFI imageIlias Apalodimas
The previous patch adds support for rejecting images when the sha384/512 of an x.509 certificate is present in dbx. Update the sandbox selftests Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-05-06test: py: tests: test_gpt.py: add a simple test for the command gpt repairPhilippe Reynes
Adds a simple test for the command gpt repair. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-05-05sandbox: Avoid binman error when run without device treeSimon Glass
With sandbox, U-Boot can be run without a device tree (i.e. no -d or -T parameter). In this case an empty device tree is created for convenience. With a recent change this causes an error due to the missing '/binman' node. Add this node to avoid the problem, as well as a test that U-Boot can be run without a device tree. Fixes: 059df5624b ("arch: Kconfig: imply BINMAN for SANDBOX") Fixes: https://source.denx.de/u-boot/u-boot/-/issues/11 Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-05test/py: Add a way to start sandbox without a device treeSimon Glass
This is useful sometimes when running a specific test. Add support for it in the existing restart_uboot_with_flags() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-03menu: always show the menu regardless of the number of entryMasahisa Kojima
To make user aware of the menu entry selection, menu always appears regardless of the number of entry. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Adjust test/py/tests/test_bootmenu.py Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03test: fix some pylint problems in test_capsule_firmware_raw.pyHeinrich Schuchardt
* improve doc-string formatting * remove unused imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03test: unit test for bootmenuHeinrich Schuchardt
Provide a unit test for the bootmenu command Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-02vpl: Test that VPL runs correctly through to U-Boot properSimon Glass
Check the TPL -> VPL -> SPL -> U-Boot path by running the 'help' command in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-02vpl: Support running vpl testsSimon Glass
Add support for these to the pytest system. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add setup for the bootflow testsSimon Glass
We need to create a disk image with a partition table and a DOS-format filesystem containing a few files. Provide a fallback binary for CI since it does not seem able to detect the loopback partitions. Add this to a dm_init test so that it happens when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-20cmd: gpio: Add `gpio read` subcommandDiego Rondini
As explained in commit 4af2a33ee5b9 ("cmd: gpio: Make `gpio input` return pin value again") the `gpio input` is used in scripts to obtain the value of a pin, despite the fact that CMD_RET_FAILURE is indistinguishable from a valid pin value. To be able to detect failures and properly use the value of a GPIO in scripts we introduce the `gpio read` command that sets the variable `name` to the value of the pin. Return code of the `gpio read` command can be used to check for CMD_RET_SUCCESS or CMD_RET_FAILURE. CONFIG_CMD_GPIO_READ is used to enable the `gpio read` command. Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
2022-04-15test: capsule: Modify the capsule tests to use GUID values for sandboxSughosh Ganu
The current UEFI capsule updation code uses two GUID values, one for FIT images, and one for raw images across platforms. This logic is being changed to have GUID values per image, per platform. Change the tests for the capsule update code to reflect this change. The GUID values now used are the ones specific to the sandbox platform -- one for the u-boot image, and another for the u-boot environment image. Install the FMP instance for raw images on the sandbox variant for testing the capsule update code. Install the FMP instance for the FIT images on the sandbox64 and sandbox_flattree variant for testing capsule update for FIT images. This is being done by splitting the capsule update script for FIT and raw images. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2022-04-08test/py:Update python tests for ‘gpio’ cmdAdarsh Babu Kalepalli
Generic Python Test cases are developed to verfiy 'gpio' command. Signed-off-by: Adarsh Babu Kalepalli <opensource.kab@gmail.com>
2022-04-07env: Allow text-env tests to run with awkSimon Glass
At present the tests assume that gawk is being used. Adjust the tests so that the names are inserted in alphabetical order, so that awk is happy. Also use PROCINFO to make gawk output in alphabetical order. This is not ideal, since it changes the env-car ordering from what the user provided, but it may be acceptable. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/10
2022-04-04Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-31test: py: vboot: add test for global image signaturePhilippe Reynes
Adds test units for the pre-load header signature. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-31arch: Kconfig: imply BINMAN for SANDBOXPhilippe Reynes
To be able to use the tool binman on sandbox, the config SANDBOX should imply BINMAN. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-31test: fix pylint warnings in test_efi_bootmgrHeinrich Schuchardt
* Use f'' strings instead of .format(). * Correct sequence of imports. * Remove a superfluous import. * Add missing documentation. * Replace yield by return. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-31test: fix pylint warnings for test_efi_fit.pyHeinrich Schuchardt
* fix style of argument documentation * add encoding to open() calls Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-28Merge tag 'v2022.04-rc5' into nextTom Rini
Prepare v2022.04-rc5
2022-03-26test: test UEFI boot managerHeinrich Schuchardt
Provide a unit test for * efidebug boot add * efidebug boot order * bootefi bootmgr * initrd via EFI_LOAD_FILE2_PROTOCOL Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-15test/py: Add tests for the erofsHuang Jianan
Add Python scripts to test 'ls' and 'load' commands, as well as test related filesystem functions. Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2022-03-10event: Add a script to decode the event-spy listSimon Glass
For debugging and dicoverability it is useful to be able to see a list of each event spy in a U-Boot ELF file. Add a script which shows this, along with the event type and the source location. This makes events a little easier to use than weak functions, for example. Add a basic sandbox test as well. We could provide a test for other boards, but for now, few use events. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-02test: Correct pylint errorsSimon Glass
Fix pylint errors in all test. This requires adding a get_spawn() method to the ConsoleBase base, so that its subclass is happy. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-26efi_loader: test/py: Reset system after capsule update on diskMasami Hiramatsu
Add a cold reset soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. This also reports the result of each capsule update so that the user can notice that the capsule update has been succeeded or not from console log. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-26test/py: Handle expected reboot while booting sandboxMasami Hiramatsu
Add expected_reset optional argument to ConsoleBase::ensure_spawned(), ConsoleBase::restart_uboot() and ConsoleSandbox::restart_uboot_with_flags() so that it can handle a reset while the 1st boot process after main boot logo before prompt correctly. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>