diff options
| author | MurphyZhao <[email protected]> | 2018-12-06 17:11:27 +0800 |
|---|---|---|
| committer | MurphyZhao <[email protected]> | 2018-12-06 17:13:14 +0800 |
| commit | 8824b2ca7780c3874de7703a6c4e17b97fe63595 (patch) | |
| tree | ed853daf170a04d67597b4637e4513aef96b4f0d /components/utilities | |
| parent | 0759b66eb971f0baad1148586ba0db8ab98a1c82 (diff) | |
[components/utilities] [Kconfig] 增加 kconfig RT_USING_UTEST 配置
[components/utilities] [utest] 增加 testcase 运行超时时间参数
Signed-off-by: MurphyZhao <[email protected]>
Diffstat (limited to 'components/utilities')
| -rw-r--r-- | components/utilities/Kconfig | 4 | ||||
| -rw-r--r-- | components/utilities/utest/utest.c | 9 | ||||
| -rw-r--r-- | components/utilities/utest/utest.h | 18 |
3 files changed, 18 insertions, 13 deletions
diff --git a/components/utilities/Kconfig b/components/utilities/Kconfig index e830d94578..8e43cfa0a0 100644 --- a/components/utilities/Kconfig +++ b/components/utilities/Kconfig @@ -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 diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c index 4226738ce7..18d2c88d0a 100644 --- a/components/utilities/utest/utest.c +++ b/components/utilities/utest/utest.c @@ -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) { diff --git a/components/utilities/utest/utest.h b/components/utilities/utest/utest.h index 3db5895462..9532b115e6 100644 --- a/components/utilities/utest/utest.h +++ b/components/utilities/utest/utest.h @@ -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 |
