From 929bff539fa788ed09643e9f7da7ca03480708c4 Mon Sep 17 00:00:00 2001 From: CYFS <2805686936@qq.com> Date: Mon, 8 Jun 2026 11:34:08 +0800 Subject: [PATCH] [utest] fix testcase init failure summary --- components/utilities/utest/utest.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c index e222c8efb21..f215b01ecc8 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; }