summaryrefslogtreecommitdiffstats
path: root/test/cmd_ut.c
Commit message (Collapse)AuthorAgeFilesLines
* test: inconsistent string testsHeinrich Schuchardt2021-01-291-2/+1
| | | | | | | | | | | | | Excluding ut str in test/cmd_ut.c but compiling test/str_ut.c results in failure of the Python test invoking the C unit tests as observed on sipeed_riscv_smode_defconfig: FAILED test/py/tests/test_ut.py::test_ut[ut_str_upper] Allow to compile test/str_ut.c on all boards. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* bootm: Add tests for fixup_silent_linux()Simon Glass2020-12-041-0/+1
| | | | | | | | This function currently has no tests. Export it so that we can implement a simple test on sandbox. Use IS_ENABLED() to remove the unused code, instead #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add some tests for setexprSimon Glass2020-12-011-0/+3
| | | | | | | | | | | This command currently has no tests. Add some for basic assignment and the integer operations. Note that the default size for setexpr is ulong, which varies depending on the build machine. So for sandbox on a 64-bit host, this means that the default size is 64 bits. Signed-off-by: Simon Glass <sjg@chromium.org>
* cmd: Update the memory-search commandSimon Glass2020-08-071-0/+2
| | | | | | | | | | | | | | Add various fixes and improvements to this command that were missed in the original version. Unfortunately I forgot to send v2. - Fix Kconfig name - Use a separate variable for the remaining search length - Correct a minor bug - Move into a separate test suite - Add -q flag to the 'quiet' test to test operation when console is enabled - Enable the feature for sandbox Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add a flag for tests that need console recordingSimon Glass2020-08-071-0/+10
| | | | | | | Allow tests that need console recording to be marked, so they can be skipped if it is not available. Signed-off-by: Simon Glass <sjg@chromium.org>
* command: Remove the cmd_tbl_t typedefSimon Glass2020-05-181-6/+8
| | | | | | | | | | | | | We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add the beginnings of some string testsSimon Glass2020-04-241-0/+5
| | | | | | | There are quite a few string functions in U-Boot with no tests. Make a start by adding a test for strtoul(). Signed-off-by: Simon Glass <sjg@chromium.org>
* test: log functions with CONFIG_LOG=nHeinrich Schuchardt2020-04-161-0/+6
| | | | | | | | | | | | | | | | | | | If CONFIG_LOG=n, we still expect output for log_err(), log_warning(), log_notice(), log_info() and in case of DEBUG=1 also for log_debug(). Provide unit tests verifying this. The tests depend on: CONFIG_CONSOLE_RECORD=y CONFIG_LOG=n CONFIG_UT_LOG=y It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to accommodate CONFIG_CONSOLE_RECORD=y. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test/cmd_ut.c: fix cmd_ut_categoryPhilippe Reynes2020-01-101-1/+1
| | | | | | | | | | | | | | | | In the function cmd_ut_category, the prefix is used with the function strncmp to know if the prefix should be removed from the test name, even if the prefix is NULL. To avoid this issue, we consider that a prefix NULL mean no prefix. So we only try to remove the prefix from the test_name if the prefix is not NULL, then we avoid to call the function strncmp with a NULL prefix. Reported-by: Coverity CID 281110 Fixes: 4ad4edfe ("cmd_ut: add a parameter prefix to the function cmd_ut_category") Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
* cmd_ut: add a parameter prefix to the function cmd_ut_categoryPhilippe Reynes2020-01-071-2/+10
| | | | | | | | | | | | | | | | | | | | There is black magic in the file conftest.py that list all the test unit. Then, all those test unit are called in pytest. This call is done with the end of the name (for example checksum if the full name is bloblist_test_checksum). The result is that only test for dm are really executed. by pytest, all others tests are listed but never executed. This behaviour happens because the dm test unit only check the end of the name and others tests checks the full name. To fix this issue, I've added a prefix to the function cmd_ut_category, and this prefix is removed when looking for the unit test. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* tests: add OP-TEE test suiteHeiko Stuebner2019-11-141-0/+6
| | | | | | | | | | | | | | OP-TEE can get supplied with a devicetree and will then insert its firmware node and reserved-memory sections into it. As this devicetree often is not the one supplied to a later loaded kernel, a previous commit added functionality to transfer these nodes onto that new devicetree. To make sure this functionality stays intact, also add a test for the transfer functionality. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: provide unit test for memory functionsHeinrich Schuchardt2019-02-091-0/+6
| | | | | | | | | | | | Memory functions may have architecture specific implementations. These should be tested. Provide unit tests for memset(), memcpy(), memmove(). Provide a 'ut lib' sub-command to execute the tests. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Add a simple test for bloblistSimon Glass2018-11-261-0/+3
| | | | | | | Add a unit test for the bloblist functionality and enable bloblist for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: unit tests for Unicode functionsHeinrich Schuchardt2018-09-231-3/+10
| | | | | | | Provide unit tests for Unicode functions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* test: compression: Convert to unit test frameworkSimon Glass2017-12-041-0/+7
| | | | | | | | | | | Adjust this test to use the unit test framework. Drop the two existing commands for running the tests and replace them with a single 'ut compression' command, with sub-commands. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Continue to have ret = run_test_internal(...) in run_test so ret is always initialized] Signed-off-by: Tom Rini <trini@konsulko.com>
* test: Add a command function for test executionSimon Glass2017-12-021-0/+25
| | | | | | | | The logic to either iterate through a list of tests or pick a named test is common to at lest two test suits. Move this logic into a new function and call it from the environment tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* tests: Introduce DT overlay testsMaxime Ripard2016-08-201-0/+6
| | | | | | | | | | | | This adds a bunch of unit tests for the "fdt apply" command. They've all been run successfully in the sandbox. However, as you still require an out-of-tree dtc with overlay support, this is disabled by default. Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* test: env: Add test framework for envJoe Hershberger2015-05-211-0/+6
| | | | | | | | | | Add a new "env" subcommand to the ut command. This will run unit tests on the env code. This should be targetable to any device that supports the env features needed for the tests. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: Move the time test over to the ut commandJoe Hershberger2015-05-211-0/+6
| | | | | | | Unify the command for running unit tests further by moving the "ut_time" command over to "ut time". Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* test: dm: Move the dm tests over to the ut commandJoe Hershberger2015-05-211-0/+6
| | | | | | | | Unify the command for running unit tests further by moving the "dm test" command over to "ut dm". Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: Add a common unit test commandJoe Hershberger2015-05-211-0/+62
Add a command that all other unit tests should be a sub-command of. Also include a command that will run all tests. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>