tests: add python plugin provider path to lib search path
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 3 Jul 2019 19:46:14 +0000 (15:46 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 4 Jul 2019 21:28:06 +0000 (17:28 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1608
CI-Build: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
tests/python-plugin-provider/test_python_plugin_provider
tests/utils/utils.sh

index 978fcbc67f86f79a08d4f0ce468e640463539923..6dccd5ebd9a487aac76bc273b5f3e80bb3f12c02 100755 (executable)
@@ -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
index a66acd993f940a4e8a8185a3f9900691791682a2..4add2afa354f340f8a73802b5074c466152f2798 100644 (file)
@@ -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=()
This page took 0.026838 seconds and 4 git commands to generate.