aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* efi: test/py: authenticate fit capsulesVincent Stehlé2022-06-043-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>
* test/py: efi_capsule: repair image authentication testVincent Stehlé2022-06-042-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>
* test: don't change console timeout in EFI selftest.Heinrich Schuchardt2022-05-281-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>
* test: fix pylint warnings in test_efi_selftest.pyHeinrich Schuchardt2022-05-281-61/+28
| | | | | | | * change format of parameter documentation * avoid superfluous assignments Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* test: restore timeout after bootmenu unit testHeinrich Schuchardt2022-05-281-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>
* test: fix parsing the mksquashfs version numberHeinrich Schuchardt2022-05-261-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>
* test/py: test_part: Correct the test case nameBin Meng2022-05-261-1/+1
| | | | | | Use test_part_types as the name instead of dm_compact. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* test/py: test_fs: Correct the test case nameBin Meng2022-05-261-1/+1
| | | | | | Use test_fstypes as the name instead of test_dm_compact. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* test/py: Reset the console timeout valueBin Meng2022-05-261-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>
* test: dm: spi: Replace _spi_get_bus_and_cs() by spi_get_bus_and_cs() in some ↵Patrice Chotard2022-05-231-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>
* spi: spi-uclass: Add new spi_get_bus_and_cs() implementationPatrice Chotard2022-05-231-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>
* Merge tag 'efi-2022-07-rc3-2' of ↵WIP/08May2022Tom Rini2022-05-082-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
| * test/py: Add more test cases for rejecting an EFI imageIlias Apalodimas2022-05-072-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>
* | test: py: tests: test_gpt.py: add a simple test for the command gpt repairPhilippe Reynes2022-05-061-0/+10
|/ | | | | | Adds a simple test for the command gpt repair. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
* sandbox: Avoid binman error when run without device treeSimon Glass2022-05-051-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>
* test/py: Add a way to start sandbox without a device treeSimon Glass2022-05-051-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>
* Merge tag 'efi-2022-07-rc2-2' of ↵Tom Rini2022-05-044-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
| * menu: always show the menu regardless of the number of entryMasahisa Kojima2022-05-031-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>
| * test: unit test for u16_strlcat()Masahisa Kojima2022-05-031-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>
| * lib: fix selection of CONFIG_CHARSETHeinrich Schuchardt2022-05-031-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>
| * test: fix some pylint problems in test_capsule_firmware_raw.pyHeinrich Schuchardt2022-05-031-22/+20
| | | | | | | | | | | | | | * improve doc-string formatting * remove unused imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
| * test: unit test for bootmenuHeinrich Schuchardt2022-05-031-0/+48
| | | | | | | | | | | | Provide a unit test for the bootmenu command Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* | pci: Add mask parameter to dm_pci_map_bar()Andrew Scull2022-05-031-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>
* | pci: Match region flags using a maskAndrew Scull2022-05-031-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>
* | pci: Map bars with offset and lengthAndrew Scull2022-05-031-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>
* | test: pci: Test PCI address conversion functionsAndrew Scull2022-05-031-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>
* vpl: Test that VPL runs correctly through to U-Boot properSimon Glass2022-05-021-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>
* vpl: Support running vpl testsSimon Glass2022-05-023-3/+45
| | | | | | Add support for these to the pytest system. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: dm: devres: Remove use-after-freeWIP/2022-04-29-fuzzing-and-asan-fixesAndrew Scull2022-04-291-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>
* test: Fix pointer overrun in dm_test_devm_regmap()Andrew Scull2022-04-291-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>
* test: dm: pinmux: Get LED2 udevice in the pinmux testMarek Vasut2022-04-281-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>
* test: dm: led: Fix LED enumerationMarek Vasut2022-04-281-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>
* led: Drop led_default_state()Marek Vasut2022-04-281-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>
* Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini2022-04-2515-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
| * bootstd: Add setup for the bootflow testsSimon Glass2022-04-252-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>
| * bootstd: Add tests for bootstd including all uclassesSimon Glass2022-04-258-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>
| * test: dm: Restart USB before assuming it is stoppedSimon Glass2022-04-251-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>
| * test: fastboot: Avoid using mmc1Simon Glass2022-04-251-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>
| * dm: core: Allow finding a uclass device by partial nameSimon Glass2022-04-251-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>
| * dm: core: Rename and fix uclass_get_by_name_len()Simon Glass2022-04-251-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>
| * lib: Add a way to find the postiion of a trailing numberSimon Glass2022-04-251-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>
| * lib: Fix a few bugs in trailing_strtoln()Simon Glass2022-04-251-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>
| * test: Add tests for trailing_strtol()Simon Glass2022-04-251-0/+19
| | | | | | | | | | | | This function currently has no tests. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
| * lib: Move string tests to the string moduleSimon Glass2022-04-252-40/+40
| | | | | | | | | | | | A few string tests were added to the print module by mistake. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test: dm: add tests for tag supportAKASHI Takahiro2022-04-232-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>
* cmd: gpio: Add `gpio read` subcommandWIP/2022-04-20-assorted-improvementsDiego Rondini2022-04-201-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>
* dm: core: Allow devres to be disabled in SPLSimon Glass2022-04-181-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>
* Merge tag 'efi-2022-07-rc1-2' of ↵WIP/15Apr2022Tom Rini2022-04-153-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
| * test: capsule: Modify the capsule tests to use GUID values for sandboxSughosh Ganu2022-04-153-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>
* | Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-netTom Rini2022-04-153-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]