Skip to content

Commit 6a3fb67

Browse files
committed
Fix SMP time-slice test on CI runners
The threadx_smp_time_slice_test creates 8 priority-31 threads with time-slice=1 across 3 available SMP cores, sleeps 20 ticks, then asserts all thread counters are non-zero. On loaded CI runners (GitHub Actions), the linux SMP port's posix thread may not receive enough host CPU time for all 8 threads to get scheduled within 20 ticks. This produced intermittent ERROR eclipse-threadx#31 failures in stack_checking_rand_fill_build and trace_build configs. Increase the sleep from 20 to 100 ticks, giving 5x headroom for host scheduling jitter while keeping test execution under 2 seconds.
1 parent df1ed08 commit 6a3fb67

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/smp/regression/threadx_smp_time_slice_test.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,12 @@ UINT status;
243243
status += tx_thread_resume(&thread_31g);
244244
status += tx_thread_resume(&thread_31h);
245245

246-
/* Now sleep for 20 ticks to let see if all the threads execute. */
247-
tx_thread_sleep(20);
246+
/* Sleep long enough for time-slicing to rotate all 8 threads across
247+
the available SMP cores. On CI runners under load the linux SMP
248+
port may need extra wall-clock time because host-thread scheduling
249+
is non-deterministic. 100 ticks is ~5x headroom over the minimum
250+
needed for 8 threads on 3 cores with time-slice=1. */
251+
tx_thread_sleep(100);
248252

249253
/* Now check and make sure all the threads ran. */
250254
if ((status != TX_SUCCESS) || (thread_31a_counter == 0) || (thread_31b_counter == 0) || (thread_31c_counter == 0) || (thread_31d_counter == 0) ||

0 commit comments

Comments
 (0)