Skip to content

Commit 659023b

Browse files
CYFS3Rbb666
authored andcommitted
[utest] fix testcase init failure summary
1 parent faf528b commit 659023b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

components/utilities/utest/utest.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)