From 1411046a989544f684d1c65a92202ca460e93410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Frauenschl=C3=A4ger?= Date: Mon, 4 May 2026 13:56:09 +0200 Subject: [PATCH] Retry hostap tests up to 2 times to reduce flakyness --- .github/workflows/hostap-vm.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/hostap-vm.yml b/.github/workflows/hostap-vm.yml index 1e609028c94..969a679a1ad 100644 --- a/.github/workflows/hostap-vm.yml +++ b/.github/workflows/hostap-vm.yml @@ -345,13 +345,28 @@ jobs: TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ') HWSIM_RES=0 # Not set when command succeeds ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $TESTS || HWSIM_RES=$? + # Retry failing tests up to 2 times to mitigate flakiness in the + # upstream hostap tests themselves. + for i in 1 2; do + if [ "$HWSIM_RES" -ne "0" ]; then + # Let's re-run the failing tests. We gather the failed tests from the log file. + # `|| true` keeps the step alive under `-eo pipefail` if grep finds no matches. + 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) + if [ -z "$FAILED_TESTS" ]; then + echo "Could not determine failed tests from logs, skipping retry" + break + fi + printf 'failed tests (retry %d): %s\n' "$i" "$FAILED_TESTS" + rm -rf /tmp/hwsim-test-logs + HWSIM_RES=0 + ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $FAILED_TESTS || HWSIM_RES=$? + fi + done if [ "$HWSIM_RES" -ne "0" ]; then - # Let's re-run the failing tests. We gather the failed tests from the log file. - FAILED_TESTS=$(grep 'failed tests' /tmp/hwsim-test-logs/*-parallel.log | sed 's/failed tests: //' | tr ' ' '\n' | sort | uniq | tr '\n' ' ') - printf 'failed tests: %s\n' "$FAILED_TESTS" - ./vm/parallel-vm.py ${{ env.hostap_debug_flags }} --nocurses $(nproc) $FAILED_TESTS + echo "Tests still failing after retries" + exit 1 fi - rm -r /tmp/hwsim-test-logs + rm -rf /tmp/hwsim-test-logs done < $GITHUB_WORKSPACE/wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/tests - name: show errors