diff options
author | Gavin Howard <yzena.tech@gmail.com> | 2019-04-11 12:23:03 -0600 |
---|---|---|
committer | Gavin Howard <yzena.tech@gmail.com> | 2019-04-11 12:23:03 -0600 |
commit | 8237f800ec5960d0deb7c30568086570e8491c64 (patch) | |
tree | 79a772fb15e60fcf02254d89f870eccd6a143275 /functions.sh | |
parent | b599475040b09a58a3105dd6fba91095cb15a310 (diff) | |
download | bc-8237f800ec5960d0deb7c30568086570e8491c64.tar.gz |
Make misc tests also test for crash
Diffstat (limited to 'functions.sh')
-rwxr-xr-x | functions.sh | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/functions.sh b/functions.sh index 1bfa0ad1..c3718180 100755 --- a/functions.sh +++ b/functions.sh @@ -51,6 +51,18 @@ readlink() { printf '%s' "${f##*$d/}" } +err_exit() { + + if [ "$#" -ne 2 ]; then + printf 'Invalid number of args to err_exit\n' + exit 1 + fi + + printf '%s\n' "$1" + printf '\nexiting...\n' + exit "$2" +} + die() { local d="$1" @@ -65,13 +77,9 @@ die() { local err="$1" shift - printf '\n' - printf '%s %s on test:\n' "$d" "$msg" - printf '\n' - printf ' %s\n' "$name" - printf '\n' - printf 'exiting...\n' - exit "$err" + str=$(printf '\n%s %s on test:\n\n %s\n' "$d" "$msg" "$name") + + err_exit "$str" "$err" } checkcrash() { @@ -83,7 +91,7 @@ checkcrash() { shift if [ "$error" -gt 127 ]; then - die "$d" "crashed" "$name" "$error" + die "$d" "crashed ($error)" "$name" "$error" fi } |