diff options
-rwxr-xr-x | test/001-error-no-args.test/run.sh | 3 | ||||
-rwxr-xr-x | test/002-test-key-name.test/run.sh | 11 | ||||
-rw-r--r-- | test/003-test-invalid-char.test/run.sh | 4 | ||||
-rwxr-xr-x | test/run-tests.sh | 3 |
4 files changed, 8 insertions, 13 deletions
diff --git a/test/001-error-no-args.test/run.sh b/test/001-error-no-args.test/run.sh index fae5bd4..693ea48 100755 --- a/test/001-error-no-args.test/run.sh +++ b/test/001-error-no-args.test/run.sh @@ -1,7 +1,6 @@ #!/bin/sh -${EXECUTABLE} -A -if [ $? -eq 0 ]; then +if ${EXECUTABLE} -A ; then exit 1 else exit 0 diff --git a/test/002-test-key-name.test/run.sh b/test/002-test-key-name.test/run.sh index aa2adca..0f7df69 100755 --- a/test/002-test-key-name.test/run.sh +++ b/test/002-test-key-name.test/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -13,15 +13,15 @@ key="$(mktemp)" stderr="$(mktemp)" # Four character search should be a < 1 second CPU burst for CI runner -${EXECUTABLE} -s site > $key 2>$stderr +${EXECUTABLE} -s site > "$key" 2>"$stderr" -found=($(tr '\r' '\n' < $stderr | grep Found | cut -d ' ' -f 3)) +mapfile -t found < <(tr '\r' '\n' < "$stderr" | grep Found | cut -d ' ' -f 3) echo "sand-leek says it found ${found[*]}..." # Trick adapted to py3 from https://swehack.org/viewtopic.php?f=37&p=6978 real="$( \ - openssl rsa -in $key -pubout -outform DER \ + openssl rsa -in "$key" -pubout -outform DER \ | tail -c +23 \ | $SHASUM \ | head -c 20 \ @@ -33,8 +33,7 @@ echo "Key analysis shows it's for ${real}" for f in "${found[@]}" ; do if [ "$f" == "$real" ] ; then echo "Found a match, I'm happy" - rm $key - rm $stderr + rm -- "$key" "$stderr" exit 0 fi done diff --git a/test/003-test-invalid-char.test/run.sh b/test/003-test-invalid-char.test/run.sh index 3bb0152..a92e6c6 100644 --- a/test/003-test-invalid-char.test/run.sh +++ b/test/003-test-invalid-char.test/run.sh @@ -1,8 +1,6 @@ #!/bin/sh -${EXECUTABLE} -A -s foovalid1not - -if [ $? -eq 0 ]; then +if ${EXECUTABLE} -A -s foovalid1not ; then exit 1 else exit 0 diff --git a/test/run-tests.sh b/test/run-tests.sh index 68a3adf..d6a1473 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -1,5 +1,4 @@ -#!/bin/bash - +#!/bin/bash -e fail() { |