[PATCH 10/17] test: Allow showing basic information about tests
Simon Glass
sjg at chromium.org
Sun Oct 30 02:47:12 CET 2022
Add a 'ut info' command to show the number of suites and tests. This is
useful to get a feel for the scale of the tests.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
doc/usage/cmd/ut.rst | 6 ++++++
test/cmd_ut.c | 16 +++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/doc/usage/cmd/ut.rst b/doc/usage/cmd/ut.rst
index 9f602ea7917..11c64a17793 100644
--- a/doc/usage/cmd/ut.rst
+++ b/doc/usage/cmd/ut.rst
@@ -100,3 +100,9 @@ Run just a single test in a suite::
=> ut bloblist bloblist_test_grow
Test: bloblist_test_grow: bloblist.c
Failures: 0
+
+Show information about tests::
+
+ => ut info
+ Test suites: 21
+ Total tests: 642
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index 81433cd36f4..b61ce79311c 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -14,6 +14,9 @@
static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
+static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
+
int cmd_ut_category(const char *name, const char *prefix,
struct unit_test *tests, int n_ents,
int argc, char *const argv[])
@@ -45,6 +48,7 @@ int cmd_ut_category(const char *name, const char *prefix,
static struct cmd_tbl cmd_ut_sub[] = {
U_BOOT_CMD_MKENT(all, CONFIG_SYS_MAXARGS, 1, do_ut_all, "", ""),
+ U_BOOT_CMD_MKENT(info, 1, 1, do_ut_info, "", ""),
#ifdef CONFIG_BOOTSTD
U_BOOT_CMD_MKENT(bootstd, CONFIG_SYS_MAXARGS, 1, do_ut_bootstd,
"", ""),
@@ -116,6 +120,15 @@ static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,
return any_fail;
}
+static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ printf("Test suites: %d\n", (int)ARRAY_SIZE(cmd_ut_sub));
+ printf("Total tests: %d\n", (int)UNIT_TEST_ALL_COUNT());
+
+ return 0;
+}
+
static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct cmd_tbl *cp;
@@ -142,8 +155,9 @@ static char ut_help_text[] =
" -f Force 'manual' tests to run as well\n"
" <suite> Test suite to run, or all\n"
"\n"
- "Suites:"
+ "\nOptions for <suite>:"
"\nall - execute all enabled tests"
+ "\ninfo - show info about tests"
#ifdef CONFIG_CMD_ADDRMAP
"\naddrmap - very basic test of addrmap command"
#endif
--
2.38.1.273.g43a17bfeac-goog
More information about the U-Boot
mailing list