Skip to content

Commit

Permalink
test: dm: Move the time test over to the ut command
Browse files Browse the repository at this point in the history
Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <[email protected]>
  • Loading branch information
jhershbe authored and trini committed May 21, 2015
1 parent 40441e0 commit c812f72
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion configs/sandbox_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions include/test/suites.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
5 changes: 3 additions & 2 deletions test/Kconfig
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions test/cmd_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
Expand Down Expand Up @@ -58,6 +61,9 @@ static char ut_help_text[] =
"all - execute all enabled tests\n"
#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
Expand Down
8 changes: 1 addition & 7 deletions test/time_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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",
""
);

0 comments on commit c812f72

Please sign in to comment.