[PATCH stalld 13/52] tests: Add assertions to SCHED_OTHER restoration test
Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:31:23 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
Test 3 in the boost restoration suite creates a SCHED_OTHER blockee but never verifies that the scheduling policy is actually restored after boosting. It waits for starvation_gen to complete and has a comment about checking the result, but no pass or fail call exists. Add proper verification by tracking the starved child PID, waiting for the boost to occur and expire, then checking that the policy returns to SCHED_OTHER. 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_boost_restoration.sh | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/functional/test_boost_restoration.sh b/tests/functional/test_boost_restoration.sh index 09dbb60..63e2bc3 100755 --- a/tests/functional/test_boost_restoration.sh +++ b/tests/functional/test_boost_restoration.sh @@ -244,12 +244,39 @@ start_stalld_with_log "${STALLD_LOG}" -f -v -t $threshold -c ${TEST_CPU} -a ${ST log "Creating SCHED_OTHER starvation (RT blocker prio 80, SCHED_OTHER blockee)" start_starvation_gen -c ${TEST_CPU} -p 80 -o -n 1 -d 20 -# Wait for starvation_gen to complete -log "Waiting for starvation test to complete..." -wait ${STARVE_PID} 2>/dev/null || true +# Find the starved SCHED_OTHER task +tracked_pid=$(find_starved_child "${STARVE_PID}") + +if [ -n "${tracked_pid}" ]; then + initial_policy=$(get_sched_policy ${tracked_pid}) + log "Tracking task PID ${tracked_pid}, initial policy: ${initial_policy} (expected: 0=SCHED_OTHER)" + + # Wait for boost + log "Waiting for starvation detection and boost..." + if wait_for_boost_detected "${STALLD_LOG}"; then + pass "SCHED_OTHER task boosted" + + # Wait for boost to expire and policy to be restored + sleep $((boost_duration + 1)) -# Check if blockee completed (proves SCHED_OTHER → boost → SCHED_OTHER restoration worked) -# The starvation_gen output will show if blockees completed + if [ -f "/proc/${tracked_pid}/sched" ]; then + final_policy=$(get_sched_policy ${tracked_pid}) + log "Policy after boost: ${final_policy}" + + if [ "$final_policy" = "0" ]; then + pass "Policy restored to SCHED_OTHER (0)" + else + fail "Policy not restored to SCHED_OTHER (got ${final_policy})" + fi + else + log "⚠ INFO: Task exited before restoration check" + fi + else + fail "No boost detected for SCHED_OTHER task" + fi +else + log "⚠ WARNING: Could not find starved task to track" +fi # Cleanup cleanup_scenario "${STARVE_PID}" -- 2.54.0