Skip to content

Commit d358971

Browse files
committed
[utest][smp_call]:Add standardized documentation for SMP Call Smoke Test
1 parent 2fb53c8 commit d358971

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed

components/drivers/smp_call/utest/smp_001_tc.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,44 @@
77
* Date Author Notes
88
* 2024/9/12 zhujiale the first version
99
* 2024/10/28 Shell Added more assertions
10+
* 2025/12/3 ChuanN-sudo add standardized utest documentation block
1011
*/
1112

13+
/**
14+
* Test Case Name: SMP Call Smoke 001 Test
15+
*
16+
* Test Objectives:
17+
* - Validate rt_smp_call_cpu_mask() with SMP_CALL_WAIT_ALL flag for blocking synchronous calls.
18+
* - Verify callback execution on all targeted CPUs.
19+
* - Ensure callback runs in interrupt-disabled context.
20+
* - Test core APIs: rt_smp_call_cpu_mask().
21+
*
22+
* Test Scenarios:
23+
* - Main thread generates random CPU masks and dispatches callbacks to targeted CPUs.
24+
* - Callback function clears corresponding CPU bit from shared mask variable.
25+
* - Blocking call waits for all targeted CPUs to complete execution.
26+
* - Random CPU selection simulates various multi-core scenarios.
27+
*
28+
* Verification Metrics:
29+
* - rt_smp_call_cpu_mask() must block until all targeted CPUs complete callback execution.
30+
* - Shared mask variable must be zero after function returns, confirming all targets executed.
31+
* - Callback must execute in interrupt-disabled context.
32+
* - All available CPUs must be tested throughout the run.
33+
* - Data integrity maintained across CPUs with spinlock protection.
34+
*
35+
* Dependencies:
36+
* - Hardware requirements: QEMU emulator or any multi-core 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_SMP_CALL_FUNC must be enabled(enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> SMP-Call Test -> SMP-Call Smoke Test).
40+
* - Environmental Assumptions: System scheduler and SMP services working normally.
41+
*
42+
* Expected Results:
43+
* - Final output: "[ PASSED ] [ result ] testcase (components.drivers.smp_call.smoke_001)"
44+
* - No assertions triggered during test execution.
45+
*/
46+
47+
1248
#include <rtdevice.h>
1349
#include <utest.h>
1450
#include <utest_assert.h>

components/drivers/smp_call/utest/smp_002_tc.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,38 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024/10/28 Shell Added smp.smoke
9+
* 2025/12/3 ChuanN-sudo add standardized utest documentation block
10+
*/
11+
12+
/**
13+
* Test Case Name: SMP Call Smoke 002 Test
14+
*
15+
* Test Objectives:
16+
* - Validate thread-safety of rt_smp_call_cpu_mask() under concurrent calls from multiple CPUs.
17+
* - Verify system stability with simultaneous blocking SMP calls.
18+
* - Test core APIs: rt_smp_call_cpu_mask().
19+
*
20+
* Test Scenarios:
21+
* - One worker thread pinned to each CPU core.
22+
* - All threads simultaneously call rt_smp_call_cpu_mask() with random targets.
23+
* - Atomic counter tracks callbacks executed per thread.
24+
*
25+
* Verification Metrics:
26+
* - Callback count must match requested target count.
27+
* - Callbacks execute in interrupt-disabled context.
28+
* - All threads successfully created and pinned.
29+
* - Each thread tests all available CPUs.
30+
*
31+
* Dependencies:
32+
* - Hardware requirements: QEMU emulator or any multi-core hardware platform that supports RT-Thread.
33+
* - Software configuration:
34+
* - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig).
35+
* - RT_UTEST_SMP_CALL_FUNC must be enabled(enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> SMP-Call Test -> SMP-Call Smoke Test).
36+
* - Environmental Assumptions: System scheduler and SMP services working normally.
37+
*
38+
* Expected Results:
39+
* - Progress logs: A series of '#' characters indicating callback executions.
40+
* - Final output: "[ PASSED ] [ result ] testcase (components.drivers.smp_call.smoke_002)"
941
*/
1042

1143
#include <rtdevice.h>

components/drivers/smp_call/utest/smp_003_tc.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,38 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024/10/28 Shell Added smp.smoke
9+
* 2025/12/3 ChuanN-sudo add standardized utest documentation block
10+
*/
11+
12+
/**
13+
* Test Case Name: SMP Call Smoke 003 Test
14+
*
15+
* Test Objectives:
16+
* - Validate asynchronous rt_smp_call_cpu_mask() reliability under high-contention.
17+
* - Ensure no Inter-Processor Interrupts are lost when fired rapidly without waiting.
18+
* - Test core APIs: rt_smp_call_cpu_mask() (with wait_flag=0), rt_thread_control(RT_THREAD_CTRL_BIND_CPU)
19+
*
20+
* Test Scenarios:
21+
* - One worker thread pinned to each CPU core.
22+
* - Threads repeatedly call non-blocking rt_smp_call_cpu_mask() with random targets.
23+
* - After dispatching Inter-Processor Interrupts, threads migrate across cores to yield processing time.
24+
* - Final verification checks eventual consistency.
25+
*
26+
* Verification Metrics:
27+
* - Callback count must eventually match requested count.
28+
* - Callbacks execute in interrupt-disabled context.
29+
* - All threads successfully created and started.
30+
*
31+
* Dependencies:
32+
* - Hardware requirements: QEMU emulator or any multi-core hardware platform that supports RT-Thread.
33+
* - Software configuration:
34+
* - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig).
35+
* - RT_UTEST_SMP_CALL_FUNC must be enabled(enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> SMP-Call Test -> SMP-Call Smoke Test).
36+
* - Environmental Assumptions: System scheduler and SMP services working normally.
37+
*
38+
* Expected Results:
39+
* - Progress logs: A series of '#' characters indicating asynchronous callback executions.
40+
* - Final output: "[ PASSED ] [ result ] testcase (components.drivers.smp_call.smoke_003)"
941
*/
1042

1143
#include <rtdevice.h>

components/drivers/smp_call/utest/smp_004_tc.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2024/10/28 Shell Added smp.smoke
9+
* 2025/12/3 ChuanN-sudo add standardized utest documentation block
10+
*/
11+
12+
/**
13+
* Test Case Name: SMP Call Smoke 004 Test
14+
*
15+
* Test Objectives:
16+
* - Validate SMP call mechanism is re-entrant.
17+
* - Test rt_smp_call_request robustness from interrupt context.
18+
* - Ensure system stability under nested Inter-Processor Interrupts scenarios from multiple cores.
19+
* - Test core APIs: rt_smp_call_request(), rt_smp_call_req_init(), rt_smp_request_wait_freed(), rt_smp_call_cpu_mask()
20+
*
21+
* Test Scenarios:
22+
* - Pre-initialized 2D array of rt_smp_call_req objects.
23+
* - Worker thread triggers primary Inter-Processor Interrupts to another CPU.
24+
* - Primary handler fires secondary Inter-Processor Interrupts to all other CPUs.
25+
* - Secondary handlers update shared bitmask.
26+
* - Worker thread polls bitmask until all secondary Inter-Processor Interrupts complete.
27+
*
28+
* Verification Metrics:
29+
* - Bitmask must match expected value.
30+
* - Callbacks execute in interrupt-disabled context.
31+
* - rt_smp_call_request from ISR returns no error.
32+
*
33+
* Dependencies:
34+
* - Hardware requirements: QEMU emulator or any multi-core hardware platform that supports RT-Thread.
35+
* - Software configuration:
36+
* - RT_USING_UTEST must be enabled (select "RT-Thread Utestcases" in menuconfig).
37+
* - RT_UTEST_SMP_CALL_FUNC must be enabled(enable via: RT-Thread Utestcases -> Kernel Components -> Drivers -> SMP-Call Test -> SMP-Call Smoke Test).
38+
* - Environmental Assumptions: System scheduler and SMP services working normally.
39+
*
40+
* Expected Results:
41+
* - Progress logs: A series of characters (0-N) indicating which worker's callbacks are executing.
42+
* - Final output: "[ PASSED ] [ result ] testcase (components.drivers.smp_call.smoke_004)"
943
*/
1044

1145
#include <rtdevice.h>

0 commit comments

Comments
 (0)