Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/utest/smp/smp_affinity_pri1_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@
* for the system's highest and the thread entry function does not let out the CPU control, run the specified
* number of times in thread 0 to create a high-priority not bound to the core of the thread, the thread will
* be preempted by the core 0 is running on the thread!
*
* Test Case Name: [smp_affinity_pri1]
*
* Test Objectives:
* - Verify that threads with low-priority bound cores do not preempt high-priority threads.
*
* Test Scenarios:
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with each thread bound to its respective core. Among them, the
* - thread on core 0 has the lowest priority (LOW_PRIORITY), while the other threads have the highest priority (THREAD_PRIORITY).
* - All threads share a common entry function "thread_entry". In thread_entry, only the threads running on non-core-0 cores
* - execute an infinite loop (i.e., they do not release core ownership). After running for a certain period of time, the
* - thread on core 0 executes list_thread() and creates a medium-priority (THIGH_PRIORITY) thread Tn, whose entry function
* - is thread_temp_entry. Tn is automatically destroyed after executing list_thread().
*
* Verification Metrics:
* - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_affinity_pri1)
*
* Dependencies:
* - Enable RT_USING_SMP, set RT_THREAD_PRIORITY_MAX = 256.
*
* Expected Results:
* - You will see the information printed by list_thread() twice on the terminal. For the first time, you will see that T0 is
* - running on core 0, and T1~T(RT_CPUS_NR-1) are running on their respective cores. For the second time, you will see that Tn
* - is running on core 0, while T0 is in the ready state. Subsequently, the PASS message will be printed.
*/

/* Number of thread runs */
Expand Down
23 changes: 23 additions & 0 deletions src/utest/smp/smp_affinity_pri2_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@
* threads for the system's highest and the thread entry function does not let out the CPU control, run the
* specified number of times after the creation of thread 0 in thread 0, a low-priority bound to the core 0,
* the thread will not preempt the core 0 is running on threads
*
* Test Case Name: [smp_affinity_pri2]
*
* Test Objectives:
* - Verify that threads with low-priority unbound cores do not preempt high-priority threads.
*
* Test Scenarios:
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with each thread bound to its respective core. Among them,
* - the thread on core 0 has a medium priority (THIGH_PRIORITY), while the other threads have the highest priority (THREAD_PRIORITY).
* - All threads share a common entry function thread_entry. In thread_entry, only the threads running on non-core-0 cores
* - execute an infinite loop (i.e., they do not release core ownership). After running for a certain period of time,
* - the thread on core 0 checks whether run_flag equals 0 after creating a low-priority (LOW_PRIORITY) thread Tn. The entry
* - function of Tn is thread_temp_entry, and Tn will be destroyed after setting run_flag = 1.
*
* Verification Metrics:
* - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_affinity_pri2)
*
* Dependencies:
* - Enable RT_USING_SMP, set RT_THREAD_PRIORITY_MAX = 256.
*
* Expected Results:
* - After T0 creates Tn, no scheduling occurs. T0 immediately checks whether run_flag is not equal to 1, and if this condition
* - is true, it indicates that Tn has failed to preempt T0.
*/

/* Number of thread runs */
Expand Down
22 changes: 22 additions & 0 deletions src/utest/smp/smp_bind_affinity_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@
* @note Create RT_CPUS_NR threads, thread 0 is bound to core 0, other threads are not bound to specific cores,
* after running for a set number of times, count the number of times each core is run on the corresponding core,
* thread 0 should always be run on core 0, other threads will be run on different cores.
*
* Test Case Name: [smp_bind_affinity]
*
* Test Objectives:
* - Verify that threads bound to specific cores run on those cores.
*
* Test Scenarios:
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with only T0 bound to core 0. When thread Tx is running,
* - thread_tic[x] increments by 1; if x is equal to the core ID, thread_inc[x] also increments by 1. After the
* - program runs for a period of time, observe the value relationship between the thread_inc and thread_tic arrays.
* - If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x.
*
* Verification Metrics:
* - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity)
*
* Dependencies:
* - Enable RT_USING_SMP, set RT_THREAD_PRIORITY_MAX = 256.
*
* Expected Results:
* - You will see the relevant PASS message. Additionally, RT_CPUS_NR lines of printed information will be displayed,
* - indicating whether each thread Tx has been running on core x all the time. The results show that only T0 has been
* - running on core 0 consistently.
*/

/* Number of thread runs */
Expand Down