CONFIG_DM_RTC=y
CONFIG_ERRNO_STR=y
CONFIG_CMD_UT_TIME=y
-CONFIG_DM_TEST=y
+CONFIG_UT_DM=y
* @dms: Overall test state
*/int dm_leak_check_end(struct unit_test_state *uts);
-
-/**
- * dm_test_main() - Run all or one of the tests
- *
- * This runs all available driver model tests, or a selected one
- *
- * @test_name: Name of test to run, or NULL for all
- * @return 0 if OK, -ve on error
- */
-int dm_test_main(const char *test_name);
-
#endif
#ifndef __TEST_SUITES_H__
#define __TEST_SUITES_H__
+int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+
#endif /* __TEST_SUITES_H__ */
static cmd_tbl_t cmd_ut_sub[] = {
U_BOOT_CMD_MKENT(all, CONFIG_SYS_MAXARGS, 1, do_ut_all, "", ""),
+#if defined(CONFIG_UT_DM)
+ U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
+#endif
};
static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_SYS_LONGHELP
static char ut_help_text[] =
"all - execute all enabled tests\n"
+#ifdef CONFIG_UT_DM
+ "ut dm [test-name]\n"
+#endif
;
#endif
-config DM_TEST
- bool "Enable driver model test command"
- depends on SANDBOX && CMD_DM
+config UT_DM
+ bool "Enable driver model unit test command"
+ depends on SANDBOX
select UNIT_TEST
help
- This enables the 'dm test' command which runs a series of unit
+ This enables the 'ut dm' command which runs a series of unit
tests on the driver model code. Each subsystem (uclass) is tested.
If all is well then all tests pass although there will be a few
messages printed along the way.
#
obj-$(CONFIG_CMD_DM) += cmd_dm.o
-obj-$(CONFIG_DM_TEST) += bus.o
-obj-$(CONFIG_DM_TEST) += test-driver.o
-obj-$(CONFIG_DM_TEST) += test-fdt.o
-obj-$(CONFIG_DM_TEST) += test-main.o
-obj-$(CONFIG_DM_TEST) += test-uclass.o
+obj-$(CONFIG_UT_DM) += bus.o
+obj-$(CONFIG_UT_DM) += test-driver.o
+obj-$(CONFIG_UT_DM) += test-fdt.o
+obj-$(CONFIG_UT_DM) += test-main.o
+obj-$(CONFIG_UT_DM) += test-uclass.o
# Tests for particular subsystems - when enabling driver model for a new
# subsystem you must add sandbox tests here.
-obj-$(CONFIG_DM_TEST) += core.o
+obj-$(CONFIG_UT_DM) += core.o
ifneq ($(CONFIG_SANDBOX),)
obj-$(CONFIG_DM_ETH) += eth.o
obj-$(CONFIG_DM_GPIO) += gpio.o
#include <errno.h>
#include <asm/io.h>
#include <dm/root.h>
-#include <dm/test.h>
#include <dm/uclass-internal.h>
static void show_devices(struct udevice *dev, int depth, int last_flag)
return 0;
}
-#ifdef CONFIG_DM_TEST
-static int do_dm_test(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
-{
- const char *test_name = NULL;
-
- if (argc > 0)
- test_name = argv[0];
-
- return dm_test_main(test_name);
-}
-#define TEST_HELP "\ndm test Run tests"
-#else
-#define TEST_HELP
-#endif
-
static cmd_tbl_t test_commands[] = {
U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
-#ifdef CONFIG_DM_TEST
- U_BOOT_CMD_MKENT(test, 1, 1, do_dm_test, "", ""),
-#endif
};
static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
"Driver model low level access",
"tree Dump driver model tree ('*' = activated)\n"
"dm uclass Dump list of instances for each uclass"
- TEST_HELP
);
dd if=/dev/zero of=spi.bin bs=1M count=2
echo -n "this is a test" > testflash.bin
dd if=/dev/zero bs=1M count=4 >>testflash.bin
-./sandbox/u-boot -d ./sandbox/arch/sandbox/dts/test.dtb -c "dm test"
+./sandbox/u-boot -d ./sandbox/arch/sandbox/dts/test.dtb -c "ut dm"
rm spi.bin
rm testflash.bin
*/
#include <common.h>
+#include <command.h>
#include <dm.h>
#include <errno.h>
#include <malloc.h>
return 0;
}
-int dm_test_main(const char *test_name)
+static int dm_test_main(const char *test_name)
{
struct unit_test *tests = ll_entry_start(struct unit_test, dm_test);
const int n_ents = ll_entry_count(struct unit_test, dm_test);
return 0;
}
+
+int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ const char *test_name = NULL;
+
+ if (argc > 1)
+ test_name = argv[1];
+
+ return dm_test_main(test_name);
+}