Repository navigation
testing/ostest: shrink default round-robin getprime test duration - #3809
Conversation
The round-robin scheduler test runs two threads that calculate prime numbers up to CONFIG_TESTING_OSTEST_RR_RANGE for CONFIG_TESTING_OSTEST_RR_RUNS. Using default range of 30,000 and 10 runs requires billions of trial-division loop iterations, causing OSTest to stall for over 5 minutes on slower targets such as Cortex-M0/M3 and Raspberry Pi Pico (RP2040). Restore the default search range to 10,000 (aligning with roundrobin.c header notes and documentation in Documentation/applications/testing/ostest/) and reduce the default number of runs from 10 to 4. This significantly reduces runtime while providing sufficient time-sliced context switches to reliably verify round-robin scheduling. Fixes apache#3620 Signed-off-by: Swatantra Yadav <maverickswatantra@gmail.com>
|
Looks like Linux (risc-v-04) hit a transient ghcr.io Docker login timeout (context deadline exceeded). Could a maintainer please re-trigger the failed check? |
|
The single failure in Linux (arm64-01) appears to be an intermittent QEMU SMP crash during test_os (test_getprime passed 100%). |
|
Thanks for investigating and catching this, @raiden00pl! When Thank you @casaroli for submitting the revert in #3832 to restore CI. Going forward, we should adjust the range/runs only in individual board defconfigs (like RP2040) rather than changing the global Kconfig defaults. |
|
These kinds of changes should have runtime tests. |
Summary
The round-robin scheduler test in
testing/ostest/roundrobin.cexecutes two concurrent threads calculating prime numbers up toCONFIG_TESTING_OSTEST_RR_RANGEacrossCONFIG_TESTING_OSTEST_RR_RUNS.With the previous defaults of range 30,000 and 10 runs, each thread performed over 2.25 billion trial-division loop iterations. On resource-constrained microcontrollers (such as Cortex-M0/M3, Raspberry Pi Pico / RP2040, or AVR), this causes OSTest to stall on the
getprimestep for 5+ minutes.This PR:
CONFIG_TESTING_OSTEST_RR_RANGEfrom30000to10000(re-aligning with the file header note inroundrobin.cstating default values target ~30s on Cortex-M3 @ 24MHz, and matching the official documentation inDocumentation/applications/testing/ostest/index.rst).CONFIG_TESTING_OSTEST_RR_RUNSfrom10to4(and updates the fallback#defineinroundrobin.caccordingly).4 runs across 2 threads still produce 8 recorded context-switch samples in
g_rr_values, providing ample opportunity to detect round-robin interleaving while cutting execution time by over 90%.Fixes #3620
Impact
ostestexecution on embedded targets and automated test runs.Testing
Kconfigsyntax and options range validation[1; 32767].roundrobin.cfallback preprocessor definitions and compilation consistency.