summaryrefslogtreecommitdiff
path: root/test/cmd_ut.c
AgeCommit message (Collapse)Author
2025-02-11test: Update documentationSimon Glass
Update documentation for how to write tests and the 'ut' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Do flag-processing in the correct placeSimon Glass
At present the 'ut' command handles its flags in a strange way, in that they must come after the subcommand. So, we must use 'ut bloblist -r2' to run the bloblist tests twice. This is an artefact of the way tests were run, through subcommands. It is now possible to correct this, by doing flag-processing before running the suite. Update the code to handle this, so that 'ut -r2 bloblist' works. Update the 'test_suite' test to check the new arguments. Add a sanity-check for -I while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Move code out of cmd_ut_category()Simon Glass
Move the logic from this function into run_suite(), on the way to having flag parsing in the top-level 'ut' command instead of its children. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Allow running a selection of suitesSimon Glass
Enhance the ut command to accept a comma-separated list of test suites to run. Report the summary information for these at the end. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop suites.hSimon Glass
This file is empty now. Remove it and its uses. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Make cmd_ut_category() staticSimon Glass
This function is not used outside the cmd_ut file anymore, so make it static. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop support for test commandsSimon Glass
Now that everything is using the new test-suite features, drop support for running commands. Fix a missing closing-bracket while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop the function for running optee testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop the function for running bootstd testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop the function for running fdt_overlay testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Tweak FDT-overlay testsSimon Glass
Use fdt_overlay consistently in the identifiers and file/dir names. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Leave out the prefix when printing test namesSimon Glass
When tests are all in the same suite it is annoying to have to read all the common text after each name. Skip this to help the user. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Show the average time per testSimon Glass
Show the average duration of a test, so we can keep track of how it is trending. Report the suite with the longest average test to encourage people to improve it. Add a function to update the stats based on the results from a single suite and another to show the summary information. Make this optional, since sandbox's SPL tests do not have a timer driver and people may want to print results without times. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Add up the number of tests manuallySimon Glass
All tests should belong to a suite, but if there is a suite we don't know about (e.g. not added to cmd_ut.c) then the totals will not add up. Add a check for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Move help into the suite declarationSimon Glass
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>
2025-01-24test: Sort the test suitesSimon Glass
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>
2025-01-24test: Record and show the totals for all test runsSimon Glass
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>
2025-01-24test: Pass the test state to cmd_ut_category()Simon Glass
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>
2025-01-24test: Drop conditional compilation for suitesSimon Glass
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>
2025-01-24test: Drop the info test from the listSimon Glass
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>
2025-01-24test: Drop the function for running upl testsSimon Glass
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>
2025-01-24test: Drop the function for running seama testsSimon Glass
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>
2025-01-24test: Drop the function for running pci_mps testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running loadm testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running hush testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running addrmap testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running bootm testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running bloblist testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running measurement testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running setexpr testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running mem testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running mbr testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running log testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running lib testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running font testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running fdt testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running exit testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running env testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running dm testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running common testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running cmd testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Drop the function for running bdinfo testsSimon Glass
Use the new suite-runner to run these tests instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Introduce a better array of test suitesSimon Glass
The current cmd_ut_sub[] array was fine when there were only a few test suites. But is quite unwieldy now: - it requires a separate do_ut_xxx for each suite, even though the code for most is almost identical - running more than one suite requires running multiple commands, and there is no record of which suites passed or failed - 'ut all' runs all suites but reports their results individually - we need lots of #ifdefs in the array, mirroring those in the makefile but maintained in a separate place In fact the tests are all in the same linker list. The suites are grouped, so it is possible to access the information without a command. Introduce a 'suite' array, which holds the cmd_ut_...() function to call, but can also support running a suite without that function. This means that the array of struct cmd_tbl is transformed into an array of 'struct suite'. This will allow removal of many of the functions, particularly those without test-specific init. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test/py: Add a test which runs all unit testsSimon Glass
Add a Python test which runs 'ut all' and then checks that the expected suites are present and all tests in each suite are run. This can help to check that nothing is missing. Update 'ut info' to ignore the 'all' suite when counting the number of suites, since that is really just a combination of all the other suites. Adjust the message for skipped tests so that appears even if no particular test was selected. This helps the new 'test_suite' test see what is going on. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Update ut info to show suitesSimon Glass
It is helpful to see a list of available suites. At present this is handled by the longhelp for the 'ut' command, but this is not in a format which can be easily parsed by python tests. Add a -s option to show this. At present it is not possible to show the number of tests in each suite, but future work will address this. For now, show a ? Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24test: Pass the test-state into ut_run_list()Simon Glass
Pass this into the function so that callers can inspect the state afterwards. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-18test: sandbox: fix link error with do_ut_bootm if BLOBLIST=nEvgeny Bachinin
Having CONFIG_OF_EMBED=y && CONFIG_BLOBLIST=n leads to the link error: ``` ld: /tmp/ccwtRVty.ltrans28.ltrans.o:(.data.rel+0x4e8): undefined \ reference to `do_ut_bootm' ``` Fixes: fe158657a5b ("test: inconsistent bootm tests") Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
2024-12-18test: sandbox: fix link error with do_ut_bloblist if BLOBLIST=nEvgeny Bachinin
Having CONFIG_OF_EMBED=y && CONFIG_BLOBLIST=n leads to the link error: ``` ld: /tmp/ccwtRVty.ltrans28.ltrans.o:(.data.rel+0x4b0): undefined \ reference to `do_ut_bloblist' ``` Fixes: 6ea5df39e8d ("test: Only enable bloblist test when supported") Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Move time tests into the lib suiteSimon Glass
There is no particular need for the time tests to have their own test command. Move them into the lib suite instead. Update the test functions to match the normal unit-test signature. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk
2024-11-13test: Move unicode tests into the lib suiteSimon Glass
There is no particular need for the unicode tests to have their own test suite. Move them into the lib suite instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Tom Rini <trini@konsulko.com> # rpi_3, rpi_4, rpi_arm64, am64x_evm_a53, am64-sk