summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-03-09test: cmd: fdt: Test both string and integer arrays in 'fdt get value'Marek Vasut
The 'fdt get value' subcommand now supports extraction of integer value from integer arrays, add test for it, including a test for special case unindexed integer array read, which is handled as hash and treated as a long string instead of integer. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test alias resolution in 'fdt get value'Marek Vasut
The 'fdt' command help contains the following note: " Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0. " Add test for it. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Generate fuller DT internally and switch fdt get value to itMarek Vasut
Implement function to generate internal test DT fragment and switch the 'fdt get value' test to this instead of depending on the sandbox DT. Rename clk-test node to test-node node. This FDT fragment will be reused by other tests. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()Marek Vasut
The 'fdt get' command has a 'get value' subcommand, rename the fdt_test_get() to fdt_test_get_value() to avoid confusion about what it is testing. There is currently no get 'get name', 'get addr', 'get size' subcommand test. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()Marek Vasut
The 'fdt' command has a 'resize' subcommand, rename the fdt_test_resize() to fdt_test_addr_resize() to avoid confusion about what it is testing. There is currently no resize test. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-23trace: Relax test requirementsSimon Glass
We expect the profile and bootstage to agree on timing, but when running on slow machines there can be a larger descrepency. Increase the tolerance to fix this. Fixes: 9cea4797aeb ("trace: Add a test") Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-12reset: Allow reset_get_by_name() with NULL nameSamuel Holland
This allows devm_reset_control_get(dev, NULL) to work and get the first reset control, which is common in code ported from Linux. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20230122000252.53642-2-samuel@sholland.org
2023-02-12clk: Allow clk_get_by_name() with NULL nameSamuel Holland
This allows devm_clock_get(dev, NULL) to work and get the first clock, which is common in code ported from Linux. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20230122000252.53642-1-samuel@sholland.org
2023-02-11trace: Add a testSimon Glass
Add a test which runs sandbox, collects a trace and makes sure it can be processed by trace-cmd. This should ensure that this feature continues to work as U-Boot and trace-cmd evolve. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10dm: button: add support for linux_code in button-gpio.c driverDzmitry Sankouski
Linux event code must be used in input devices, using buttons. Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10test: create dedicated fdt node for ofnode_for_each_prop testDzmitry Sankouski
Property count may change in /buttons node, if more button tests added, and this will break ofnode_for_each_prop. Add separate node for mentioned test. Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-08test: lmb: Rework lib_test_lmb_max_regions test to scaleTom Rini
First, this test depends on CONFIG_LMB_USE_MAX_REGIONS, so add that as a test before building. Second, instead of using a hard-coded value of 8, which is the default of CONFIG_LMB_USE_MAX_REGIONS previously, use that directly and update the comments. The only trick here is that one part of the test itself also was written with the value of 8 itself in mind. Rework the size of the lmb region we allocate to scale with the value of CONFIG_LMB_USE_MAX_REGIONS. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-06cmd: Add a SEAMA image load commandLinus Walleij
Add a command to load SEAMA (Seattle Image), a NAND flash on-flash storage format. This type of flash image is found in some D-Link routers such as DIR-645, DIR-842, DIR-859, DIR-860L, DIR-885L, DIR890L and DCH-M225, as well as in WD and NEC routers on the ath79 (MIPS), Broadcom BCM53xx, and RAMIPS platforms. This U-Boot command will read and decode a SEAMA image from raw NAND flash on any platform. As it is always using big endian format for the data decoding is always necessary on platforms such as ARM. The command is needed to read a SEAMA-encoded boot image on the D-Link DIR-890L router for boot from NAND flash in an upcoming port of U-Boot to the Broadcom Northstar (BCM4709, BCM53xx) architecture. A basic test and documentation is added as well. The test must be run on a target with NAND flash support and at least one resident SEAMA image in flash. Cc: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2023-02-06arm: qemu: Move GUIDs to the C fileSimon Glass
These are only used in one place, so move them there. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06test: bootdev: Do not require USB to compile testLinus Walleij
This test will block compilation of the entire test suite on platforms without USB support. Make the extern "usb_started" conditional on USB host or gadget and define a dummy flag if neither is enabled. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-04test: dm: test-fdt: Add decode_panel_timing testNikhil M Jain
To test decode_panel_timing add a panel-timings node and a DM test for decode panel timingd by matching the panel timing node parameters. Signed-off-by: Nikhil M Jain <n-jain1@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-27test: Add test for mapping IOMMUs for PCI devicesMark Kettenis
Test that we correctly probe an IOMMU that is mapped by an "iommu-map" device tree property of a PCIe controller node. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-27test: Add test for IOMMU uclass map/unmap opsMark Kettenis
Test that the map and unmap operations work for devices that have DMA translated by an IOMMU and devices that don't have DMA translated by an IOMMU. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-27mkimage: fit: Support signed configurations in 'auto' FITsMassimo Pegorer
Extend support for signing in auto-generated (-f auto) FIT. Previously, it was possible to get signed 'images' subnodes in the FIT using options -g and -o together with -f auto. This patch allows signing 'configurations' subnodes instead of 'images' ones (which are hashed), using option -f auto-conf instead of -f auto. Adding also -K <dtb> and -r options, will add public key to <dtb> file with required = "conf" property. Summary: -f auto => FIT with crc32 images -f auto -g ... -o ... => FIT with signed images -f auto-conf -g ... -o ... => FIT with sha1 images and signed confs Example: FIT with kernel, two device tree files, and signed configurations; public key (needed to verify signatures) is added to u-boot.dtb with required = "conf" property. mkimage -f auto-conf -A arm -O linux -T kernel -C none -a 43e00000 \ -e 0 -d vmlinuz -b /path/to/first.dtb -b /path/to/second.dtb \ -k /folder/with/key-files -g keyname -o sha256,rsa4096 \ -K u-boot.dtb -r kernel.itb Example: Add public key with required = "conf" property to u-boot.dtb without needing to sign anything. This will also create a useless FIT named unused.itb. mkimage -f auto-conf -d /dev/null -k /folder/with/key-files \ -g keyname -o sha256,rsa4096 -K u-boot.dtb -r unused.itb Signed-off-by: Massimo Pegorer <massimo.pegorer@vimar.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-23bootstd: Record the bootdevs used during scanningSimon Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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 Glass
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")