Retry if a test case fails because of an unexpected resend

Palliative for https://github.com/ARMmbed/mbedtls/issues/3377. If a test
case fails due to an unexpected resend, allow retrying, like in the case of
a client timeout.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-10-19 18:00:10 +02:00
parent a28fd41ed1
commit 2d3c9f898b

View file

@ -795,14 +795,14 @@ analyze_test_commands() {
# * $TIMES_LEFT: if nonzero, a RETRY outcome is allowed
#
# Outputs:
# * $outcome: one of PASS/RETRY/FAIL
# * $outcome: one of PASS/RETRY*/FAIL
check_test_failure() {
outcome=FAIL
if [ $TIMES_LEFT -gt 0 ] &&
grep '===CLIENT_TIMEOUT===' $CLI_OUT >/dev/null
then
outcome=RETRY
outcome="RETRY(client-timeout)"
return
fi
@ -863,14 +863,22 @@ check_test_failure() {
"-S")
if grep -v '^==' $SRV_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then
fail "pattern '$2' MUST NOT be present in the Server output"
if [ "$2" = "resend" ] && [ $TIMES_LEFT -gt 0 ]; then
outcome="RETRY(resend)"
else
fail "pattern '$2' MUST NOT be present in the Server output"
fi
return
fi
;;
"-C")
if grep -v '^==' $CLI_OUT | grep -v 'Serious error when reading debug info' | grep "$2" >/dev/null; then
fail "pattern '$2' MUST NOT be present in the Client output"
if [ "$2" = "resend" ] && [ $TIMES_LEFT -gt 0 ]; then
outcome="RETRY(resend)"
else
fail "pattern '$2' MUST NOT be present in the Client output"
fi
return
fi
;;
@ -1053,7 +1061,7 @@ run_test() {
check_test_failure "$@"
case $outcome in
PASS) break;;
RETRY) printf "RETRY ";;
RETRY*) printf "$outcome ";;
FAIL) return;;
esac
done