From 50693c33a44188d47f73198312a3d4427d08bf89 Mon Sep 17 00:00:00 2001 From: 陈泽堂 <130895816+sexenteen@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:53:51 +0800 Subject: fix[utest]: reset finish flags in the mailbox testcase so it can run twice #11963 --- src/utest/mailbox_tc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/utest/mailbox_tc.c b/src/utest/mailbox_tc.c index b51ee6e515..6d7ce13287 100644 --- a/src/utest/mailbox_tc.c +++ b/src/utest/mailbox_tc.c @@ -389,6 +389,17 @@ static void test_dynamic_mailbox_send_recv(void) static rt_err_t utest_tc_init(void) { + /* This testcase may be run more than once in a single boot. The finish + * flags are set by the worker threads and read by the test body, so they + * must be cleared before every run. Otherwise the second run would skip + * the wait loop, detach/delete the mailbox while the worker threads are + * still blocked in rt_mb_recv(), and those threads would then use an + * already detached mailbox. */ + static_mb_recv_thread_finish = 0; + static_mb_send_thread_finish = 0; + dynamic_mb_recv_thread_finish = 0; + dynamic_mb_send_thread_finish = 0; + return RT_EOK; } -- cgit v1.3.1