From 634fe27a1236ef392855189f05894d6c8a6c4f75 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 2 Feb 2021 23:29:03 +0100 Subject: [PATCH 1/2] ssl-opt.sh: if the server fails, do treat it as a test failure This used to be the case a long time ago but was accidentally broken. Fix #4103 for ssl-opt.sh. Signed-off-by: Gilles Peskine --- tests/ssl-opt.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index b9652ef42..d3ab3bba1 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -676,6 +676,7 @@ run_test() { # terminate the server (and the proxy) kill $SRV_PID wait $SRV_PID + SRV_RET=$? if [ -n "$PXY_CMD" ]; then kill $PXY_PID >/dev/null 2>&1 @@ -710,8 +711,8 @@ run_test() { fi # check server exit code - if [ $? != 0 ]; then - fail "server fail" + if [ $SRV_RET != 0 ]; then + fail "Server exited with status $SRV_RET" return fi From 2cf44b69414b2bf3d52fd11e4b9b856707dbf801 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 9 Feb 2021 21:01:33 +0100 Subject: [PATCH 2/2] ssl-opt.sh: Only check the server exit for Mbed TLS We care about the exit code of our server, for example if it's reporting a memory leak after having otherwise executed correctly. We don't care about the exit code of the servers we're using for interoperability testing (openssl s_server, gnutls-serv). We assume that they're working correctly anyway, and they return 1 (gnutls-serv) or die by the signal handle the signal (openssl) when killed by a signal. Signed-off-by: Gilles Peskine --- tests/ssl-opt.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index d3ab3bba1..b6c03224e 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -710,8 +710,10 @@ run_test() { fi fi - # check server exit code - if [ $SRV_RET != 0 ]; then + # Check server exit code (only for Mbed TLS: GnuTLS and OpenSSL don't + # exit with status 0 when interrupted by a signal, and we don't really + # care anyway), in case e.g. the server reports a memory leak. + if [ $SRV_RET != 0 ] && is_polar "$SRV_CMD"; then fail "Server exited with status $SRV_RET" return fi