summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-01-20 14:25:33 -0700
committerTom Rini <[email protected]>2025-01-24 14:34:40 -0600
commit7bbf2f7983c9ba5b8588ed86777b4b0b21eb542a (patch)
treed66aad3be49ebd7492a4744b57db2dddc32ff466 /include
parent4ba3ab4901c564725c37e927e2ba29595712cd9d (diff)
test: Introduce a better array of test suites
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 <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/test/suites.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/test/suites.h b/include/test/suites.h
index e40ad634702..c1119e44999 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -10,6 +10,10 @@
struct cmd_tbl;
struct unit_test;
+/* 'command' functions normally called do_xxx where xxx is the command name */
+typedef int (*ut_cmd_func)(struct cmd_tbl *cmd, int flags, int argc,
+ char *const argv[]);
+
/**
* cmd_ut_category() - Run a category of unit tests
*