Skip to content

Commit 7489859

Browse files
committed
Auto retry failed test if there are no pending tests
Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 578cd4f commit 7489859

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ci-infra/helpers/run-tests.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
# Input:
66
# - outdir will contain status/progress file, and log files of individual tests
77
# - (optional) test-names.txt contains integration tests to be run, one per line.
8+
# If not given, all tests in tests/integration/targets/ are run.
89
# Output:
910
# - logs are one test per file, in outdir/log-timestamp/
1011
# - list of succeded/failed tests are in outdir/status.txt
1112
# If line starts with:
1213
# - PEND (or contains just test name), test will be run
1314
# - SKIP means skip this test
1415
# - OK or ERR are set after test is run
16+
# On second run, only PEND tests are run.
17+
# If there are no PEND tests, the ERR tests are retried.
1518

1619
set -ue
1720
# set -v
@@ -43,10 +46,22 @@ fi
4346
/bin/cp "$TSTATUS" "$OUTD2/status.txt"
4447

4548
TEST_NAMES=$(grep "^PEND" "$TSTATUS" | awk '{print $2}')
49+
if [ -z "$TEST_NAMES" ]
50+
then
51+
echo "No PEND tests, retrying ERR tests"
52+
sed -i 's/^ERR/PEND/' "$TSTATUS"
53+
fi
54+
TEST_NAMES=$(grep "^PEND" "$TSTATUS" | awk '{print $2}')
55+
if [ -z "$TEST_NAMES" ]
56+
then
57+
echo "No tests to run, exiting."
58+
exit 0
59+
fi
4660
# shellcheck disable=SC2086
4761
echo "Pending tests: "$TEST_NAMES
4862
# shellcheck disable=SC2086
4963
TEST_COUNT=$(echo $TEST_NAMES | wc -w)
64+
5065
ii=0
5166
for TN in $TEST_NAMES
5267
do

0 commit comments

Comments
 (0)