From c7c713df66cf2049021ada3a5b6a82ba075e0a7d Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 4 Mar 2024 10:57:21 -0500 Subject: [PATCH] tests: fix unbound variables in env.sh When running a bash test script manually, the '_set_var_def' function expands the variables using their simple form resulting in an unbound variable error if they are undefined. Use the Default values form instead in the eval to fix these errors: tests/utils/env.sh: line 12: BT_TESTS_AWK_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_GREP_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_PYTHON_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_PYTHON_CONFIG_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_SED_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_CC_BIN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_ENABLE_ASAN: unbound variable tests/utils/env.sh: line 12: BT_TESTS_ENABLE_PYTHON_PLUGINS: unbound variable Change-Id: Ic4b2a3b97bd6a4d776ab6898959742ef77988332 Signed-off-by: Michael Jeanson Reviewed-on: https://review.lttng.org/c/babeltrace/+/11999 Tested-by: jenkins Reviewed-by: Philippe Proulx --- tests/utils/env.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/env.sh.in b/tests/utils/env.sh.in index 184389df..77e0c443 100644 --- a/tests/utils/env.sh.in +++ b/tests/utils/env.sh.in @@ -9,7 +9,7 @@ _set_var_def() { local -r varname=$1 local -r val=$2 - if [[ -z $(eval echo "\$$varname") ]]; then + if [[ -z $(eval echo "\${$varname:-}") ]]; then eval "$varname='$val'" fi -- 2.34.1