File tree Expand file tree Collapse file tree
components/utilities/utest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,11 +262,16 @@ static void utest_do_run(const char *utest_name)
262262 }
263263 is_find = RT_TRUE ;
264264
265+ rt_bool_t tc_failed = RT_FALSE ;
266+
265267 LOG_I ("[----------] [ testcase ] (%s) started" , tc_table [i ].name );
266268 if (tc_table [i ].init != RT_NULL )
267269 {
268270 if (tc_table [i ].init () != RT_EOK )
269271 {
272+ TC_FAIL_LIST_MARK_FAILED (i );
273+ tc_fail_num ++ ;
274+ tc_failed = RT_TRUE ;
270275 LOG_E ("[ FAILED ] [ result ] testcase init (%s)" , tc_table [i ].name );
271276 goto __tc_continue ;
272277 }
@@ -283,18 +288,27 @@ static void utest_do_run(const char *utest_name)
283288 {
284289 TC_FAIL_LIST_MARK_FAILED (i );
285290 tc_fail_num ++ ;
291+ tc_failed = RT_TRUE ;
286292 LOG_E ("[ FAILED ] [ result ] testcase (%s)" , tc_table [i ].name );
287293 }
288294 }
289295 else
290296 {
297+ TC_FAIL_LIST_MARK_FAILED (i );
298+ tc_fail_num ++ ;
299+ tc_failed = RT_TRUE ;
291300 LOG_E ("[ FAILED ] [ result ] testcase (%s)" , tc_table [i ].name );
292301 }
293302
294303 if (tc_table [i ].cleanup != RT_NULL )
295304 {
296305 if (tc_table [i ].cleanup () != RT_EOK )
297306 {
307+ if (tc_failed == RT_FALSE )
308+ {
309+ TC_FAIL_LIST_MARK_FAILED (i );
310+ tc_fail_num ++ ;
311+ }
298312 LOG_E ("[ FAILED ] [ result ] testcase cleanup (%s)" , tc_table [i ].name );
299313 goto __tc_continue ;
300314 }
You can’t perform that action at this time.
0 commit comments