From cab699d7c8105d5b7fda9a974b49d39cffc656ab Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 19 Oct 2018 07:16:35 -0400 Subject: [PATCH] Bail early from test script if initial tests fail --- TestScripts/cryptest.sh | 12 ++++++++++++ cryptest.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/TestScripts/cryptest.sh b/TestScripts/cryptest.sh index fd8c530b..000ea2b5 100755 --- a/TestScripts/cryptest.sh +++ b/TestScripts/cryptest.sh @@ -1945,14 +1945,20 @@ if true; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 else ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi fi @@ -1973,14 +1979,20 @@ if true; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 else ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi echo fi diff --git a/cryptest.sh b/cryptest.sh index fd8c530b..000ea2b5 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -1945,14 +1945,20 @@ if true; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 else ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi fi @@ -1973,14 +1979,20 @@ if true; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 else ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi echo fi