X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Frun-in-py-env.sh;h=c5266542cf4bdfe27feec3989f8579e8fae50789;hb=579b3f153e54a498557866a7b3ef571a4893b8e9;hp=86d5eeb28d5b00d1a75a01ff67b7129abb1dced7;hpb=7f03322daca6a95144086cf3e9a70081089189c1;p=babeltrace.git diff --git a/tests/utils/run-in-py-env.sh b/tests/utils/run-in-py-env.sh index 86d5eeb2..c5266542 100755 --- a/tests/utils/run-in-py-env.sh +++ b/tests/utils/run-in-py-env.sh @@ -5,14 +5,14 @@ # Copyright (C) 2017-2023 Philippe Proulx # Copyright (C) 2019 Simon Marchi -if [[ -n "${BT_TESTS_SRCDIR:-}" ]]; then - UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" +if [[ -n ${BT_TESTS_SRCDIR:-} ]]; then + utils_sh=$BT_TESTS_SRCDIR/utils/utils.sh else - UTILSSH="$(dirname "$0")/../utils/utils.sh" + utils_sh=$(dirname "$0")/../utils/utils.sh fi # shellcheck source=../utils/utils.sh -source "$UTILSSH" +source "$utils_sh" usage() { echo "Usage: run-in-py-utils-bt2-env.sh COMMAND [ARGS]..." @@ -25,19 +25,22 @@ usage() { echo "environment variable to the built \`tests\` directory." } -if [[ -z "$*" ]]; then +if (($# == 0)); then usage exit 1 fi -# Sanity check that the BT_TESTS_BUILDDIR value makes sense. -if [[ ! -f "$BT_TESTS_BUILDDIR/Makefile" ]]; then - fold -w 80 -s <<- END - $0: BT_TESTS_BUILDDIR does not point to a valid directory (\`$BT_TESTS_BUILDDIR/Makefile\` does not exist). +# Make sure the value of `BT_TESTS_BUILDDIR` makes sense +if [[ ! -f $BT_TESTS_BUILDDIR/Makefile ]]; then + { + echo "ERROR: Invalid \`BT_TESTS_BUILDDIR\` variable (\`\$BT_TESTS_BUILDDIR/Makefile\`" + echo "doesn't exist)." + echo "" + echo "If you build out of tree, export and set the \`BT_TESTS_BUILDDIR\` environment" + echo "variable to the built \`tests\` directory." + } >&2 - If building out-of-tree, set BT_TESTS_BUILDDIR to point to the \`tests\` directory in the build tree. - END exit 1 fi -bt_run_in_py_env "${@}" +bt_run_in_py_env "$@"