summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-10-12test: lmb: Add test for coalescing and overlap rangeUdit Kumar
commit 4a6105e7830e9e945a6dc556a43ffaf26f0156e5 upstream. Add test case for an address range which is coalescing with one of range and overlapping with next range Cc: Simon Glass <sjg@google.com> Signed-off-by: Udit Kumar <u-kumar1@ti.com>
2023-05-25patman: Move library functions into a library directorySimon Glass
commit 4583c00236efd4ee768ff874f92526c229891a05 upstream The patman directory has a number of modules which are used by other tools in U-Boot. This makes it hard to package the tools using pypi since the common files must be copied along with the tool that uses them. To address this, move these files into a new u_boot_pylib library. This can be packaged separately and listed as a dependency of each tool. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
2023-04-12dm: test: Add a test for the various migration combinationsSimon Glass
Test that: - sandbox shows a warning when an unmigrated DT is used - sandbox fails to run when migration is turned off - sandbox_spl fails to build when migration is turned off Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2023-04-12test: Add a way to set the environment for a pytestSimon Glass
This is useful when we need to control a particular environment variable. Add a way to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2023-04-12dm: treewide: Complete migration to new driver model schemaSimon Glass
Update various build and test components to use the new schema. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2023-04-05test/py: android: extend abootimg testSafae Ouajih
commit 83d48a3c8bfbbbc2a8ad951b211081f72fc268b6 upstream. test_abootimg is extended to include the testing of boot images version 4. For this, boot.img and vendor_boot.img have been generated using mkbootimg tool with setting the header version to 4. This tests: - Getting the header version using abootimg - Extracting the load address of the dtb - Extracting the dtb start address in RAM Running test: $ ./test/py/test.py --bd sandbox --build -k test_abootimg Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
2023-03-28cli: Correct handling of invalid escape sequences in cread_line()Simon Glass
The second call to cli_ch_process() is in the wrong place, meaning that the one of the characters of an invalid escape sequence is swallowed instead of being returned. Fix the bug and add a test to cover this. This behaviour matches that of the code before cli_getch() was introduced. This was verified on the commit before b08e9d4b66 i.e.: 7d850f85aad ("sandbox: Enable mmc command and legacy images") Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-28cli: Correct several bugs in cli_getch()Simon Glass
This function does not behave as expected when unknown escape sequences are sent to it: - it fails to store (and thus echo) the last character of the invalid sequence - it fails to set esc_len to 0 when it finishes emitting the invalid sequence, meaning that the following character will appear to be part of a new escape sequence - it processes the first character of the rejected sequence as a valid character, just starting the sequence all over again The last two bugs conspire to produce an "impossible condition #876" message which is the main symptom of this behaviour. Fix these bugs and add a test to verify the behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-13test: unit test for crc8Heinrich Schuchardt
Add a unit test for the crc8() function. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt bootcpuMarek Vasut
Add 'fdt bootcpu' test which works as follows: - Create basic FDT, map it to sysmem - Print the FDT bootcpu - Set the FDT bootcpu and read the value back using 'fdt header get' - Perform the previous step twice to validate bootcpu overwrite The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt rmMarek Vasut
Add 'fdt rm' test which works as follows: - Create fuller FDT, map it to sysmem - Selectively delete nodes or properties by both path and aliases - Verify created nodes or properties using fdt print command The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt mknodeMarek Vasut
Add 'fdt mknode' test which works as follows: - Create fuller FDT, map it to sysmem - Create node either in / or subnode - Attempt to create node over existing node, which fails - Attempt to create subnodes in non-existing nodes or aliases - Verify created nodes using fdt list command The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt setMarek Vasut
Add 'fdt set' test which works as follows: - Create fuller FDT, map it to sysmem - Set either existing property to overwrite it, or new property - Test setting both single properties as well as string and integer arrays - Test setting to non-existent nodes and aliases - Verify set values using 'fdt get value' The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt get sizeMarek Vasut
Add 'fdt get size' test which works as follows: - Create fuller FDT, map it to sysmem - Get size of various properties - Get node count of available nodes - Test non-existent nodes and properties The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt get addrMarek Vasut
Add 'fdt get addr' test which works as follows: - Create fuller FDT, map it to sysmem - Get address of various properties - Compare addresses calculated by UT and fdt command This test is special in that it has to go through gruesome remapping scheme where the test calculates: - pointer offsets of the generated FDT root and the property being tested - map_sysmem() result of environment variable "fdtaddr" and the one set by the test matching address of property being tested - difference between the later and the former, to obtain offset of the DT property from start of DT The offsets must match in both the UT and the tested U-Boot, if they do not, the test fails. The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt get nameMarek Vasut
Add 'fdt get name' test which works as follows: - Create fuller FDT, map it to sysmem - Get name of / node 0, 1 and /clk-test node 0 - Compare output and validate the node name - Get name of / node 2 and /clk-test node 1 - Compare output and validate the node is not present - Get name of / node -1 and /clk-test node -1 - Compare output and validate the node name equals node 0 name - Check nonexistent node, verify the command errors out The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt resizeMarek Vasut
Add 'fdt resize' test which works as follows: - Create simple FDT with extra size 0, map it to sysmem - 'resize' the FDT by 0x2000 bytes - Verify the new space has been added to the FDT The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09test: cmd: fdt: Test fdt moveMarek Vasut
Add 'fdt move' test which works as follows: - Create simple FDT, map it to sysmem - 'move' the FDT into new zeroed out sysmem location - Verify newly active FDT is in the new location - Compare both locations The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
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>