X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Frun_python_bt2;fp=tests%2Futils%2Frun_python_bt2;h=bd9f05f9782808782fe4b9187f045fe968385f0f;hb=644e036445497ef69ccf946f0700da20a5bae84f;hp=0000000000000000000000000000000000000000;hpb=86f0fb5572a6a96b815793f7e39901047aac2ba9;p=babeltrace.git diff --git a/tests/utils/run_python_bt2 b/tests/utils/run_python_bt2 new file mode 100755 index 00000000..bd9f05f9 --- /dev/null +++ b/tests/utils/run_python_bt2 @@ -0,0 +1,50 @@ +#!/bin/bash +# +# 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 + +if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then + UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" +else + UTILSSH="$(dirname "$0")/../utils/utils.sh" +fi + +# shellcheck source=../utils/utils.sh +source "$UTILSSH" + +usage() { + echo "Usage: run_python_bt2 [PYTHON_BIN] ..." + echo "" + echo "Run a binary with the python environment set to use the 'bt2' module" + echo "from the build system prior to installation." + echo "" + echo "When building out of tree export the BT_TESTS_BUILDDIR variable with" + echo "the path to the built 'tests' directory." +} + +if [ "x$*" = "x" ]; then + usage +else + run_python_bt2 "${@}" +fi