]> Git Repo - J-u-boot.git/blobdiff - test/cmd_ut.c
test: Run bootstd tests only on sandbox
[J-u-boot.git] / test / cmd_ut.c
index 3789c6b784c03778af7fcdb58d3c14fc2edd24dc..1b934b23295954b8cb7215839c69bec490f5c541 100644 (file)
 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;
 
+       while (argc > 1 && *argv[1] == '-') {
+               const char *str = argv[1];
+
+               switch (str[1]) {
+               case 'r':
+                       runs_per_text = dectoul(str + 2, NULL);
+                       break;
+               case 'f':
+                       force_run = true;
+                       break;
+               case 'I':
+                       test_insert = str + 2;
+                       break;
+               }
+               argv++;
+               argc--;
+       }
+
        ret = ut_run_list(name, prefix, tests, n_ents,
-                         argc > 1 ? argv[1] : NULL);
+                         cmd_arg1(argc, argv), 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, "", ""),
-#ifdef CONFIG_BOOTSTD
+       U_BOOT_CMD_MKENT(info, 1, 1, do_ut_info, "", ""),
+#ifdef CONFIG_CMD_BDI
+       U_BOOT_CMD_MKENT(bdinfo, CONFIG_SYS_MAXARGS, 1, do_ut_bdinfo, "", ""),
+#endif
+#ifdef CONFIG_UT_BOOTSTD
        U_BOOT_CMD_MKENT(bootstd, CONFIG_SYS_MAXARGS, 1, do_ut_bootstd,
                         "", ""),
+#endif
+#ifdef CONFIG_CMDLINE
+       U_BOOT_CMD_MKENT(cmd, CONFIG_SYS_MAXARGS, 1, do_ut_cmd, "", ""),
 #endif
        U_BOOT_CMD_MKENT(common, CONFIG_SYS_MAXARGS, 1, do_ut_common, "", ""),
 #if defined(CONFIG_UT_DM)
@@ -39,9 +71,13 @@ static struct cmd_tbl cmd_ut_sub[] = {
 #if defined(CONFIG_UT_ENV)
        U_BOOT_CMD_MKENT(env, CONFIG_SYS_MAXARGS, 1, do_ut_env, "", ""),
 #endif
+       U_BOOT_CMD_MKENT(exit, CONFIG_SYS_MAXARGS, 1, do_ut_exit, "", ""),
 #ifdef CONFIG_CMD_FDT
        U_BOOT_CMD_MKENT(fdt, CONFIG_SYS_MAXARGS, 1, do_ut_fdt, "", ""),
 #endif
+#ifdef CONFIG_CONSOLE_TRUETYPE
+       U_BOOT_CMD_MKENT(font, CONFIG_SYS_MAXARGS, 1, do_ut_font, "", ""),
+#endif
 #ifdef CONFIG_UT_OPTEE
        U_BOOT_CMD_MKENT(optee, CONFIG_SYS_MAXARGS, 1, do_ut_optee, "", ""),
 #endif
@@ -53,9 +89,13 @@ static struct cmd_tbl cmd_ut_sub[] = {
 #endif
 #ifdef CONFIG_UT_LOG
        U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_ut_log, "", ""),
+#endif
+#if defined(CONFIG_SANDBOX) && defined(CONFIG_CMD_MBR) && defined(CONFIG_CMD_MMC) \
+        && defined(CONFIG_MMC_SANDBOX) && defined(CONFIG_MMC_WRITE)
+       U_BOOT_CMD_MKENT(mbr, CONFIG_SYS_MAXARGS, 1, do_ut_mbr, "", ""),
 #endif
        U_BOOT_CMD_MKENT(mem, CONFIG_SYS_MAXARGS, 1, do_ut_mem, "", ""),
-#ifdef CONFIG_CMD_SETEXPR
+#if defined(CONFIG_SANDBOX) && defined(CONFIG_CMD_SETEXPR)
        U_BOOT_CMD_MKENT(setexpr, CONFIG_SYS_MAXARGS, 1, do_ut_setexpr, "",
                         ""),
 #endif
@@ -66,6 +106,10 @@ static struct cmd_tbl cmd_ut_sub[] = {
 #if CONFIG_IS_ENABLED(UT_UNICODE) && !defined(API_BUILD)
        U_BOOT_CMD_MKENT(unicode, CONFIG_SYS_MAXARGS, 1, do_ut_unicode, "", ""),
 #endif
+#ifdef CONFIG_MEASURED_BOOT
+       U_BOOT_CMD_MKENT(measurement, CONFIG_SYS_MAXARGS, 1, do_ut_measurement,
+                        "", ""),
+#endif
 #ifdef CONFIG_SANDBOX
        U_BOOT_CMD_MKENT(compression, CONFIG_SYS_MAXARGS, 1, do_ut_compression,
                         "", ""),
@@ -80,6 +124,12 @@ static struct cmd_tbl cmd_ut_sub[] = {
 #ifdef CONFIG_CMD_LOADM
        U_BOOT_CMD_MKENT(loadm, CONFIG_SYS_MAXARGS, 1, do_ut_loadm, "", ""),
 #endif
+#ifdef CONFIG_CMD_PCI_MPS
+       U_BOOT_CMD_MKENT(pci_mps, CONFIG_SYS_MAXARGS, 1, do_ut_pci_mps, "", ""),
+#endif
+#ifdef CONFIG_CMD_SEAMA
+       U_BOOT_CMD_MKENT(seama, CONFIG_SYS_MAXARGS, 1, do_ut_seama, "", ""),
+#endif
 };
 
 static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -99,6 +149,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;
@@ -118,58 +177,80 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        return CMD_RET_USAGE;
 }
 
-#ifdef CONFIG_SYS_LONGHELP
-static char ut_help_text[] =
-       "all - execute all enabled tests\n"
+U_BOOT_LONGHELP(ut,
+       "[-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_CMD_BDI
+       "\nbdinfo - bdinfo 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_CMDLINE
+       "\ncmd - test various commands"
+#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
+       "\nfont - font command"
+#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"
+#ifdef CONFIG_CMD_PCI_MPS
+       "\npci_mps - PCI Express Maximum Payload Size"
+#endif
+       "\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_CMD_SEAMA
+       "\nseama - seama command parameters loading and decoding"
 #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
-       ;
-#endif /* CONFIG_SYS_LONGHELP */
+       );
 
 U_BOOT_CMD(
        ut, CONFIG_SYS_MAXARGS, 1, do_ut,
This page took 0.030055 seconds and 4 git commands to generate.