[PATCH stalld 15/52] tests: Add idle CPU skipping assertion
Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:31:25 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
Test 4 in the idle detection suite was purely informational, printing explanatory text about what idle detection does without any assertions. Replace it with an actual test that starts stalld on an idle CPU and verifies that "skipping" messages appear in the log, confirming the idle detection optimization is working. Signed-off-by: Wander Lairson Costa <[email protected]> Assisted-by: Claude Code:claude-opus-4-6[1m] [PAL] Signed-off-by: Wander Lairson Costa <[email protected]> --- tests/functional/test_idle_detection.sh | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/functional/test_idle_detection.sh b/tests/functional/test_idle_detection.sh index 8017675..f238c7e 100755 --- a/tests/functional/test_idle_detection.sh +++ b/tests/functional/test_idle_detection.sh @@ -140,23 +140,25 @@ fi cleanup_scenario "${STARVE_PID}" #============================================================================= -# Test 4: Idle Detection Overhead Reduction +# Test 4: Idle CPUs Are Skipped #============================================================================= -test_section "Test 4: Idle Detection Reduces Overhead" -log "Comparing overhead with and without idle detection (informational)" - -# This is informational - we can't easily measure overhead in tests -log "With idle detection (default):" -log " - /proc/stat read before parsing" -log " - Idle CPUs skipped (no sched_debug/BPF parsing)" -log " - Reduces CPU usage when system mostly idle" -log "" -log "Without idle detection would:" -log " - Always parse all CPUs" -log " - Higher overhead even when CPUs idle" +test_section "Test 4: Idle CPUs Are Skipped" + +rm -f "${STALLD_LOG}" +threshold=3 + +log "Starting stalld with idle detection on an idle CPU" +start_stalld_with_log "${STALLD_LOG}" -f -v -l -t $threshold -c ${TEST_CPU} -a ${STALLD_CPU} + +sleep 3 + +if grep -q "skipping" "${STALLD_LOG}"; then + pass "Idle CPU correctly skipped" +else + fail "No skipping messages for idle CPU" +fi -log "ℹ INFO: Idle detection enabled by default for efficiency" -log " Function: cpu_had_idle_time() and get_cpu_busy_list()" +cleanup_scenario #============================================================================= # Test 5: Idle Detection with Multiple CPUs -- 2.54.0