Skip to content

Commit a5c88dd

Browse files
committed
[docs][utest]:Add comments for smp_spinlock_tc
Add comments for smp_spinlock_tc. Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
1 parent 736b2db commit a5c88dd

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/utest/smp/smp_interrupt_pri_tc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*
3030
* Test Scenarios:
3131
* - First, two interrupts are registered, namely the low-priority interrupt RT_SPI_1 and the high-priority
32-
* - interrupt RT_SPI_2.
32+
* - interrupt RT_SPI_2.
3333
* - Scenario 1 (int_pri1_tc, mode=0): RT_SPI_1 and RT_SPI_2 are triggered sequentially without interrupt masking.
3434
* - At this point, the interrupt service routine (ISR) of RT_SPI_1 executes first to set ipi_val[0] = SET_VAL;
3535
* - since the RT_SPI_2 interrupt has not been triggered yet, ipi_val[1] remains at the initial value RES_VAL,

src/utest/smp/smp_spinlock_tc.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@
1616
* @brief Spinlock testcase.
1717
*
1818
* @note Create multiple threads and use spinlocks to protect shared memory
19+
*
20+
* Test Case Name: [smp_spinlock_tc]
21+
*
22+
* Test Objectives:
23+
* - Test the protection effect of spin locks on shared memory under the SMP architecture.
24+
*
25+
* Test Scenarios:
26+
* - This utest creates two threads. Thread 1 acquires the spin lock, performs the number1++ operation,
27+
* - then voluntarily enters a sleep state. After being awakened, it executes number2++ and finally
28+
* - releases the spin lock. Thread 2, upon acquiring the spin lock, first checks whether number1 is
29+
* - equal to number2, then performs number1++ and number2++ operations, and ultimately releases the
30+
* - spin lock. Within Thread 2, if the judgment condition number >= 10 is satisfied, finish_flag is set to 1.
31+
*
32+
* Verification Metrics:
33+
* - Output message: [ PASSED ] [ result ] testcase (core.smp_spinlock)
34+
*
35+
* Dependencies:
36+
* - RT_USING_SMP needs to be enabled.
37+
*
38+
* Expected Results:
39+
* - You will see the the PASS message of smp_interrupt_pri_tc.
1940
*/
2041

2142
#define THREAD_PRIORITY 20

0 commit comments

Comments
 (0)