From 0408934a2ff110ed1c5bf3719ae6b650b5834146 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 3 Jul 2019 15:46:14 -0400 Subject: [PATCH] tests: add python plugin provider path to lib search path I am working on a test that uses a component class implemented in a Python plugin. For it to work, babeltrace therefore needs to be able to load the python plugin provider lib. It currently isn't found: LIB/PLUGIN init_python_plugin_provider@plugin.c:84 Loading Python plugin provider module. LIB/PLUGIN init_python_plugin_provider@plugin.c:94 Cannot open `libbabeltrace2-python-plugin-provider.so`: libbabeltrace2-python-plugin -provider.so: cannot open shared object file: No such file or directory: continuing without Python plugin support. This patch makes run_python_bt2 add the right path to LD_LIBRARY_PATH (PATH on Windows) so that babeltrace can load python plugins. With this added we don't need the feature of run_python_bt2 and run_python_bt2 that allowed to append an additional directory to LD_LIBRARY_PATH, so it is removed. Change-Id: Ie72f59c9ef4866c7f0eae0e6f49025d2fa1ba127 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1608 CI-Build: Michael Jeanson Reviewed-by: Michael Jeanson Reviewed-by: Philippe Proulx Tested-by: jenkins --- .../test_python_plugin_provider | 3 +-- tests/utils/utils.sh | 12 +++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/python-plugin-provider/test_python_plugin_provider b/tests/python-plugin-provider/test_python_plugin_provider index 978fcbc6..6dccd5eb 100755 --- a/tests/python-plugin-provider/test_python_plugin_provider +++ b/tests/python-plugin-provider/test_python_plugin_provider @@ -30,5 +30,4 @@ export PYTHON_PLUGIN_PROVIDER_TEST_PLUGIN_PATH="${BT_TESTS_SRCDIR}/python-plugin run_python_bt2_test \ "${BT_TESTS_SRCDIR}/python-plugin-provider" \ - test_python_plugin_provider.py \ - "${BT_TESTS_BUILDDIR}/../src/python-plugin-provider/.libs" + test_python_plugin_provider.py diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index a66acd99..4add2afa 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -194,16 +194,16 @@ run_python_bt2() { local lib_search_var local lib_search_path + local python_provider_path="${BT_TESTS_BUILDDIR}/../src/python-plugin-provider/.libs" + local main_lib_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs" + # Set the library search path so the python interpreter can load libbabeltrace2 if [ "x${MSYSTEM:-}" != "x" ]; then lib_search_var="PATH" - lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${PATH:-}" + lib_search_path="${python_provider_path}:${main_lib_path}:${PATH:-}" else lib_search_var="LD_LIBRARY_PATH" - lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${LD_LIBRARY_PATH:-}" - fi - if [ "x${test_lib_search_path:-}" != "x" ]; then - lib_search_path+=":${test_lib_search_path}" + lib_search_path="${python_provider_path}:${main_lib_path}:${LD_LIBRARY_PATH:-}" fi env \ @@ -220,11 +220,9 @@ run_python_bt2() { # # $1 : The directory containing the python test scripts # $2 : The pattern to match python test script names (optional) -# $3 : Additionnal library search path (optional) run_python_bt2_test() { local test_dir="$1" local test_pattern="${2:-}" # optional - local test_lib_search_path="${3:-}" # optional local ret local test_runner_args=() -- 2.34.1