From: Francis Deslauriers Date: Fri, 7 Feb 2020 19:56:50 +0000 (-0500) Subject: Fix: Tests: utils.sh: fix unbound variable X-Git-Tag: v2.12.0-rc2~67 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=746aa688d21337d8985e9f6b13c9d2cb4ff8e424;p=lttng-tools.git Fix: Tests: utils.sh: fix unbound variable 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 --- diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 1ad2001ed..d0f76bc6f 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -36,7 +36,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