tests/utils: `run-python-bt2.sh` -> `run-in-py-env.sh`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 10 Nov 2023 14:09:21 +0000 (09:09 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 7 Feb 2024 21:25:56 +0000 (16:25 -0500)
This makes it consistent with the underlying Bash function name and
indicates that it doesn't need to run Python itself.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If030bcea8349edc4d4ba1425a64778c08227101d

CONTRIBUTING.adoc
tests/utils/Makefile.am
tests/utils/run-in-py-env.sh [new file with mode: 0755]
tests/utils/run-python-bt2.sh [deleted file]

index 268c4445ae4e8b3f33db45a8a2654e2c20edd17d..c31f9a89f403e3a4548599ff564ead11ad78f3c8 100644 (file)
@@ -1505,11 +1505,11 @@ $ ./tests/plugins/sink.text.pretty/test-enum.sh
 
 ==== Python
 
-You can use the `tests/utils/run-python-bt2.sh` script to run any
-command within an environment making the build's `bt2` Python package
-available.
+You can use the `tests/utils/run-in-py-env.sh` script to run any command
+within an environment making the build's `bt2` Python package available,
+as well as the testing utility Python modules.
 
-`run-python-bt2.sh` uses <<test-env,`utils.sh`>> which needs to know the
+`run-in-py-env.sh` uses <<test-env,`utils.sh`>> which needs to know the
 build directory, so make sure you set the `BT_TESTS_BUILDDIR`
 environment variable correctly _if you build out of tree_, for example:
 
@@ -1518,10 +1518,10 @@ $ export BT_TESTS_BUILDDIR=/path/to/build/babeltrace/tests
 ----
 
 You can run any command which needs the `bt2` Python package through
-`run-python-bt2.sh`, for example:
+`run-in-py-env.sh`, for example:
 
 ----
-$ ./tests/utils/run-python-bt2.sh ipython3
+$ ./tests/utils/run-in-py-env.sh ipython3
 ----
 
 === Report format
@@ -1567,13 +1567,13 @@ To run all the `bt2` Python package tests:
 * Run:
 +
 ----
-$ ./tests/utils/run-python-bt2.sh ./tests/bindings/python/bt2/test-python-bt2.sh
+$ ./tests/utils/run-in-py-env.sh ./tests/bindings/python/bt2/test-python-bt2.sh
 ----
 +
 or:
 +
 ----
-$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-in-py-env.sh python3 ./tests/utils/python/testrunner.py \
   ./tests/bindings/python/bt2/ -p '*.py'
 ----
 
@@ -1583,7 +1583,7 @@ To run **all the tests** in a test module (for example,
 * Run:
 +
 ----
-$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-in-py-env.sh python3 ./tests/utils/python/testrunner.py \
   ./tests/bindings/python/bt2 -t test_value
 ----
 
@@ -1593,7 +1593,7 @@ To run a **specific test case** (for example, `RealValueTestCase` within
 * Run:
 +
 ----
-$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-in-py-env.sh python3 ./tests/utils/python/testrunner.py \
   ./tests/bindings/python/bt2/ -t test_value.RealValueTestCase
 ----
 
@@ -1603,7 +1603,7 @@ To run a **specific test** (for example,
 * Run:
 +
 ----
-$ ./tests/utils/run-python-bt2.sh python3 ./tests/utils/python/testrunner.py \
+$ ./tests/utils/run-in-py-env.sh python3 ./tests/utils/python/testrunner.py \
   ./tests/bindings/python/bt2/ -t test_value.RealValueTestCase.test_assign_pos_int
 ----
 
index 63ad1087ec53e3b981a72d8a0c718471d7cb5b8b..e7065be2a4251174a4b005a9c238be5742ed750c 100644 (file)
@@ -10,6 +10,6 @@ libtestcommon_la_SOURCES = common.c common.h
 EXTRA_DIST = python
 
 dist_check_SCRIPTS = \
-       run-python-bt2.sh \
+       run-in-py-env.sh \
        tap-driver.sh \
        utils.sh
diff --git a/tests/utils/run-in-py-env.sh b/tests/utils/run-in-py-env.sh
new file mode 100755 (executable)
index 0000000..2168f87
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
+# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
+#
+
+# 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:
+#
+#   $ tests/utils/run-in-py-utils-bt2-env.sh python3 ./tests/utils/python/testrunner.py \
+#     -t test_value.MapValueTestCase.test_deepcopy \
+#     ./tests/bindings/python/bt2
+
+if [ -n "${BT_TESTS_SRCDIR:-}" ]; 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-in-py-utils-bt2-env.sh [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 [ -z "$*" ]; 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).
+
+       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 "${@}"
diff --git a/tests/utils/run-python-bt2.sh b/tests/utils/run-python-bt2.sh
deleted file mode 100755 (executable)
index ada2764..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
-# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
-#
-
-# 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:
-#
-#   $ tests/utils/run_python_bt2 python3 ./tests/utils/python/testrunner.py \
-#     -t test_value.MapValueTestCase.test_deepcopy \
-#     ./tests/bindings/python/bt2
-
-if [ -n "${BT_TESTS_SRCDIR:-}" ]; 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 [ -z "$*" ]; 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).
-
-       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_utils_bt2_env "${@}"
This page took 0.03076 seconds and 4 git commands to generate.