[components/utilities] [Kconfig] 增加 kconfig RT_USING_UTEST 配置
[components/utilities] [utest] 增加 testcase 运行超时时间参数 Signed-off-by: MurphyZhao <d2014zjt@163.com>
This commit is contained in:
parent
0759b66eb9
commit
8824b2ca77
|
@ -230,4 +230,8 @@ config RT_USING_ULOG
|
|||
sfotware module version number
|
||||
endif
|
||||
|
||||
config RT_USING_UTEST
|
||||
bool "Enable utest (RT-Thread test framework)"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -57,7 +57,8 @@ int utest_init(void)
|
|||
tc_num = (utest_tc_export_t) &__rt_utest_tc_tab_end - tc_table;
|
||||
#endif /* defined(__CC_ARM) */
|
||||
|
||||
LOG_D("[ ] total utest testcase num: (%d)", tc_num);
|
||||
LOG_I("utest is initialize success.");
|
||||
LOG_I("total utest testcase num: (%d)", tc_num);
|
||||
return tc_num;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(utest_init);
|
||||
|
@ -66,11 +67,11 @@ static void utest_tc_list(void)
|
|||
{
|
||||
rt_size_t i = 0;
|
||||
|
||||
LOG_D("Commands list : ");
|
||||
LOG_I("Commands list : ");
|
||||
|
||||
for (i = 0; i < tc_num; i++)
|
||||
{
|
||||
LOG_D("%s", tc_table[i].name);
|
||||
LOG_I("[testcase name]:%s; [run timeout]:%d", tc_table[i].name, tc_table[i].run_timeout);
|
||||
}
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(utest_tc_list, utest_tc_list, output all utest testcase);
|
||||
|
@ -115,8 +116,6 @@ static void utest_run(const char *utest_name)
|
|||
{
|
||||
rt_size_t i = 0;
|
||||
|
||||
LOG_D("[ ] total utest testcase num: (%d)", tc_num);
|
||||
|
||||
LOG_I("[==========] [ utest ] started");
|
||||
while(i < tc_num)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef struct utest *utest_t;
|
|||
|
||||
struct utest_tc_export {
|
||||
const char *name;
|
||||
uint32_t run_timeout;
|
||||
rt_err_t (*init)(void);
|
||||
void (*tc)(void);
|
||||
rt_err_t (*cleanup)(void);
|
||||
|
@ -52,18 +53,19 @@ utest_t utest_handle_get(void);
|
|||
|
||||
#define UTEST_NAME_MAX_LEN (128u)
|
||||
|
||||
#define UTEST_TC_EXPORT(testcase, name, init, cleanup) \
|
||||
#define UTEST_TC_EXPORT(testcase, name, init, cleanup, timeout) \
|
||||
RT_USED static const struct utest_tc_export _utest_testcase \
|
||||
SECTION("UtestTcTab") = \
|
||||
SECTION("UtestTcTab") = \
|
||||
{ \
|
||||
name, \
|
||||
init, \
|
||||
testcase, \
|
||||
cleanup \
|
||||
name, \
|
||||
timeout, \
|
||||
init, \
|
||||
testcase, \
|
||||
cleanup \
|
||||
}
|
||||
|
||||
#define UTEST_UNIT_RUN(test_unit_func) \
|
||||
utest_unit_run(test_unit_func, #test_unit_func); \
|
||||
#define UTEST_UNIT_RUN(test_unit_func) \
|
||||
utest_unit_run(test_unit_func, #test_unit_func); \
|
||||
if(utest_handle_get()->failed_num != 0) return;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue