From ae7f2cf2fa9cfde5ae16138db96c177115022b95 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 10 Nov 2023 09:03:15 -0500 Subject: [PATCH] tests/utils/utils.sh: run_python_bt2() -> bt_run_in_py_env() Adding the `bt_` prefix like other functions in `utils.sh` and renaming the rest to indicate that it runs something in a specific environment, not necessarily Python itself. Signed-off-by: Philippe Proulx Change-Id: I5635f04f494c50e1955a27adaae28f964c336bf3 --- tests/lib/test-fields.sh | 2 +- tests/plugins/sink.text.pretty/test-enum.sh | 2 +- tests/utils/run-python-bt2.sh | 2 +- tests/utils/utils.sh | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/lib/test-fields.sh b/tests/lib/test-fields.sh index 166d4b2b..b0d6772e 100755 --- a/tests/lib/test-fields.sh +++ b/tests/lib/test-fields.sh @@ -14,4 +14,4 @@ fi # shellcheck source=../utils/utils.sh source "$UTILSSH" -run_python_bt2 "${BT_TESTS_BUILDDIR}/lib/test-fields-bin" +bt_run_in_py_env "${BT_TESTS_BUILDDIR}/lib/test-fields-bin" diff --git a/tests/plugins/sink.text.pretty/test-enum.sh b/tests/plugins/sink.text.pretty/test-enum.sh index f91abb5f..fb68ca49 100755 --- a/tests/plugins/sink.text.pretty/test-enum.sh +++ b/tests/plugins/sink.text.pretty/test-enum.sh @@ -35,7 +35,7 @@ function compare_enum_sorted # data structures differently (e.g. dictionaries are insertion sorted # since Python 3.7). - run_python_bt2 "${BT_TESTS_PYTHON_BIN}" "${BT_TESTS_SRCDIR}/utils/python/split_sort_compare.py" \ + bt_run_in_py_env "${BT_TESTS_PYTHON_BIN}" "${BT_TESTS_SRCDIR}/utils/python/split_sort_compare.py" \ "$(cat "$expected_file")" "$(cat "$actual_file")" } diff --git a/tests/utils/run-python-bt2.sh b/tests/utils/run-python-bt2.sh index 574900a2..ada27642 100755 --- a/tests/utils/run-python-bt2.sh +++ b/tests/utils/run-python-bt2.sh @@ -48,4 +48,4 @@ if [ ! -f "$BT_TESTS_BUILDDIR/Makefile" ]; then exit 1 fi -run_python_bt2 "${@}" +bt_run_in_py_utils_bt2_env "${@}" diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index a4e7aae1..b14b8064 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -128,7 +128,7 @@ fi export BT_TESTS_BT2_BIN # This doesn't need to be exported, but it needs to remain set for -# run_python_bt2() to use it. +# bt_run_in_py_env() to use it. # # TODO: Remove when `tests/bindings/python/bt2/test_plugin.py` is fixed. _bt_tests_plugins_path=$BT_TESTS_BUILDDIR/../src/plugins @@ -222,7 +222,7 @@ bt_cli() { local -r args=("$@") echo "Running: \`$BT_TESTS_BT2_BIN ${args[*]}\`" >&2 - run_python_bt2 "$BT_TESTS_BT2_BIN" "${args[@]}" 1>"$stdout_file" 2>"$stderr_file" + bt_run_in_py_env "$BT_TESTS_BT2_BIN" "${args[@]}" 1>"$stdout_file" 2>"$stderr_file" } # Checks the differences between: @@ -391,7 +391,7 @@ bt_run_in_py_utils_env() { # Executes a command within an environment which can import the testing # Python modules (in `tests/utils/python`) and the `bt2` Python package. -run_python_bt2() { +bt_run_in_py_env() { local -x BABELTRACE_PLUGIN_PATH=$BT_TESTS_BABELTRACE_PLUGIN_PATH local -x LIBBABELTRACE2_PLUGIN_PROVIDER_DIR=$BT_TESTS_PROVIDER_DIR local -x BT_TESTS_DATADIR=$BT_TESTS_DATADIR @@ -442,7 +442,7 @@ run_python_bt2() { # Runs the Python tests matching the pattern `$2` (optional, `*` if # missing) in the directory `$1` using `testrunner.py`. # -# This function uses run_python_bt2(), therefore such tests can import +# This function uses bt_run_in_py_env(), therefore such tests can import # the testing Python modules (in `tests/utils/python`) and the `bt2` # Python package. run_python_bt2_test() { @@ -456,7 +456,7 @@ run_python_bt2_test() { python_exec=$BT_TESTS_PYTHON_BIN fi - run_python_bt2 \ + bt_run_in_py_env \ "$python_exec" "$BT_TESTS_SRCDIR/utils/python/testrunner.py" \ --pattern "$test_pattern" "$test_dir" -- 2.34.1