|
6 | 6 | * Change Logs: |
7 | 7 | * Date Author Notes |
8 | 8 | * 2023-11-20 Shell add test suites |
| 9 | + * 2026-03-19 cl2t Add standardized utest documentation block |
| 10 | + */ |
| 11 | + |
| 12 | +/** |
| 13 | + * Test Case Name: Condition Variable Broadcast Test |
| 14 | + * |
| 15 | + * Test Objectives: |
| 16 | + * - Verify that rt_condvar_broadcast() correctly wakes up all threads |
| 17 | + * waiting on a condition variable. |
| 18 | + * - Test core APIs: rt_condvar_broadcast(), rt_condvar_timedwait(), |
| 19 | + * rt_mutex_take(), rt_mutex_release(), rt_mutex_get_owner(). |
| 20 | + * |
| 21 | + * Test Scenarios: |
| 22 | + * - Creates 8 worker threads, each acquiring a mutex and then waiting on |
| 23 | + * a condition variable via rt_condvar_timedwait(). |
| 24 | + * - The main thread calls rt_condvar_broadcast() to wake all waiters. |
| 25 | + * - Each woken thread verifies it re-acquired the mutex, increments a |
| 26 | + * counter, and releases the mutex. |
| 27 | + * - The main thread verifies all 8 threads were successfully woken. |
| 28 | + * |
| 29 | + * Verification Metrics: |
| 30 | + * - All waiting threads must be woken after broadcast (waken_num == THREAD_NUM). |
| 31 | + * - Each woken thread must hold the mutex (verified via rt_mutex_get_owner()). |
| 32 | + * - rt_condvar_timedwait() must return 0 on successful wake. |
| 33 | + * - Mutex release must succeed for each woken thread. |
| 34 | + * |
| 35 | + * Dependencies: |
| 36 | + * - Software configuration: RT_USING_SMART must be enabled. |
| 37 | + * - Environmental assumptions: The platform must support multi-threading |
| 38 | + * with at least 8 concurrent threads. |
| 39 | + * |
| 40 | + * Expected Results: |
| 41 | + * - Final output: "[ PASSED ] [ result ] testcase (testcases.ipc.condvar.broadcast)" |
| 42 | + * - No assertion failures during test execution. |
9 | 43 | */ |
10 | 44 |
|
11 | 45 | #include "common.h" |
|
0 commit comments