[U-Boot] [PATCH v5 17/26] test: dm: Move the time test over to the ut command

Joe Hershberger joe.hershberger at ni.com
Wed May 20 21:27:30 CEST 2015


Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
---

Changes in v5:
-Move the new time test to the common ut command

Changes in v4: None
Changes in v3: None
Changes in v2: None

 configs/sandbox_defconfig | 2 +-
 include/test/suites.h     | 1 +
 test/Kconfig              | 5 +++--
 test/Makefile             | 2 +-
 test/cmd_ut.c             | 6 ++++++
 test/time_ut.c            | 8 +-------
 6 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index e69f147..7b5ef2b 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -37,5 +37,5 @@ CONFIG_USB_EMUL=y
 CONFIG_USB_STORAGE=y
 CONFIG_DM_RTC=y
 CONFIG_ERRNO_STR=y
-CONFIG_CMD_UT_TIME=y
+CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/include/test/suites.h b/include/test/suites.h
index 27813a3..f68cdec 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -9,5 +9,6 @@
 #define __TEST_SUITES_H__
 
 int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
 #endif /* __TEST_SUITES_H__ */
diff --git a/test/Kconfig b/test/Kconfig
index 6f918ed..32a974e 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -1,10 +1,11 @@
 config UNIT_TEST
 	bool
 
-config CMD_UT_TIME
+config UT_TIME
 	bool "Unit tests for time functions"
+	select UNIT_TEST
 	help
-	  Enables the 'ut_time' command which tests that the time functions
+	  Enables the 'ut time' command which tests that the time functions
 	  work correctly. The test is fairly simple and will not catch all
 	  problems. But if you are having problems with udelay() and the like,
 	  this is a good place to start.
diff --git a/test/Makefile b/test/Makefile
index 3d9968c..0f5de57 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,4 +8,4 @@ obj-$(CONFIG_UNIT_TEST) += cmd_ut.o
 obj-$(CONFIG_UNIT_TEST) += ut.o
 obj-$(CONFIG_SANDBOX) += command_ut.o
 obj-$(CONFIG_SANDBOX) += compression.o
-obj-$(CONFIG_CMD_UT_TIME) += time_ut.o
+obj-$(CONFIG_UT_TIME) += time_ut.o
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index 08001cd..a65bfea 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -16,6 +16,9 @@ static cmd_tbl_t cmd_ut_sub[] = {
 #if defined(CONFIG_UT_DM)
 	U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
 #endif
+#ifdef CONFIG_UT_TIME
+	U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
+#endif
 };
 
 static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -59,6 +62,9 @@ static char ut_help_text[] =
 #ifdef CONFIG_UT_DM
 	"ut dm [test-name]\n"
 #endif
+#ifdef CONFIG_UT_TIME
+	"ut time - Very basic test of time functions\n"
+#endif
 	;
 #endif
 
diff --git a/test/time_ut.c b/test/time_ut.c
index 6b52245..8ca9fcb 100644
--- a/test/time_ut.c
+++ b/test/time_ut.c
@@ -116,7 +116,7 @@ static int test_udelay(void)
 	return 0;
 }
 
-static int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int ret = 0;
 
@@ -129,9 +129,3 @@ static int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	return ret ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
-
-U_BOOT_CMD(
-	ut_time,	1,	1,	do_ut_time,
-	"Very basic test of time functions",
-	""
-);
-- 
1.7.11.5



More information about the U-Boot mailing list