diff options
author | Xiretza <xiretza@xiretza.xyz> | 2021-04-27 18:15:20 +0200 |
---|---|---|
committer | Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> | 2021-04-27 19:39:03 +0200 |
commit | 4ca59b2496725c6b45904ce5d5d852e5703adc36 (patch) | |
tree | 6a624c00293100152dcddfaa7b2add84d93e71f7 | |
parent | ccde14e39a92f7a3f7ea738213a48e65454fd1fa (diff) | |
download | ghdl-4ca59b2496725c6b45904ce5d5d852e5703adc36.tar.gz ghdl-4ca59b2496725c6b45904ce5d5d852e5703adc36.tar.bz2 ghdl-4ca59b2496725c6b45904ce5d5d852e5703adc36.zip |
testsuite: add die() function
-rwxr-xr-x | testsuite/testsuite.sh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/testsuite/testsuite.sh b/testsuite/testsuite.sh index 947cc7d6f..4c454d35c 100755 --- a/testsuite/testsuite.sh +++ b/testsuite/testsuite.sh @@ -19,6 +19,11 @@ enable_color() { disable_color() { unset ENABLECOLOR ANSI_RED ANSI_GREEN ANSI_YELLOW ANSI_BLUE ANSI_MAGENTA ANSI_CYAN ANSI_DARKCYAN ANSI_NOCOLOR; } enable_color +die() { + printf "${ANSI_RED}%s${ANSI_NOCOLOR}\n" "$@" >&2 + exit 1 +} + print_start() { COL="$ANSI_YELLOW" if [ "x$2" != "x" ]; then @@ -78,8 +83,7 @@ if [ "x$GHDL" = "x" ]; then elif [ "x$(command -v which)" != "x" ]; then export GHDL="$(which ghdl)" else - printf "${ANSI_RED}error: GHDL environment variable is not defined${ANSI_NOCOLOR}\n" - exit 1 + die "error: GHDL environment variable is not defined" fi fi @@ -125,8 +129,8 @@ do_test() { _vests ;; *) - printf "${ANSI_RED}$0: test name '$1' is unknown${ANSI_NOCOLOR}\n" - exit 1;; + die "$0: test name '$1' is unknown" + ;; esac } |