Skip to content

Commit 2fcdd86

Browse files
ChuanN-sudoRbb666
authored andcommitted
docs(utest):Add standardized documentation for IPC Completion Test
Signed-off-by: ChuanN-sudo <fjchuanil@gmail.com>
1 parent 7983d97 commit 2fcdd86

File tree

3 files changed

+57
-26
lines changed

3 files changed

+57
-26
lines changed

components/drivers/ipc/utest/completion_tc.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,40 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024-04-30 Shell init ver.
9+
* 2025-11-16 ChuanN-sudo add standardized utest documentation block
910
*/
1011

1112
/**
12-
* Test Case for rt_completion API
13+
* Test Case Name: IPC Completion Basic Test
1314
*
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, and wake-up mechanisms.
17+
* - Verify thread synchronization in producer-consumer model.
18+
* - Test core APIs: rt_completion_init(), rt_completion_wait_flags(), rt_completion_wakeup()
1719
*
18-
* Test Criteria:
19-
* - The producer should correctly increment the test data and signal
20-
* completion.
21-
* - The consumer should correctly wait for data update, consume it, and signal
22-
* completion.
20+
* Test Scenarios:
21+
* - Producer thread generates incrementing data and notifies consumer.
22+
* - Consumer thread waits for data updates and validates integrity.
23+
* - Random delays simulate race conditions in synchronization.
24+
*
25+
* Verification Metrics:
26+
* - The producer should correctly increment the test data and signal completion.
27+
* - The consumer should correctly wait for data update, consume it, and signal completion.
2328
* - Data integrity should be maintained between producer and consumer.
2429
* - Synchronization is properly done so both can see consistent data.
2530
* - Random latency is introduced to simulate racing scenarios.
31+
*
32+
* Dependencies:
33+
* - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread.
34+
* - Software configuration:
35+
* - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig).
36+
* - RT_UTEST_COMPLETION must be enabled (enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> IPC Test -> IPC Completion Test).
37+
* - Environmental Assumptions: System scheduler working normally.
38+
*
39+
* Expected Results:
40+
* - Progress logs: "[ INFO ] components.drivers.ipc.rt_completion_basic: Summary:...Test times:..."
41+
* - Final output: "[ PASSED ] [ result ] testcase (components.drivers.ipc.rt_completion_basic)"
42+
* - No assertions triggered.
2643
*/
2744

2845
#define TEST_LATENCY_TICK (1)

components/drivers/ipc/utest/completion_timeout_tc.c

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,43 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024-04-30 Shell init ver.
9+
* 2025-11-16 ChuanN-sudo add standardized utest documentation block
910
*/
1011

1112
/**
12-
* Test Case for rt_completion API
13+
* Test Case Name: IPC Completion Timeout Test
1314
*
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.
1720
*
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:
1929
* - 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.
2231
* - 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.
2741
*
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.
3246
*/
3347

3448
#define TEST_LATENCY_TICK (1)

components/drivers/ipc/utest/workqueue_tc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
*
4343
* Expected Results:
4444
* - 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
45+
* - No memory leaks or race condition detections in logs.
46+
* - No assertions triggered during test execution.
4747
*/
4848
#include "rtthread.h"
4949
#include "rtdevice.h"

0 commit comments

Comments
 (0)