summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorCYFS <[email protected]>2026-06-08 11:34:08 +0800
committerRbb666 <[email protected]>2026-06-23 15:00:23 +0800
commit659023b98c6a4a1994bd7cf980720e27f540d748 (patch)
treefebdfe64fed555b6a9d97081f56b814c25fd640f /components
parentfaf528b431ff133808bf384a2a8bb3dfa90c8edd (diff)
[utest] fix testcase init failure summary
Diffstat (limited to 'components')
-rw-r--r--components/utilities/utest/utest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c
index e222c8efb2..f215b01ecc 100644
--- a/components/utilities/utest/utest.c
+++ b/components/utilities/utest/utest.c
@@ -262,11 +262,16 @@ static void utest_do_run(const char *utest_name)
}
is_find = RT_TRUE;
+ rt_bool_t tc_failed = RT_FALSE;
+
LOG_I("[----------] [ testcase ] (%s) started", tc_table[i].name);
if (tc_table[i].init != RT_NULL)
{
if (tc_table[i].init() != RT_EOK)
{
+ TC_FAIL_LIST_MARK_FAILED(i);
+ tc_fail_num ++;
+ tc_failed = RT_TRUE;
LOG_E("[ FAILED ] [ result ] testcase init (%s)", tc_table[i].name);
goto __tc_continue;
}
@@ -283,11 +288,15 @@ static void utest_do_run(const char *utest_name)
{
TC_FAIL_LIST_MARK_FAILED(i);
tc_fail_num ++;
+ tc_failed = RT_TRUE;
LOG_E("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
}
}
else
{
+ TC_FAIL_LIST_MARK_FAILED(i);
+ tc_fail_num ++;
+ tc_failed = RT_TRUE;
LOG_E("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
}
@@ -295,6 +304,11 @@ static void utest_do_run(const char *utest_name)
{
if (tc_table[i].cleanup() != RT_EOK)
{
+ if (tc_failed == RT_FALSE)
+ {
+ TC_FAIL_LIST_MARK_FAILED(i);
+ tc_fail_num ++;
+ }
LOG_E("[ FAILED ] [ result ] testcase cleanup (%s)", tc_table[i].name);
goto __tc_continue;
}