From c70fe895864e27ac4426ee2e92d5c9f168d0325a Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 7 Feb 2020 14:56:50 -0500 Subject: [PATCH] Fix: Tests: utils.sh: fix unbound variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When loading `utils.sh`, we test the `LTTNG_TEST_TEARDOWN_TIMEOUT` and define it to a default value if it's not defined already. When running bash test scripts with the `-u` option to error out when encountering unset variables it prints an error and exit This commit uses a trick found here: https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash Signed-off-by: Francis Deslauriers Change-Id: Id24937f974ffd1ab3250296499da9360f97d393d Signed-off-by: Jérémie Galarneau --- tests/utils/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index dbb0b4b68..57e90fce9 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -46,7 +46,7 @@ export LTTNG_SESSIOND_PATH="/bin/true" source $TESTDIR/utils/tap/tap.sh -if [ -z $LTTNG_TEST_TEARDOWN_TIMEOUT ]; then +if [ -z ${LTTNG_TEST_TEARDOWN_TIMEOUT+x} ]; then LTTNG_TEST_TEARDOWN_TIMEOUT=60 fi -- 2.34.1