Improve spec test execution by adding retry logic for transient errors (#4393)

This commit is contained in:
liang.he 2025-06-20 15:49:43 +08:00 committed by GitHub
parent ea408ab6c0
commit 64cafaff1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -288,30 +288,24 @@ jobs:
sudo swapon /swapfile sudo swapon /swapfile
sudo swapon --show sudo swapon --show
- name: run spec tests - name: run spec tests with retry
run: | id: run_spec_tests
set +e uses: nick-fields/retry@v3
with:
command: |
cd ./tests/wamr-test-suites
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
attempts=0
max_attempts=3
while [ $attempts -lt $max_attempts ]; do
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
exitcode="$?" max_attempts: 3
retry_on: error
shell: bash
timeout_minutes: 10
if [ $exitcode -eq 0 ]; then - name: print test results
echo "Spec test passed" run: |
exit 0 echo "Test results:"
elif [ $exitcode -ne 143 ]; then echo "${{ steps.run_spec_tests.outputs.stdout }}"
echo "Spec test failed with error code $exitcode" echo "${{ steps.run_spec_tests.outputs.stderr }}"
exit 1 echo "Exit code: ${{ steps.run_spec_tests.outputs.exit_code }}"
fi echo "Exit error: ${{ steps.run_spec_tests.outputs.exit_error }}"
shell: bash
echo "$exitcode is a known GitHub-hosted runner issue"
echo "::notice::Re-running the spec test due to error code 143"
attempts=$((attempts + 1))
done
echo "::notice::Report an error with code 143 in SGX CI after $max_attempts attempts"
exit 143
working-directory: ./tests/wamr-test-suites