aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-09-29test: Support testing malloc() failuresSimon Glass1-0/+1
It is helpful to test that out-of-memory checks work correctly in code that calls malloc(). Add a simple way to force failure after a given number of malloc() calls. Fix a header guard to avoid a build error on sandbox_vpl. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2022-09-29test: Fix missing livetree test runsSimon Glass2-2/+5
At present the live tree tests are not run on sandbox. This bug is in two parts, with a duplicate flag value and incorrect logic in the test runner. This was not noticed because the bug was fixed in a later commit and does not cause test failures. Fix this. Fixes: 7b1dfc9fd7e ("dm: core: Prepare for updating the device tree with ofnode") Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop image_header_t typedefSimon Glass1-2/+2
This is not needed and we should avoid typedefs. Use the struct instead and rename it to indicate that it really is a legacy struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: Add a test for SCSISimon Glass3-0/+49
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-23display_options: print_size: Fix order overflowPali Rohár1-0/+3
Function print_size() round size to the nearst value with one decimal fraction number. But in special cases also unit order may overflow. For example value 1073689396 is printed as "1024 MiB" and value 1073741824 as "1 GiB". Fix this issue by detecting order overflow and increasing unit order. With this change also value 1073689396 is printed as "1 GiB". Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-19Merge branch 'master' into nextTom Rini2-0/+35
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese2-5/+6
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-09-16blk: Switch over to using uclass IDsSimon Glass1-12/+12
We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-15Nokia RX-51: Add booting from UBI into test scriptPali Rohár1-18/+77
Compile U-Boot with UBI/UBIFS support according to doc/board/nokia/rx51.rst instructions and add test case for loading kernel image from UBI volume. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-15Nokia RX-51: Add comment describing kernel image type into test scriptPali Rohár1-2/+2
Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-15Nokia RX-51: Do not set useless ARCH= in test scriptPali Rohár1-1/+1
U-Boot ignores ARCH= variable. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-15Nokia RX-51: Call bootm in test script only when image is validPali Rohár1-1/+1
When reading of image fails then do not call bootm. This prevents false positive test result in case something bootable is present in memory. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-15Nokia RX-51: Change UBIFS volume size to 1870 LEBs in test scriptPali Rohár1-1/+1
Original Nokia UBIFS system image has 1870 LEBs, so set UBIFS volume size in test script to the same value. Number of 1870 LEBs corresponds to 230MiB (LEB size * num of LEBs = 126KiB * 1870 = 230MiB). Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-15gpio: sandbox: Add GPIOD_IS_AF for gpio configured in alternate functionPatrice Chotard1-0/+30
This allows to test if a pin's label if displayed using gpio_get_status() when this pin is configured in alternate function. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-09-14dm: core: Add functions to read 8/16-bit integersStefan Herbrechtsmeier1-0/+19
Add functions to read 8/16-bit integers like the existing functions for 32/64-bit to simplify read of 8/16-bit integers from device tree properties. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-14Merge tag 'efi-next-2022-09-14' of ↵WIP/14Sep2022-nextTom Rini2-0/+394
https://source.denx.de/u-boot/custodians/u-boot-efi into next Pull request for efi next UEFI: Implement a command eficonfig to maintain Load Options and boot order via menus.
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-13cyclic: Add a simple testWIP/2022-09-13-add-support-for-cyclic-function-executionStefan Roese3-0/+39
Add a test for cyclic function registration and activation. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-12Makefile: Add a pcheck option to run tests in parallelSimon Glass1-8/+32
Running tests in parallel is much faster, e.g. 15 seconds to run the tests on sandbox (only), instead of 100 seconds (on a 16-core machine). Add a 'make pcheck' option to access this feature. Note that the tools/ tests still run each tool's tests once after the other, although within that, they do run in parallel. So for example, the buildman tests run in parallel, then the binman tests run in parallel. There would be a signiificant advantage to running them all in parallel together, but that would require a large amount of refactoring, e.g. with more use of pytest fixtures. Update the documentation to represent the current state. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-12test/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-12test/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-12test: Refactor arg parsing for the run scriptSimon Glass1-4/+7
Tidy up this code a little. Also use '-k' consistently, since -m is more limited in what it can accept. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-12test: 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-12test: 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-12test: 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-12test: 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-12test: 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-12test: 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-12test: 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-12test/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-12test: Fix bootm_test_subst_var() running independentlySimon Glass1-1/+2
This test relies on the silent_linux env variable being set. Add this to the code so it can run without relying on other bootm tests having been run first. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-12test: 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-09-03tpm: Allow reporting the internal stateSimon Glass2-0/+35
It is useful to read information about the current TPM state, where supported, e.g. for debugging purposes when verified boot fails. Add support for this to the TPM interface as well as Cr50. Add a simple sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-02dm: rtc: Try to handle the localtime() raceSimon Glass1-13/+19
At present the sandbox timer uses localtime() which can jump around twice a year when daylight-saving time changes. It would be tricky to make use of gmtime() since we still need to present the time in local time, as seems to be required by U-Boot's RTC interface. The problem can only happen once, so use a loop to detect it and try again. This should be sufficient to detect either a change in the 'second' value, or a daylight-saving change. We can assume that the latter also incorporates a 'second' change, so there is no need to loop more than twice. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-02dm: rtc: Try to avoid a race in rtc_set_get testSimon Glass1-5/+17
It seems that the time can change in between getting it and reading the offset. Check for this and try again if this happens. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-02dm: rtc: Avoid a race in the rtc_reset testSimon Glass1-2/+7
Since resetting the RTC on sandbox causes it to read the base time from the system, we cannot rely on this being unchanged since it was last read. Allow for a one-second delay. Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/4 Reported-by: Bin Meng <bmeng.cn@gmail.com> Reported-by: Tom Rini <trini@konsulko.com> Suggested-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-02test: Allow running tests multiple timesSimon Glass3-8/+31
Some tests can have race conditions which are hard to detect on a single one. Add a way to run tests more than once, to help with this. Each individual test is run the requested number of times before moving to the next test. If any runs failed, a message is shown. This is most useful when running a single test, since running all tests multiple times can take a while. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-02dm: rtc: Make use of ut_assertnonnull()Simon Glass1-5/+5
Use this (newish) macro since it is designed for the purpose of making sure things are non-NULL. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-02cmd: Add pause commandSamuel Dionne-Riel2-0/+48
This command is being introduced with the goal of allowing user-friendly "generic use case" U-Boot builds to pause until user input under some situations. The main use case would be when a boot failure happens, to pause until the user has had time to acknowledge the current state. Tested using: make && ./u-boot -v -T -c 'ut lib lib_test_hush_pause' Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> Cc: 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: Add a new vbe commandSimon Glass1-0/+115
Add a command to look at VBE methods and their status. Provide a test for all of this as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Check building without global bootmethsSimon Glass2-7/+24
Use the sandbox_flattree build to check that everything works correctly with BOOTMETH_GLOBAL disabled. Update the tests as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Add vbe bootmeth into sandboxSimon Glass3-8/+68
Update sandbox to include the VBE bootmeth. Update a few existing tests to take account of this change, specifically that the new bootmeth now appears when scanning. Signed-off-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-12bootstd: Drop the system bootdevSimon Glass1-6/+1
This was a work-around for the fact that global bootmeths such as EFI bootmgr and VBE don't use a particular bootdev, or at least select it themselves so that we don't need to scan all bootdevs when using that bootmeth. Drop the system bootdev entirely. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Always create the EFI bootmgr bootmethSimon Glass1-15/+7
Now that we can separate this out from the normal bootmeths, update the code to create it always. We cannot rely on the device tree to create this, since the EFI project is quite opposed to having anything in the device tree that helps U-Boot with its processing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow scanning for global bootmeths separatelySimon Glass1-2/+3
Typically we want to find and use global bootmeths first, since they have the best idea of how the system should boot. We then use normal bootmeths as a fallback. Add the logic for this, putting global bootmeths at the end of the ordering. We can then easily scan the global bootmeths first, then drop them from the list for subsequent bootdev-centric scans. This changes the ordering of global bootmeths, so update the bootflow_system() accordingly. Drop the comment from bootmeth_setup_iter_order() since this is an exported function and it should be in the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Call dm_scan_other() when setting up for testsSimon Glass1-1/+3
At present this function is not called, so tests miss out on any devices created by it. Add it in so that tests can rely on these extra devices. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow EFI bootmgr to support an invalid bootflowSimon Glass1-0/+4
For most testing we don't want this bootmeth to actually do anything. For the one test where we do, add a test hook to obtain the correct behaviour. This will allow us to bind the device always, rather than just doing it for this test. Signed-off-by: Simon Glass <sjg@chromium.org>