Don't use BASH_SOURCE in cryptest.sh

pull/867/head
Jeffrey Walton 2019-07-21 03:19:14 -04:00
parent ed7f4a0493
commit 3747e3d944
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 18 additions and 18 deletions

View File

@ -257,7 +257,7 @@ if [[ (-z "$TMPDIR") ]]; then
TMPDIR="$HOME/tmp" TMPDIR="$HOME/tmp"
else else
echo "Please set TMPDIR to a valid directory" echo "Please set TMPDIR to a valid directory"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
fi fi
@ -1949,19 +1949,19 @@ if true; then
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
else else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
fi fi
@ -1983,19 +1983,19 @@ if true; then
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
else else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
echo echo
fi fi
@ -7168,7 +7168,7 @@ echo
############################################ ############################################
# http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF # http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF
if (( "$ECOUNT" == "0" )); then if (( "$ECOUNT" == "0" )); then
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 exit 0
else else
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi

View File

@ -257,7 +257,7 @@ if [[ (-z "$TMPDIR") ]]; then
TMPDIR="$HOME/tmp" TMPDIR="$HOME/tmp"
else else
echo "Please set TMPDIR to a valid directory" echo "Please set TMPDIR to a valid directory"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
fi fi
@ -1949,19 +1949,19 @@ if true; then
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
else else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
fi fi
@ -1983,19 +1983,19 @@ if true; then
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
else else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
# Stop now if things are broke # Stop now if things are broke
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi
echo echo
fi fi
@ -7168,7 +7168,7 @@ echo
############################################ ############################################
# http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF # http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF
if (( "$ECOUNT" == "0" )); then if (( "$ECOUNT" == "0" )); then
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 exit 0
else else
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 exit 1
fi fi