summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-10-11Merge tag 'xilinx-for-v2023.01-rc1-v3' of ↵Tom Rini2-0/+21
https://source.denx.de/u-boot/custodians/u-boot-microblaze Xilinx changes for v2023.01-rc1 (round 3) fpga: - Create new uclass - Get rid of FPGA_DEBUG and use logging infrastructure zynq: - Enable early EEPROM decoding - Some DT updates zynqmp: - Use OCM_BANK_0 to check config loading permission - Change config object loading in SPL - Some DT updates net: - emaclite: Enable driver for RISC-V xilinx: - Fix static checker warnings - Fix GCC12 warning sdhci: - Read PD id from DT
2022-10-06test: fix some pylint errors in test_efi_secbootHeinrich Schuchardt1-9/+3
* Remove unused import * Provide module docstring Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-05dm: fpga: Introduce new uclassAlexander Dahl2-0/+21
For future DM based FPGA drivers and for now to have a meaningful logging class for old FPGA drivers. Suggested-by: Michal Simek <michal.simek@amd.com> Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Dahl <post@lespocky.de> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20220930120430.42307-2-post@lespocky.de Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-09-30dm: core: Support copying properties with ofnodeSimon Glass1-0/+59
Add a function to copy properties from one node to another. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Allow copying ofnode property data when writingSimon Glass1-1/+61
At present ofnode_write_prop() is inconsistent between livetree and flattree, in that livetree requires the caller to ensure the property value is stable (e.g. in rodata or allocated) but flattree does not, since it makes a copy. This makes the API call a bit painful to use, since the caller must do different things depending on OF_LIVE. Add a new 'copy' argument which tells the function to make a copy if needed. Add some tests to cover this behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30vbe: Allow test to run with live/flat treeSimon Glass1-14/+9
This test can operate in all conditions now. Update the test and comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Expand ofnode testsSimon Glass1-17/+212
The current tests do not cover all functions, nor do they cover the new multi-tree functionality. Add and update the tests accordingly and update the 'future work' notes in the documentation. There is a still more testing needed for the failure cases, since at present some ofnode functions return a libfdt error code instead of converting it to an errno. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Create a function to get a live tree in a testSimon Glass1-8/+49
Move this logic out of the test into separate functions, so we can use it in other tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Complete phandle implementation using the other FDTSimon Glass1-0/+80
We need to be able to look up phandles in any FDT, not just the control FDT. Use the 'other' FDT to test this, with a helper function which gets this as an oftree that can then we used as needed. Add a few more tests and some comments at the top of the file, to explain what is going on. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Split ofnode_path_root() into two functionsSimon Glass2-4/+4
This function turns out to be a little confusing since it looks up a path and also registers the tree. Split it into two, one that gets the root node and one that looks up a path, so the purpose is clear. Registering the tree will happen in a function to be added in a later patch, called oftree_from_fdt(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Add a way to look up a phandle in an oftreeSimon Glass1-0/+2
When we have multiple trees, the ofnode logic needs to be told which one to use. Create a new function which takes an oftree argument, along with a helper to obtain the FDT pointer from an oftree. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Add ofnode functions to obtain an oftreeSimon Glass1-2/+5
At present dm_test_ofnode_root() does this manually. Add some inline functions to handle it, so this code can be centralised. Add oftree functions to produce a null tree and to check whether a tree is valid or not. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Provide a way to reset the device treeSimon Glass1-0/+2
At present there is only one device tree used by the ofnode functions, except for some esoteric use of live tree. In preparation for supporting more than one, add a way to reset the list of device trees. For now this does nothing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-30dm: core: Expand integer-reading testsSimon Glass1-0/+102
The current tests do not cover all the behaviour. Add some more. Tidy up a few inconsistencies between livetree and flattree which come to light with these tests. Also drop the -ENODATA error since it is never actually returned. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Add a macro to iterate through propertiesSimon Glass1-0/+24
Add a 'for_each' macro like we have for nodes. Fix the comment for struct ofprop while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Rename ofnode_get_property_by_prop()Simon Glass1-4/+3
The current name is quite unwieldy. Change it to use an ofprop_ prefix and shorten it. Fix the return-value comment while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Rename ofnode_get_first/next_property()Simon Glass1-2/+2
Drop the 'get' in these names since it does not fit with the rest of the API. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29sandbox: test: Provide an easy way to use the other FDTSimon Glass1-3/+36
Add a test flag which indicates that the 'other' FDT should be set up ready for use. Handle this by copying in the FDT, unflattening it for livetree tests. Free the structures when the tests have run. We cannot use the other FDT unless we are using live tree or OFNODE_MULTI_TREE is enabled, since only one tree is supported by the ofnode interface in that case. Add this condition into ut_run_test_live_flat() and update the comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Drop the UT_TESTF_LIVE_OR_FLAT flagSimon Glass1-13/+3
This was a workaround for a rare situation. Now that it will be more common and we have a proper fix, drop the flag. We can run both types of tests in the same sandbox executable, even if the flat device tree is modified. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Detect a change in the device treeSimon Glass1-3/+16
If the device tree changes during a test and we cannot restore it, mark it as such so that future tests which need the live tree are skipped. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29test: Make a copy of the device tree before running a testSimon Glass1-0/+74
When the flat device tree changes it can mess up the live tree since that uses the flat tree for its strings. This affects only a few sandbox tests which modify the device tree, but the number will grow as ofnode support for writing improves. While the control FDT is not intended to change while U-Boot is running, some tests do so. For example, the ofnode interface only supports modifying properties in the control FDT, so tests must use that. To solve this problem, keep a copy of the FDT and restore it as needed when the test is finished. The copy only happens on sandbox (except SPL builds), to reduce memory usage and because these tests are not useful on other boards. For other boards, a checksum is taken to ensure that nothing changes. It would be possible to always checksum the FDT on sandbox and only restore it if needed, but this is slightly slower than restoring it every time, at least with crc8. Move the code which checks for success to the very end, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Support writing a property to an empty nodeSimon Glass1-0/+3
At present this does not work with livetree. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29dm: core: Allow adding ofnode subnodesSimon Glass1-0/+71
Add this feature to the ofnode interface, supporting both livetree and flattree. If the node exists it is returned, along with a -EEXIST error. Update the functions it calls to handle this too. Signed-off-by: Simon Glass <sjg@chromium.org>
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 ↵Tom 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 testStefan 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-13Makefile: 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-13test/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-13test/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-13test: 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-13test: 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-13test: 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-13test: 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-13test: 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-13test: 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>