|
6 | 6 | * Change Logs: |
7 | 7 | * Date Author Notes |
8 | 8 | * 2024-04-30 Shell init ver. |
| 9 | + * 2025-11-16 ChuanN-sudo add standardized utest documentation block |
9 | 10 | */ |
10 | 11 |
|
11 | 12 | /** |
12 | | - * Test Case for rt_completion API |
| 13 | + * Test Case Name: IPC Completion Timeout Test |
13 | 14 | * |
14 | | - * The test simulates a producer-consumer interaction where a producer thread |
15 | | - * generates data, and a consumer thread consumes the data after waiting for its |
16 | | - * availability using rt_completion synchronization primitives. |
| 15 | + * Test Objectives: |
| 16 | + * - Validate rt_completion initialization, wait with timeout, and wake-up mechanisms. |
| 17 | + * - Verify thread synchronization resilience in producer-consumer model under timing constraints. |
| 18 | + * - Test core APIs: rt_completion_init(), rt_completion_wait_flags(), rt_completion_wakeup() |
| 19 | + * - Verify proper handling of timeout and interrupt scenarios during synchronization. |
17 | 20 | * |
18 | | - * Test Criteria: |
| 21 | + * Test Scenarios: |
| 22 | + * - Producer thread generates incrementing data with small delays between productions. |
| 23 | + * - Consumer thread waits for data with timeout flags (RT_INTERRUPTIBLE) to simulate real-world interruptions. |
| 24 | + * - Test deliberately introduces random thread yields to simulate scheduling variations. |
| 25 | + * - Producer-consumer synchronization loop runs for extended duration to expose timing issues. |
| 26 | + * - System handles asynchronous interruptions during wait operations. |
| 27 | + * |
| 28 | + * Verification Metrics: |
19 | 29 | * - The producer produces data correctly and notifies the consumer thread. |
20 | | - * - The consumer receives data correctly and acknowledges receipt to the |
21 | | - * producer. |
| 30 | + * - The consumer receives data correctly and acknowledges receipt to the producer. |
22 | 31 | * - The producer and consumer threads synchronize their operations effectively. |
23 | | - * - Verify the correctness of data production and consumption between producer |
24 | | - * and consumer threads. |
25 | | - * - The asynchronous woken of consumer thread was handled properly so the |
26 | | - * consumer don't lose woken from producer. |
| 32 | + * - Verify the correctness of data production and consumption between producer and consumer threads. |
| 33 | + * - The asynchronous wakeup of consumer thread was handled properly so the consumer don't lose wakeup from producer. |
| 34 | + * |
| 35 | + * Dependencies: |
| 36 | + * - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread. |
| 37 | + * - Software configuration: |
| 38 | + * - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig). |
| 39 | + * - RT_UTEST_COMPLETION must be enabled (enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> IPC Test -> IPC Completion Test). |
| 40 | + * - Environmental Assumptions: System clock interrupts and scheduler working normally. |
27 | 41 | * |
28 | | - * Test APIs: |
29 | | - * - rt_completion_init() |
30 | | - * - rt_completion_wakeup() |
31 | | - * - rt_completion_wait_flags() |
| 42 | + * Expected Results: |
| 43 | + * - Progress logs: "[ INFO ] components.drivers.ipc.rt_completion_timeout: Summary:...Test times:...Async interruption count:...". |
| 44 | + * - Final output: "[ PASSED ] [ result ] testcase (components.drivers.ipc.rt_completion_timeout)". |
| 45 | + * - No assertions triggered. |
32 | 46 | */ |
33 | 47 |
|
34 | 48 | #define TEST_LATENCY_TICK (1) |
|
0 commit comments