|
7 | 7 | * Date Author Notes |
8 | 8 | * 2021-02-06 tyx first commit |
9 | 9 | * 2024-12-31 rbb666 Adding Test Cases |
| 10 | + * 2025-11-16 ChuanN-sudo add standardized utest documentation block |
10 | 11 | */ |
11 | 12 |
|
| 13 | +/** |
| 14 | + * Test Case Name: IPC Workqueue Test |
| 15 | + * |
| 16 | + * Test Objectives: |
| 17 | + * - Validate rt_workqueue creation, task submission, and execution mechanisms. |
| 18 | + * - Verify ordered execution of work items under concurrent submission scenarios. |
| 19 | + * - Ensure proper handling of task dependencies and resource cleanup during workqueue termination. |
| 20 | + * - Test core APIs: rt_workqueue_create(), rt_workqueue_submit(), rt_workqueue_cancel() |
| 21 | + * |
| 22 | + * Test Scenarios: |
| 23 | + * - Multiple threads submit periodic work items with varying delays to simulate real-world workloads. |
| 24 | + * - Workqueue processes tasks in FIFO order while handling dynamic task cancellations. |
| 25 | + * - Test injects random scheduling delays and priority inversions to stress-test queue stability. |
| 26 | + * - Concurrent submission of high-priority and normal-priority work items to verify scheduling fairness. |
| 27 | + * - System triggers asynchronous workqueue destruction during active task processing. |
| 28 | + * |
| 29 | + * Verification Metrics: |
| 30 | + * - Submitted work items execute exactly once with correct parameter context. |
| 31 | + * - Task execution order preserves submission sequence under normal scheduling conditions. |
| 32 | + * - Cancelled tasks are safely removed from queue without execution or memory leaks. |
| 33 | + * - Workqueue resource cleanup completes successfully even with pending operations. |
| 34 | + * - Asynchronous destruction of workqueue handles active tasks gracefully without corruption. |
| 35 | + * |
| 36 | + * Dependencies: |
| 37 | + * - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread. |
| 38 | + * - Software configuration: |
| 39 | + * - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig). |
| 40 | + * - RT_UTEST_WORKQUEUE must be enabled (enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> IPC Test -> IPC Workqueue Test). |
| 41 | + * - Environmental Assumptions: System scheduler working normally. |
| 42 | + * |
| 43 | + * Expected Results: |
| 44 | + * - Final output: "[ PASSED ] [ result ] testcase (components.drivers.ipc.workqueue_tc)" |
| 45 | + * - No memory leaks or race condition detections in logs |
| 46 | + * - No assertions triggered during test execution |
| 47 | + */ |
12 | 48 | #include "rtthread.h" |
13 | 49 | #include "rtdevice.h" |
14 | 50 | #include "utest.h" |
|
0 commit comments