From 2d3c9f898b3d350b1e5d1a596039d74e0c6f735b Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 19 Oct 2021 18:00:10 +0200 Subject: [PATCH] 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 --- tests/ssl-opt.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index c93154b5f..25a33db93 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -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