diff options
| author | guozhanxin <[email protected]> | 2021-08-19 11:20:10 +0800 |
|---|---|---|
| committer | guozhanxin <[email protected]> | 2021-08-19 11:21:31 +0800 |
| commit | 38f5fec63ed420db514f415489b0516dd97a9ea9 (patch) | |
| tree | 118a3631f871eb374939dfb23ec1f2d07745da62 | |
| parent | 4af99b0dca501cae50a11b233b8a2a507084a442 (diff) | |
[utest] 完善代码,添加对tc_num的判断
| -rw-r--r-- | components/utilities/utest/utest.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c index 7e25e2555e..937f156b85 100644 --- a/components/utilities/utest/utest.c +++ b/components/utilities/utest/utest.c @@ -83,13 +83,16 @@ int utest_init(void) tc_num = (utest_tc_export_t) &__rt_utest_tc_tab_end - tc_table; #endif - tc_fail_list = rt_malloc(TC_FAIL_LIST_SIZE); - if(!tc_fail_list) - { - LOG_E("no memory, tc_fail_list init failed!"); - } LOG_I("utest is initialize success."); LOG_I("total utest testcase num: (%d)", tc_num); + if (tc_num > 0) + { + tc_fail_list = rt_malloc(TC_FAIL_LIST_SIZE); + if(!tc_fail_list) + { + LOG_E("no memory, tc_fail_list init failed!"); + } + } return tc_num; } INIT_COMPONENT_EXPORT(utest_init); |
