X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Frun_python_bt2;h=574900a2c48c586484ec25c712b5cfd14d06b94c;hb=75e396f6b20bdf52c76a3c7312e7fb815ac1e5e9;hp=bd9f05f9782808782fe4b9187f045fe968385f0f;hpb=644e036445497ef69ccf946f0700da20a5bae84f;p=babeltrace.git diff --git a/tests/utils/run_python_bt2 b/tests/utils/run_python_bt2 index bd9f05f9..574900a2 100755 --- a/tests/utils/run_python_bt2 +++ b/tests/utils/run_python_bt2 @@ -1,30 +1,20 @@ #!/bin/bash # +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2017 Philippe Proulx # Copyright (C) 2019 Simon Marchi # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# # Execute a shell command in the appropriate environment to have access to the # bt2 Python bindings. For example, one could use it to run a specific Python # binding test case with: # -# $ ./run_python_bt2 python3 -m unittest test_values.MapValueTestCase.test_deepcopy +# $ tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \ +# -t test_value.MapValueTestCase.test_deepcopy \ +# ./tests/bindings/python/bt2 -if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then +if [ -n "${BT_TESTS_SRCDIR:-}" ]; then UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" else UTILSSH="$(dirname "$0")/../utils/utils.sh" @@ -43,8 +33,19 @@ usage() { echo "the path to the built 'tests' directory." } -if [ "x$*" = "x" ]; then +if [ -z "$*" ]; then usage -else - run_python_bt2 "${@}" + 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). + + If building out-of-tree, set BT_TESTS_BUILDDIR to point to the \`tests\` directory in the build tree. + END + exit 1 +fi + +run_python_bt2 "${@}"