aboutsummaryrefslogtreecommitdiff
path: root/test/cmd_ut.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/cmd_ut.c')
-rw-r--r--test/cmd_ut.c82
1 files changed, 54 insertions, 28 deletions
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index beebd5ce38..2736582f11 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -14,10 +14,14 @@
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[])
{
+ const char *test_insert = NULL;
int runs_per_text = 1;
bool force_run = false;
int ret;
@@ -32,19 +36,24 @@ int cmd_ut_category(const char *name, const char *prefix,
case 'f':
force_run = true;
break;
+ case 'I':
+ test_insert = str + 2;
+ break;
}
argv++;
- argc++;
+ argc--;
}
ret = ut_run_list(name, prefix, tests, n_ents,
- argc > 1 ? argv[1] : NULL, runs_per_text, force_run);
+ argc > 1 ? argv[1] : NULL, runs_per_text, force_run,
+ test_insert);
return ret ? CMD_RET_FAILURE : 0;
}
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,
"", ""),
@@ -119,6 +128,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;
@@ -140,59 +158,67 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
#ifdef CONFIG_SYS_LONGHELP
static char ut_help_text[] =
- "all - execute all enabled tests\n"
+ "[-r] [-f] [<suite>] - run unit tests\n"
+ " -r<runs> Number of times to run each test\n"
+ " -f Force 'manual' tests to run as well\n"
+ " <suite> Test suite to run, or all\n"
+ "\n"
+ "\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
#ifdef CONFIG_SANDBOX
- "ut bloblist - Test bloblist implementation\n"
- "ut compression - Test compressors and bootm decompression\n"
+ "\nbloblist - bloblist implementation"
#endif
#ifdef CONFIG_BOOTSTD
- "ut bootstd - Test standard boot implementation\n"
+ "\nbootstd - standard boot implementation"
+#endif
+#ifdef CONFIG_SANDBOX
+ "\ncompression - compressors and bootm decompression"
#endif
#ifdef CONFIG_UT_DM
- "ut dm [test-name]\n"
+ "\ndm - driver model"
#endif
#ifdef CONFIG_UT_ENV
- "ut env [test-name]\n"
+ "\nenv - environment"
#endif
#ifdef CONFIG_CMD_FDT
- "ut fdt [test-name] - test of the fdt command\n"
+ "\nfdt - fdt command"
#endif
#ifdef CONFIG_CONSOLE_TRUETYPE
- "ut font [test-name] - test of the font command\n"
+ "\nut font - font command\n"
+#endif
+#ifdef CONFIG_CMD_LOADM
+ "\nloadm - loadm command parameters and loading memory blob"
#endif
#ifdef CONFIG_UT_LIB
- "ut lib [test-name] - test library functions\n"
+ "\nlib - library functions"
#endif
#ifdef CONFIG_UT_LOG
- "ut log [test-name] - test logging functions\n"
+ "\nlog - logging functions"
#endif
- "ut mem [test-name] - test memory-related commands\n"
+ "\nmem - memory-related commands"
#ifdef CONFIG_UT_OPTEE
- "ut optee [test-name]\n"
+ "\noptee - test OP-TEE"
#endif
#ifdef CONFIG_UT_OVERLAY
- "ut overlay [test-name]\n"
+ "\noverlay - device tree overlays"
#endif
- "ut print [test-name] - test printing\n"
- "ut setexpr [test-name] - test setexpr command\n"
+ "\nprint - printing things to the console"
+ "\nsetexpr - setexpr command"
#ifdef CONFIG_SANDBOX
- "ut str - Basic test of string functions\n"
+ "\nstr - basic test of string functions"
#endif
#ifdef CONFIG_UT_TIME
- "ut time - Very basic test of time functions\n"
+ "\ntime - very basic test of time functions"
#endif
#if defined(CONFIG_UT_UNICODE) && \
!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
- "ut unicode [test-name] - test Unicode functions\n"
-#endif
-#ifdef CONFIG_CMD_ADDRMAP
- "ut addrmap - Very basic test of addrmap command\n"
-#endif
-#ifdef CONFIG_CMD_LOADM
- "ut loadm [test-name]- test of parameters and load memory blob\n"
+ "\nunicode - Unicode functions"
#endif
- "All commands accept an optional [-r<runs>] flag before [test-name], to\n"
- "run each test multiple times (<runs> is in decimal)";
+ ;
#endif /* CONFIG_SYS_LONGHELP */
U_BOOT_CMD(