diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-07 17:34:47 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-03-12 09:57:29 -0500 |
commit | 1c7217511cd9a050183402b56c0371e4f9720bea (patch) | |
tree | a10a801f4f98762bf3a89b9d3ff585e923c0db17 /include/test | |
parent | 409f4a2a7280abc6fe22447f7c1933fc5f669539 (diff) | |
download | u-boot-1c7217511cd9a050183402b56c0371e4f9720bea.zip u-boot-1c7217511cd9a050183402b56c0371e4f9720bea.tar.gz u-boot-1c7217511cd9a050183402b56c0371e4f9720bea.tar.bz2 |
test: Add an overall test runner
Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/test')
-rw-r--r-- | include/test/ut.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/test/ut.h b/include/test/ut.h index 17400c7..88e75ab 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -356,4 +356,46 @@ void ut_silence_console(struct unit_test_state *uts); */ void ut_unsilence_console(struct unit_test_state *uts); +/** + * ut_run_tests() - Run a set of tests + * + * This runs the tests, handling any preparation and clean-up needed. It prints + * the name of each test before running it. + * + * @uts: Test state to update. The caller should ensure that this is zeroed for + * the first call to this function. On exit, @uts->fail_count is + * incremented by the number of failures (0, one hopes) + * @prefix: String prefix for the tests. Any tests that have this prefix will be + * printed without the prefix, so that it is easier to see the unique part + * of the test name. If NULL, no prefix processing is done + * @tests: List of tests to run + * @count: Number of tests to run + * @select_name: Name of a single test to run (from the list provided). If NULL + * then all tests are run + * @return 0 if all tests passed, -ENOENT if test @select_name was not found, + * -EBADF if any failed + */ +int ut_run_tests(struct unit_test_state *uts, const char *prefix, + struct unit_test *tests, int count, const char *select_name); + +/** + * ut_run_tests() - Run a set of tests + * + * This runs the test, handling any preparation and clean-up needed. It prints + * the name of each test before running it. + * + * @category: Category of these tests. This is a string printed at the start to + * announce the the number of tests + * @prefix: String prefix for the tests. Any tests that have this prefix will be + * printed without the prefix, so that it is easier to see the unique part + * of the test name. If NULL, no prefix processing is done + * @tests: List of tests to run + * @count: Number of tests to run + * @select_name: Name of a single test to run (from the list provided). If NULL + * then all tests are run + * @return 0 if all tests passed, -1 if any failed + */ +int ut_run_list(const char *name, const char *prefix, struct unit_test *tests, + int count, const char *select_name); + #endif |