| 219 | } |
| 220 | |
| 221 | static void utest_do_run(const char *utest_name) |
| 222 | { |
| 223 | rt_size_t i; |
| 224 | rt_uint32_t index; |
| 225 | rt_bool_t is_find; |
| 226 | rt_uint32_t tc_fail_num = 0; |
| 227 | rt_uint32_t tc_run_num = 0; |
| 228 | |
| 229 | for (index = 0; index < tc_loop; index ++) |
| 230 | { |
| 231 | i = 0; |
| 232 | is_find = RT_FALSE; |
| 233 | |
| 234 | tc_fail_num = 0; |
| 235 | tc_run_num = 0; |
| 236 | if (tc_fail_list) |
| 237 | { |
| 238 | rt_memset(tc_fail_list, 0, TC_FAIL_LIST_SIZE); |
| 239 | } |
| 240 | |
| 241 | LOG_I("[==========] [ utest ] loop %d/%d", index + 1, tc_loop); |
| 242 | LOG_I("[==========] [ utest ] started"); |
| 243 | while(i < tc_num) |
| 244 | { |
| 245 | if (utest_name) |
| 246 | { |
| 247 | int len = rt_strlen(utest_name); |
| 248 | if (utest_name[len - 1] == '*') |
| 249 | { |
| 250 | len -= 1; |
| 251 | if (rt_memcmp(tc_table[i].name, utest_name, len) != 0) |
| 252 | { |
| 253 | i++; |
| 254 | continue; |
| 255 | } |
| 256 | } |
| 257 | else if (rt_strcmp(tc_table[i].name, utest_name) != 0) |
| 258 | { |
| 259 | i++; |
| 260 | continue; |
| 261 | } |
| 262 | } |
| 263 | is_find = RT_TRUE; |
| 264 | |
| 265 | LOG_I("[----------] [ testcase ] (%s) started", tc_table[i].name); |
| 266 | if (tc_table[i].init != RT_NULL) |
| 267 | { |
| 268 | if (tc_table[i].init() != RT_EOK) |
| 269 | { |
| 270 | LOG_E("[ FAILED ] [ result ] testcase init (%s)", tc_table[i].name); |
| 271 | goto __tc_continue; |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | if (tc_table[i].tc != RT_NULL) |
| 276 | { |
| 277 | tc_table[i].tc(); |
| 278 | if (local_utest.failed_num == 0) |