Fix rerunning the tests in case of LeakSanitizer crash

The changes of 211cde11d4 (Rerun the test if LeakSanitizer crashed while
running it, 2021-02-05) didn't work because the script is executed with
"-e" shell option and so none of the commands added there was actually
run.

Fix this by using the usual "|| rc=$?" construct instead.
This commit is contained in:
Vadim Zeitlin
2021-03-23 14:56:45 +01:00
parent 9ee85c7386
commit 478720c18e

View File

@@ -199,18 +199,16 @@ jobs:
working-directory: tests working-directory: tests
run: | run: |
# Explicitly use bash because /bin/sh doesn't have pipefail option # Explicitly use bash because /bin/sh doesn't have pipefail option
/bin/bash -o pipefail -c './test 2>&1 | tee test.out' /bin/bash -o pipefail -c './test 2>&1 | tee test.out' || rc=$?
rc=$?
if [ ${{ matrix.use_asan }} ]; then if [ ${{ matrix.use_asan }} ]; then
# Work around spurious crashes by running the test again. # Work around spurious crashes by running the test again.
# See https://github.com/google/sanitizers/issues/1353 # See https://github.com/google/sanitizers/issues/1353
if fgrep -q 'LeakSanitizer has encountered a fatal error' test.out; then if fgrep -q 'LeakSanitizer has encountered a fatal error' test.out; then
echo '+++ Rerunning the tests once again after LeakSanitizer crash +++' echo '+++ Rerunning the tests once again after LeakSanitizer crash +++'
./test ./test || rc=$?
rc=$?
fi fi
fi fi
if [ "$rc" != 0 ]; then if [ -n "$rc" ]; then
echo '*** Tests failed, contents of httpbin.log follows: ***' echo '*** Tests failed, contents of httpbin.log follows: ***'
echo '-----------------------------------------------------------' echo '-----------------------------------------------------------'
cat httpbin.log cat httpbin.log