@@ -345,13 +345,28 @@ jobs:
345345 TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ')
346346 HWSIM_RES=0 # Not set when command succeeds
347347 ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $TESTS || HWSIM_RES=$?
348+ # Retry failing tests up to 2 times to mitigate flakiness in the
349+ # upstream hostap tests themselves.
350+ for i in 1 2; do
351+ if [ "$HWSIM_RES" -ne "0" ]; then
352+ # Let's re-run the failing tests. We gather the failed tests from the log file.
353+ # `|| true` keeps the step alive under `-eo pipefail` if grep finds no matches.
354+ FAILED_TESTS=$(grep 'failed tests' /tmp/hwsim-test-logs/*-parallel.log 2>/dev/null | sed 's/failed tests: //' | tr ' ' '\n' | sort | uniq | tr '\n' ' ' || true)
355+ if [ -z "$FAILED_TESTS" ]; then
356+ echo "Could not determine failed tests from logs, skipping retry"
357+ break
358+ fi
359+ printf 'failed tests (retry %d): %s\n' "$i" "$FAILED_TESTS"
360+ rm -rf /tmp/hwsim-test-logs
361+ HWSIM_RES=0
362+ ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $FAILED_TESTS || HWSIM_RES=$?
363+ fi
364+ done
348365 if [ "$HWSIM_RES" -ne "0" ]; then
349- # Let's re-run the failing tests. We gather the failed tests from the log file.
350- FAILED_TESTS=$(grep 'failed tests' /tmp/hwsim-test-logs/*-parallel.log | sed 's/failed tests: //' | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
351- printf 'failed tests: %s\n' "$FAILED_TESTS"
352- ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $FAILED_TESTS
366+ echo "Tests still failing after retries"
367+ exit 1
353368 fi
354- rm -r /tmp/hwsim-test-logs
369+ rm -rf /tmp/hwsim-test-logs
355370 done < $GITHUB_WORKSPACE/wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/tests
356371
357372 - name : show errors
0 commit comments