@@ -340,11 +340,27 @@ jobs:
340340 KVMARGS="-cpu host"
341341 EOF
342342 git config --global --add safe.directory $GITHUB_WORKSPACE/hostap
343+ # parallel-vm.py exits non-zero whenever any test failed on its first
344+ # attempt, even if hostap's own internal retry recovered. Treat
345+ # "All failed cases passed on retry" as success so we don't churn the
346+ # whole VM batch over a flaky test that already passed on retry.
347+ run_hwsim() {
348+ local log rc=0
349+ log=$(mktemp)
350+ ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses "$@" 2>&1 | tee "$log"
351+ rc=${PIPESTATUS[0]}
352+ if [ "$rc" -ne 0 ] && grep -q "All failed cases passed on retry" "$log"; then
353+ echo "Treating run as success: hostap's internal retry recovered all failures"
354+ rc=0
355+ fi
356+ rm -f "$log"
357+ return $rc
358+ }
343359 # Run tests in increments of 200 to not stall out the parallel-vm script
344360 while mapfile -t -n 200 ary && ((${#ary[@]})); do
345361 TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ')
346362 HWSIM_RES=0 # Not set when command succeeds
347- ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $ (nproc) $TESTS || HWSIM_RES=$?
363+ run_hwsim $ (nproc) $TESTS || HWSIM_RES=$?
348364 # Retry failing tests up to 2 times to mitigate flakiness in the
349365 # upstream hostap tests themselves.
350366 for i in 1 2; do
@@ -359,7 +375,7 @@ jobs:
359375 printf 'failed tests (retry %d): %s\n' "$i" "$FAILED_TESTS"
360376 rm -rf /tmp/hwsim-test-logs
361377 HWSIM_RES=0
362- ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $FAILED_TESTS || HWSIM_RES=$?
378+ run_hwsim $(nproc) $FAILED_TESTS || HWSIM_RES=$?
363379 fi
364380 done
365381 if [ "$HWSIM_RES" -ne "0" ]; then
0 commit comments