X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=dc4dbdc74e0b9c464173ad8b3f0cf3061792184d;hb=4a1628932a4f566033bd1e06add80f0b79482c46;hp=4e033b79d989a0c3a1b4e3ca16a3440fa728f635;hpb=e612f2daa6b262796ca0750754142f0abd686f1d;p=babeltrace.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 4e033b79..dc4dbdc7 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -95,11 +95,18 @@ _set_vars_srcdir_builddir() { _set_vars_srcdir_builddir unset -f _set_vars_srcdir_builddir -# Source the generated environment file if it's present -if [ -f "${BT_TESTS_BUILDDIR}/utils/env.sh" ]; then - # shellcheck disable=SC1091 - . "${BT_TESTS_BUILDDIR}/utils/env.sh" -fi +# Sources the generated environment file (`env.sh`) if it exists. +_source_env_sh() { + local -r env_sh_path="$BT_TESTS_BUILDDIR/utils/env.sh" + + if [ -f "${env_sh_path}" ]; then + # shellcheck disable=SC1090,SC1091 + . "${env_sh_path}" + fi +} + +_source_env_sh +unset -f _source_env_sh # Path to the `babeltrace2` command, if not set if [ -z "${BT_TESTS_BT2_BIN:-}" ]; then