summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
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>
2022-06-04test/py: efi_capsule: repair image authentication testVincent Stehlé2-5/+5
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 Schuchardt1-2/+0
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 Schuchardt1-61/+28
* 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 Schuchardt1-33/+33
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 Schuchardt1-5/+4
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 Meng1-1/+1
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 Meng1-1/+1
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 Meng1-0/+4
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-23test: dm: spi: Replace _spi_get_bus_and_cs() by spi_get_bus_and_cs() in some ↵Patrice Chotard1-10/+6
case In case _spi_get_bus_and_cs()'s parameters drv_name and dev_name are respectively set to NULL and 0, use spi_get_bus_and_cs() instead. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Behun <marek.behun@nic.cz> Cc: Jagan Teki <jagan@amarulasolutions.com> Cc: Vignesh R <vigneshr@ti.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Cc: "Pali Rohár" <pali@kernel.org> Cc: Konstantin Porotchkin <kostap@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Pratyush Yadav <p.yadav@ti.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Anji J <anji.jagarlmudi@nxp.com> Cc: Biwen Li <biwen.li@nxp.com> Cc: Priyanka Jain <priyanka.jain@nxp.com> Cc: Chaitanya Sakinam <chaitanya.sakinam@nxp.com>
2022-05-23spi: spi-uclass: Add new spi_get_bus_and_cs() implementationPatrice Chotard1-16/+17
Move legacy spi_get_bus_and_cs() code to _spi_get_bus_and_cs(). Add new spi_get_bus_and_cs() implementation which rely on DT for speed and mode and don't need any drv_name nor dev_name parameters. This will prepare the ground for next patch. Update all callers to use _spi_get_bus_and_cs() to keep the same behavior. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Behun <marek.behun@nic.cz> Cc: Jagan Teki <jagan@amarulasolutions.com> Cc: Vignesh R <vigneshr@ti.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Cc: "Pali Rohár" <pali@kernel.org> Cc: Konstantin Porotchkin <kostap@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Pratyush Yadav <p.yadav@ti.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Anji J <anji.jagarlmudi@nxp.com> Cc: Biwen Li <biwen.li@nxp.com> Cc: Priyanka Jain <priyanka.jain@nxp.com> Cc: Chaitanya Sakinam <chaitanya.sakinam@nxp.com>
2022-05-08Merge tag 'efi-2022-07-rc3-2' of ↵Tom Rini2-0/+57
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-08test/py: Add more test cases for rejecting an EFI imageIlias Apalodimas2-0/+57
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 Reynes1-0/+10
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 Glass1-0/+12
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 Glass1-7/+8
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-04Merge tag 'efi-2022-07-rc2-2' of ↵Tom Rini4-22/+117
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc2-2 * Test Unit test for 'bootmenu' command * UEFI Preparatory patches for implementing a UEFI boot options based menu
2022-05-04pci: Add mask parameter to dm_pci_map_bar()Andrew Scull1-6/+6
Add a mask parameter to control the lookup of the PCI region from which the mapping can be made. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-04pci: Match region flags using a maskAndrew Scull1-28/+32
When converting addresses, apply a mask to the region flags during lookup. This allows the caller to specify which flags are important and which are not, for example to exclude system memory regions. The behaviour of the function is changed such that they don't preferentially search for a non-system memory region. However, system memory regions are added after other regions in decode_regions() leading to a similar outcome. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Map bars with offset and lengthAndrew Scull1-6/+6
Evolve dm_pci_map_bar() to include an offset and length parameter. These allow a portion of the memory to be mapped and range checks to be applied. Passing both the offset and length as zero results in the previous behaviour and this is used to migrate the previous callers. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03test: pci: Test PCI address conversion functionsAndrew Scull1-0/+102
Add tests for the functions dm_pci_bus_to_phys() and dm_pci_phys_to_bus() which convert between PCI bus addresses and physical addresses based on the ranges declared for the PCI controller. The ranges of bus#1 are used for the tests, adding a translation to one of the ranges to cover more cases. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03menu: always show the menu regardless of the number of entryMasahisa Kojima1-2/+0
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: unit test for u16_strlcat()Masahisa Kojima1-0/+50
Provide a unit test for function u16_strlcat(). Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03lib: fix selection of CONFIG_CHARSETHeinrich Schuchardt1-0/+1
lib/charset.c is not optional for EFI_APP || EFI_LOADER || UFS || UT_UNICODE. These must select CONFIG_CHARSET. Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03test: fix some pylint problems in test_capsule_firmware_raw.pyHeinrich Schuchardt1-22/+20
* improve doc-string formatting * remove unused imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03test: unit test for bootmenuHeinrich Schuchardt1-0/+48
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 Glass1-0/+14
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 Glass3-3/+45
Add support for these to the pytest system. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-29test: dm: devres: Remove use-after-freeAndrew Scull1-4/+1
Use-after-free shouldn't be used, even in tests. It's bad practice and makes the test brittle. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-29test: Fix pointer overrun in dm_test_devm_regmap()Andrew Scull1-5/+4
This tests calls regmap_read() which takes a uint pointer as an output parameter. The test was passing a pointer to a u16 which resulted in an overflow when the output was written. Fix this by following the regmap_read() API and passing a uint pointer instead. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Jean-Jacques Hiblot <jjhiblot@ti.com> Cc: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-28test: dm: pinmux: Get LED2 udevice in the pinmux testMarek Vasut1-0/+5
The UT reinitializes the pin controller state, get LED2 udevice to trigger its probe and configure the pin controller pin state as it is expected by the test. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com>
2022-04-28test: dm: led: Fix LED enumerationMarek Vasut1-9/+8
The GPIO LED driver no longer considers the top level node an LED, because it is not an LED. With this bug fixed, the LED enumeration has changed. Update the test accordingly. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com>
2022-04-28led: Drop led_default_state()Marek Vasut1-3/+0
This function is empty, drop it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-25Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini15-42/+1020
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
2022-04-25bootstd: Add setup for the bootflow testsSimon Glass2-0/+103
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-25bootstd: Add tests for bootstd including all uclassesSimon Glass8-0/+820
Add a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality. Expand the sandbox console-recording limit so that these can work. These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: dm: Restart USB before assuming it is stoppedSimon Glass1-0/+6
Update the blk test to stop USB first, in case another test has started it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: fastboot: Avoid using mmc1Simon Glass1-2/+2
The bootflow tests need to use an MMC with an associated backing file containing a filesystem. Update the fastboot tests to cope with this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Allow finding a uclass device by partial nameSimon Glass1-0/+15
In some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison. Fix the comment for device_find_child_by_namelen() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Rename and fix uclass_get_by_name_len()Simon Glass1-0/+2
It seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reported-by: Tim Harvey <tharvey@gateworks.com>
2022-04-25lib: Add a way to find the postiion of a trailing numberSimon Glass1-1/+12
At present it is not possible to find out which part of the string is the number part and which is before it. Add a new variant which provides this feature, so we can separate the two in the caller. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Fix a few bugs in trailing_strtoln()Simon Glass1-0/+2
At present this has a minor bug in that it reads the byte before the start of the string, if it is empty. Also it doesn't handle a non-numeric prefix which is only one character long. Fix these bugs with a reworked implementation. Add a test for the second case. The first one is hard to test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: Add tests for trailing_strtol()Simon Glass1-0/+19
This function currently has no tests. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Move string tests to the string moduleSimon Glass2-40/+40
A few string tests were added to the print module by mistake. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-23test: dm: add tests for tag supportAKASHI Takahiro2-0/+85
The new test covers all tag-related interfaces. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-20cmd: gpio: Add `gpio read` subcommandDiego Rondini1-0/+14
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-19dm: core: Allow devres to be disabled in SPLSimon Glass1-1/+1
At present if devres is enabled in U-Boot proper it is enabled in SPL. We don't normally want it there, so disable it. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Angus Ainslie <angus@akkea.ca>
2022-04-15Merge tag 'efi-2022-07-rc1-2' of ↵Tom Rini3-114/+265
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc1-2 Documentation: * Describe env command UEFI * simplify Unicode string functions * clean up the usage of GUIDs for capsule updates
2022-04-15Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-netTom Rini3-17/+39
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
2022-04-15test: capsule: Modify the capsule tests to use GUID values for sandboxSughosh Ganu3-114/+265
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>