3 * Joe Hershberger, National Instruments, joe.hershberger@ni.com
5 * SPDX-License-Identifier: GPL-2.0
10 #include <test/suites.h>
12 static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
14 static cmd_tbl_t cmd_ut_sub[] = {
15 U_BOOT_CMD_MKENT(all, CONFIG_SYS_MAXARGS, 1, do_ut_all, "", ""),
16 #if defined(CONFIG_UT_DM)
17 U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
19 #if defined(CONFIG_UT_ENV)
20 U_BOOT_CMD_MKENT(env, CONFIG_SYS_MAXARGS, 1, do_ut_env, "", ""),
22 #ifdef CONFIG_UT_OVERLAY
23 U_BOOT_CMD_MKENT(overlay, CONFIG_SYS_MAXARGS, 1, do_ut_overlay, "", ""),
26 U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
30 static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
36 for (i = 1; i < ARRAY_SIZE(cmd_ut_sub); i++) {
37 printf("----Running %s tests----\n", cmd_ut_sub[i].name);
38 retval = cmd_ut_sub[i].cmd(cmdtp, flag, 1, &cmd_ut_sub[i].name);
46 static int do_ut(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
53 /* drop initial "ut" arg */
57 cp = find_cmd_tbl(argv[0], cmd_ut_sub, ARRAY_SIZE(cmd_ut_sub));
60 return cp->cmd(cmdtp, flag, argc, argv);
65 #ifdef CONFIG_SYS_LONGHELP
66 static char ut_help_text[] =
67 "all - execute all enabled tests\n"
72 "ut env [test-name]\n"
74 #ifdef CONFIG_UT_OVERLAY
75 "ut overlay [test-name]\n"
78 "ut time - Very basic test of time functions\n"
84 ut, CONFIG_SYS_MAXARGS, 1, do_ut,
85 "unit tests", ut_help_text