aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* efi_driver: create a parent device for all EFI block devicesHeinrich Schuchardt5 days1-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to now root has been the parent device for all block devices created via calling ConnectController(). This does not work well together with the implementation of bootstd. Add a dummy parent device for all EFI block devices. With this change EFI block devices are also accessible via commands like 'cat', 'load', and 'ls'. => dm tree Class Seq Probed Driver Name ----------------------------------------------------------- efi 0 [ + ] EFI block driver `-- efi blk 3 [ + ] efi_blk `-- efi.efiblk#0 partition 0 [ + ] blk_partition `-- efi.efiblk#0:1 => ls efiloader 0:1 13 hello.txt 7 u-boot.txt 2 file(s), 0 dir(s) => cat efiloader 0:1 hello.txt Hello world! => efidebug dh 0000000018df1700 (efi.efiblk#0:1) /VenHw(dbca4c98-6cb0-694d-0872-819c650cb7b8)/HD(1,MBR,0xd1535d21,0x1,0x7f) Block IO Simple File System Adjust the event dump unit test to consider the new event spy. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* test: unit tests for strstr() and strnstr()Heinrich Schuchardt12 days1-0/+40
| | | | | | | | | Add unit tests for the library functions. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> [jf: drop unwanted change to lib/string.c] Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
* test/py: usb: Fix format string for fstype commandAndrew Goodbody2025-02-101-1/+1
| | | | | | | | | | | | | | | | USB tests on ext partitions can fail with the following output test/py/tests/test_usb.py:245: in test_usb_part 'fstype usb %d:%d' % i, part_id E TypeError: not enough arguments for format string So add brackets around the format string arguments to prevent the error. Fixes: a730947974e3 ("test/py: usb: Distinguish b/w ext2/ext4 partitions") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Love Kumar <love.kumar@amd.com>
* Merge patch series "cmd/setexpr: support concatenation of direct strings"WIP/07Feb2025Tom Rini2025-02-071-39/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: The setexpr.s command allows to concatenate two strings. According to the description in doc/usage/cmd/setexpr.rst the parameters value1 and value2 can be either direct values or pointers to a memory location holding the values. Unfortunately `setexpr.s <value1> + <value2>` fails if any of the values is a direct value. $? is set to false. * Add support for direct values in setexpr.s. * Correct the unit test for "setexpr.s fred 0". * Add a new unit test for "setexpr.s fred '1' + '3'" giving '13'. * Remove invalid memory leak tests Link: https://lore.kernel.org/r/20250203151029.60265-1-heinrich.schuchardt@canonical.com
| * cmd/setexpr: support concatenation of direct stringsHeinrich Schuchardt2025-02-071-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The setexpr.s command allows to concatenate two strings. According to the description in doc/usage/cmd/setexpr.rst the parameters value1 and value2 can be either direct values or pointers to a memory location holding the values. Unfortunately `setexpr.s <value1> + <value2>` fails if any of the values is a direct value. $? is set to false. * Add support for direct values in setexpr.s. * Correct the unit test for "setexpr.s fred 0". * Add a new unit test for "setexpr.s fred '1' + '3'" giving '13'. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
| * test: remove available memory check in setexpr_test_str_oper()Heinrich Schuchardt2025-02-071-24/+0
| | | | | | | | | | | | | | | | env_set() frees the previous value after allocating the new value. As the free() may merge memory chunks the available memory is not expected to stay constant. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
| * test: remove available memory check in setexpr_test_str()Heinrich Schuchardt2025-02-071-13/+0
| | | | | | | | | | | | | | | | env_set() frees the previous value after allocating the new value. As the free() may merge memory chunks the available memory is not expected to stay constant. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
| * test: clean up setexpr_test_str()Heinrich Schuchardt2025-02-071-1/+1
| | | | | | | | | | | | Assign variable buf in the sub-test where it is used. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* | Merge patch series "led: add function naming option from linux"Tom Rini2025-02-072-2/+22
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Heiko Schocher <hs@denx.de> says: In linux we have the option to create the name of a led optionally through the following properties: - function - color - function-enumerator This series adds support for parsing this properties if there is no label property. Link: https://lore.kernel.org/r/20250128135246.74838-1-hs@denx.de [trini: Document name parameter in led.h]
| * led: add function naming option from linuxHeiko Schocher2025-02-072-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in linux we have the option to create the name of a led optionally through the following properties: - function - color - function-enumerator This patch adds support for parsing this properties if there is no label property. The led name is created in led_post_bind() and we need some storage place for it. Currently this patch prevents to use malloc() instead it stores the name in new member : char name[LED_MAX_NAME_SIZE]; of struct led_uc_plat. While at it append led tests for the new feature. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
* | test/py: Add a report show test durationsSimon Glass2025-01-301-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Execution time varies widely with the existing tests. Provides a way to produce a summary of the time taken for each test, along with a histogram. This is enabled with the --timing flag. Enable it for sandbox in CI. Example: Duration : Number of tests ======== : ======================================== <1ms : 1 <8ms : 1 <20ms : # 20 <30ms : ######## 127 <50ms : ######################################## 582 <75ms : ####### 102 <100ms : ## 39 <200ms : ##### 86 <300ms : # 29 <500ms : ## 42 <750ms : # 16 <1.0s : # 15 <2.0s : # 23 <3.0s : 13 <5.0s : 9 <7.5s : 1 <10.0s : 6 <20.0s : 12 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | bloblist: add api to get blob with sizeRaymond Mao2025-01-281-0/+4
|/ | | | | | | | | | | | | | bloblist_find function only returns the pointer of blob data, which is fine for those self-describing data like FDT. But as a common scenario, an interface is needed to retrieve both the pointer and the size of the blob data. Add a few ut test cases for the new api. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* test/cmd/wget.c: Fix loadaddr rewriteMarek Vasut2025-01-271-5/+3
| | | | | | | | | | | | | The $loadaddr variable is a hexadecimal value, not a string, it must be assigned using env_set_hex(). This may break follow up tests, like the dm_test_cmd_hash_md5 in CI. To avoid any interference with other tests, set $wgetaddr variable which is specific to this test and use it in the test. Fixes: 20f641987f83 ("test/cmd/wget.c: move net_test_wget() to the cmd test suite") Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Fabio Estevam <festevam@gmail.com>
* test/log: test function filtersHeinrich Schuchardt2025-01-261-12/+56
| | | | | | Add unit tests for function filters. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* log: enable filtering on functionsHeinrich Schuchardt2025-01-262-6/+5
| | | | | | | Up to now we could only use log level, category, and file for filtering. Allow filtering on a list of functions. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* test/py: Handle u-boot-test-getrole failureSimon Glass2025-01-251-2/+3
| | | | | | | | | This script can fail if there is no toolchain available for the board. At present this is not handled very nicely, in that only the error output is reported. It is much more useful to see everything, so combine stdout and stderr and report them both. Signed-off-by: Simon Glass <sjg@chromium.org>
* test/py: Provide the correct U_BOOT_SOURCE_DIR to getroleSimon Glass2025-01-251-0/+4
| | | | | | | | | | | | | | | | | | | | | The u-boot-test-getrole script runs before the normal environment variables have been set up. This is unavoidable since the script is providing necessary information to test.py This means that U_BOOT_SOURCE_DIR is not set in the environment. As a result, Labgrid uses its default source path, configured in its environment variable. While this may happen to work, it is not correct. Also, it causes problems when running from Gitlab, where the runner may not have access to that source path. Provide the required source path in U_BOOT_SOURCE_DIR so that Labgrid does the right thing. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: bf89a8f1fc2 ("test: Introduce the concept of a role") [1] https://patchwork.ozlabs.org/project/uboot/patch/20241211131858.520639-1-sjg@chromium.org/
* Merge patch series "test: Improvements to ut command and test-suite running"Tom Rini2025-01-2448-519/+533
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simon Glass <sjg@chromium.org> says: The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand. This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them. This series adds a list of test suites, so that these subcommands can be removed. An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests. To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run. Future work may: - get 'ut all' passing - enable test_suite() in CL, to ensure that 'ut all' keeps passing - record duration of each suite - allow running the tests in random order to tease out dependencies - tweak the output to remove common prefixes - getting rid of bootstd, optee and seame 'ut' subcommands Link: https://lore.kernel.org/r/20250120212613.516664-1-sjg@chromium.org
| * test: Move help into the suite declarationSimon Glass2025-01-241-85/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | Rather than having the help in the longhelp, put it in the suite info so 'ut info -s' can show it. This is tidier, particular due to the removal of #ifdefs This means that the help text is present in the image (although not displayed with 'ut info -s') so the image-size increases. But with UNIT_TEST enabled, we expect large images so this doesn't seem important. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Disable test_suiteSimon Glass2025-01-241-1/+2
| | | | | | | | | | | | This fails at present, so disable it until it can pass. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Sort the test suitesSimon Glass2025-01-241-20/+20
| | | | | | | | | | | | | | Put the suites in order by name, for easier code-maintenance. This also helps find test results for a particular swuit in the 'ut all' output. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Record and show the totals for all test runsSimon Glass2025-01-242-0/+8
| | | | | | | | | | | | | | With 'ut all' multiple test suites are run. Add a way to collect totals and show them at the end. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Move stat-printing into its own functionSimon Glass2025-01-246-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | Add a function to show the stats, so we can decide when to print it. This slightly adjusts the output, so that any 'test not found' message appears on its own line after all other output. The 'failures' message now appears in lower case so update pytest accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Keep a track of the numbers of tests runSimon Glass2025-01-241-0/+2
| | | | | | | | | | | | | | This is useful information and is not always the same as the 'count' arg to ut_run_list() so add it as a separate stat. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Move stats into a structSimon Glass2025-01-242-16/+17
| | | | | | | | | | | | | | Use a struct to hold the stats, since we also want to have the same stats for all runs as we have for each suite. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Pass the test state to cmd_ut_category()Simon Glass2025-01-243-28/+26
| | | | | | | | | | | | | | Update this function to access a unit-test state, so that the caller can collect results from running multiple suites. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop conditional compilation for suitesSimon Glass2025-01-242-47/+45
| | | | | | | | | | | | | | | | | | | | | | | | This is not needed anymore. If a test suite is not built, then it will have no linker-list entries. So we can just check for that and know that the suite is not present. This allows removal of the #ifdefs and the need to keep them in sync with the associated Makefile rules, which has actually failed, since the help does not match what commands are actually present. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the info test from the listSimon Glass2025-01-242-11/+6
| | | | | | | | | | | | | | The 'info' test is not a real test. With the new suite array we can drop this and the associated special-case code. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running upl testsSimon Glass2025-01-242-9/+1
| | | | | | | | | | | | | | | | | | Use the new suite-runner to run these tests instead. It is not clear that these actually work, since they are not enabled on sandbox for some reason. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running seama testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | | | | | | | | | Use the new suite-runner to run these tests instead. It is not clear that these actually work, since they are not enabled on sandbox for some reason. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
| * test: Drop the function for running pci_mps testsSimon Glass2025-01-242-11/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running loadm testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running hush testsSimon Glass2025-01-243-21/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running addrmap testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running bootm testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running bloblist testsSimon Glass2025-01-242-11/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running measurement testsSimon Glass2025-01-242-11/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running setexpr testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running mem testsSimon Glass2025-01-243-21/+2
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running mbr testsSimon Glass2025-01-242-9/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running log testsSimon Glass2025-01-243-23/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running lib testsSimon Glass2025-01-243-21/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running font testsSimon Glass2025-01-242-9/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running fdt testsSimon Glass2025-01-242-9/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running exit testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running env testsSimon Glass2025-01-242-10/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running dm testsSimon Glass2025-01-243-18/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running common testsSimon Glass2025-01-243-23/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running cmd testsSimon Glass2025-01-243-23/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
| * test: Drop the function for running bdinfo testsSimon Glass2025-01-242-9/+1
| | | | | | | | | | | | Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>