aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2023-01-23bootstd: Record the bootdevs used during scanningSimon Glass1-32/+35
Add a way to record the bootdevs used when scanning for bootflows. This is useful for testing. Enable this only with BOOTSTD_FULL and do the same for the progress reporting. Re-enable and update the affected tests now that we have this feature. For bootdev_test_order_default() there is no-longer any support for using the bootdev aliases to specify an ordering, so drop that part of the test. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Drop the old bootflow_scan_first()Simon Glass2-9/+12
This function is not used outside tests. Drop it and rename bootflow_scan_dev() since it is how we start a scan now. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow scanning a single bootdev labelSimon Glass2-3/+61
We want to support scanning a single label, like 'mmc' or 'usb0'. Add this feature by plumbing the label through to the iterator, setting a flag to indicate that only siblings of the initial device should be used. This means that scanning a bootdev by its name is not supported anymore. That feature doesn't seem very useful in practice, so it is no great loss. Add a test for bootdev_find_by_any() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Switch bootdev scanning to use labelsSimon Glass2-7/+57
At present we set up the bootdev order at the start, then scan the bootdevs one by one. However this approach cannot be used with hunters, since the bootdevs may not exist until the hunter is used. Nor can we just run all the hunters at the start, since that violate's U-Boot's 'lazy init' requirement. It also increases boot time. So we need to adjust the algorithm to scan by labels instead. As a first step, drop the dev_order[] array in favour of a list of labels. Update the name of bootdev_setup_iter_order() to better reflect what it does. Update some related comments and log messages. Also disable a few tests until a later commit where we can use them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a hunter for the extension featureSimon Glass3-24/+38
This needs to run before any bootdev is used, so add a hunter for it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow iterating to the next bootdev priortiySimon Glass1-0/+84
Add a function which moves to the next priority to be processed. This works by storing the current priority in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow iterating to the next label in a listSimon Glass1-1/+79
Add a function which moves to the next label in a list of labels. This allows processing the boot_targets environment variable. This works using a new label list in the bootflow iterator. The logic to set this up is included in a subsequent commit. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow hunting for a bootdev by labelSimon Glass3-2/+140
Add a function to hunt for a bootdev label and find the bootdev produced by the hunter (or already present). Add a few extra flags so that we can distinguish between "mmc1", "mmc" and "1" which all need to be handled differently. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a new pre-scan priority for bootdevsSimon Glass1-20/+31
We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Allow hunting for bootdevs of a given prioritySimon Glass1-0/+25
Add a way to run the hunter function for a particular priority, so that new bootdevs can be found. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Treat DHCP and PXE as bootdev labelsSimon Glass1-4/+13
These are associated with the ethernet boot device but do not match its uclass name, so handle them as special cases. Provide a way to pass flags through with the bootdev so that we know how to process it. The flags are checked by the bootmeths, to ensure that only the selected bootmeth is used. While these both use the network device, they work quite differently. It is common to run only one of these, or to run PXE before DHCP. Provide bootflow flags to control which methods are used. Check these in the two bootmeths so that only the chosen one is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a SPI flash bootdevSimon Glass1-8/+11
Add a bootdev for SPI flash so that these devices can be used with standard boot. It only supports loading a script. Add a special case for the label, since we want to use "spi", not "spi_flash". Enable the new bootdev on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23sandbox: Allow SPI flash bootdevs to be disabled for testsSimon Glass1-0/+1
Most tests don't want these and they can create a lot of noise. Add a way to disable them. Use that in tests, with a flag provided to enable them for tests that need this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Include the device tree in the bootflowSimon Glass1-0/+1
Some bootmeths provide a way to load a device tree as well as the base OS image. Add a way to store this in the bootflow. Update the 'bootflow info' command to show this information. Note that the device tree is not allocated, but instead is stored at an address provided by an environment variable. This may need to be adjusted at some point, but for now it works well and fits in with the existing distro-boot scripts. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a virtio bootdevSimon Glass1-5/+7
Add a bootdev for virtio so that these devices can be used with standard boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23virtio: Avoid strange behaviour on removalSimon Glass1-0/+3
This device does a check on removal which is better handled in the actual test. Move it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add an NVMe bootdevSimon Glass1-6/+9
Add a bootdev for NVMe so that these devices can be used with standard boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add an IDE bootdevSimon Glass1-6/+10
Add a bootdev for IDE so that these devices can be used with standard boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a SCSI bootdevSimon Glass1-7/+11
Add a bootdev for SCSI so that these devices can be used with standard boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Only scan bootable partitionsSimon Glass2-2/+39
At present all partitions are scanned, whether marked bootable or not. Use only bootable partitions, defaulting to partition 1 if none is found. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23part: Add a function to find the first bootable partitionSimon Glass4-7/+25
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-23bootstd: Add a hunter for ethernetSimon Glass1-6/+11
Sometimes ethernet devices are attached to PCI. Since it is quick to scan, add this into the ethernet hunter. Run dhcp to establish the network connection. Drop this from the bootdev since that is not needed now. Update a log message for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add an MMC hunterSimon Glass1-6/+10
Add a hunter for MMC. This doesn't do anything at present, since MMC is currently set up when U-Boot starts. If MMC moves to lazy init then we can add a hunter function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add a USB hunterSimon Glass1-5/+21
Add a hunter for USB which enumerates the bus to find new bootdevs. Update the tests and speed up bootdev_test_prio() while we are here, by dropping the USB delays. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Support running bootdev huntersSimon Glass1-0/+3
Add a way to run a bootdev hunter to find bootdevs of a certain type. Add this to the 'bootdev hunt' command. Test for this are added in a later patch, since a useful test needs some hunters to work with. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Add the concept of a bootdev hunterSimon Glass1-0/+52
Some bootdevs must be enumerated before they appear. For example, USB bootdevs are not visible until USB is enumerated. With standard boot this needs to happen automatically, since we only want to enumerate a bus if it is needed. Add a way to define bootdev 'hunters' which can be used to hunt for bootdevs of a given type. Track which ones have been used and add a command to list them. Include a clang work-around which seems to be needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23sandbox: Allow ethernet bootdevs to be disabled for testsSimon Glass1-1/+7
Most tests don't want these and can create a lot of noise. Add a way to disable them. Use that in tests, with a flag provided to enable them for tests that need this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: test: Correct ordering of DM setupSimon Glass2-7/+14
We must call dm_scan_other() after devices from the device tree have been created, since that function behaves differently if there is no bootstd device. Adjust the logic to achieve this. Also fix the bootflow_system() test which was relying on this broken behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: part: Update test to use mmc2Simon Glass1-6/+6
At present this test sets up a partition table on mmc1. But this is used by the bootstd tests, so it is not possible to run those after this test has run, without restarting the Python test harness. This is inconvenient when running tests repeatedly with 'ut dm'. Move the test to use mmc2, which is not used by anything. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23test: Drop duplicate restore of DM stateSimon Glass1-4/+0
This code is present twice. Fix it so that it is only executed once. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23test: Fix the help for the ut commandSimon Glass1-1/+1
The font help has an incorrect newline. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: cdd964e3801 ("test: Tidy up help for ut command")
2023-01-23lib: Add a function to split a string into substringsSimon Glass1-0/+82
Some environment variables provide a space-separated list of strings. It is easier to process these when they are broken out into an array of strings. Add a utility function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: test: Correct assertion in dm_test_part()Simon Glass1-8/+4
This obscures the line number. Update the test to avoid make sure that the line which failed is displayed, so it is possible to diagnose the failure. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23dm: core: Support sorting devices with dm treeSimon Glass1-0/+38
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: compression: add zstd uncompression testBrandon Maier2-1/+72
Signed-off-by: Brandon Maier <brandon.maier@collins.com>
2023-01-18test/py: gpt: add test for the gpt partition type GUID identifierEnric Balletbo i Serra1-0/+23
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-18test: compression: use sizeof() instead of magic numbersBrandon Maier1-4/+4
Signed-off-by: Brandon Maier <brandon.maier@collins.com>
2023-01-16bootstd: Support setting a theme for the menuSimon Glass1-3/+80
Allow a theme to be set. For now this is very simple, just a default font size to use for all elements. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Add a test for the bootstd menuSimon Glass4-19/+250
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-16expo: Add basic testsSimon Glass2-0/+541
Add some tests for the expo, including setting up and rendering an expo. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Allow reading a logo for the OSSimon Glass1-0/+1
Some operating systems provide a logo in bmp format. Read this in if present so it can be displayed in the menu. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16bootstd: Read the Operating System name for distro/scriptsSimon Glass1-0/+1
Add the concept of an OS name to the bootflow. This typically includes the OS name, version and kernel version. Implement this for the distro and script bootmeths so that it works with Armbian and older version of Fedora. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16video: Add font functions to the vidconsole APISimon Glass1-3/+3
Support for fonts currently depends on the type of vidconsole in use. Add two new methods to enumerate fonts and to set the font. Fix a few other method comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16sandbox: Enable mmc command and legacy imagesSimon Glass1-0/+2
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-11Use `grep -E` or plain `grep` instead of `egrep`Ville Skyttä1-5/+5
`egrep` has been deprecated in GNU grep since 2007, and since 3.8 it emits obsolescence warnings: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1 Acked-by: Dhruva Gole <d-gole@ti.com>
2023-01-11test: compression: use ut_assert for errorsBrandon Maier1-31/+25
Use the ut_assert macros for more useful error messages. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11test: compression: check with trailing garbage in inputBrandon Maier1-0/+9
The Linux kernel appends 4 bytes to the end of compressed kernel Images containing the uncompressed image size. They are used to make self-decompressing Images easier. However for archs that don't support self-decompression, like ARM64, U-Boot must be able to decompress the image with the garbage data. The existing decompressors already support this. This unit test was added while working on zstd support as upstream zstd will error if there is garbage data in the input buffer, and special care was needed to support this. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11test: cmd: exit: Add unit test for exit and partly run commandsMarek Vasut3-1/+137
Add a test which validates that exit from environment script works as expected, including return value propagation and clipping to positive integers. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11test: env: add test for u-boot-initial-env creationMax Krummenacher1-0/+24
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>
2023-01-09Merge branch 'next'Tom Rini13-19/+101
Signed-off-by: Tom Rini <trini@konsulko.com>