From 51ca035697a4cdbf8bf6849cc67dc8d462358a05 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Sun, 18 Apr 2021 13:54:18 +0200 Subject: Make tracker:endpoint test work on macOS The symptom on my system are that the test fails to run because gi cannot find the shared library object for Tracker. This is due to the fact that $LD_LIBRARY_PATH is set by Meson but removed from the environment by the time the test is running. This is because the examples/python/endpoint.py scripts which uses '!#/usr/bin/env python' as a shebang and on macOS the env utility removes dynamic linker variables from the environment. Fix this by explicitly using python to execute the script. Use this opportunity for restructure how the Python installation and executable is looked up in the build definition: use the 'python' Meson module to lock for a suitable python in the main meson.build. Also, the test setup does not set $TRACKER_LANGUAGE_STOP_WORDS_DIR to point to the stop words directory in the source directory. Fix it. --- examples/python/meson.build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/python/meson.build b/examples/python/meson.build index 39c464520..47bac5af0 100644 --- a/examples/python/meson.build +++ b/examples/python/meson.build @@ -1,13 +1,14 @@ -python = find_program('python3') - env = environment() env.prepend('GI_TYPELIB_PATH', tracker_sparql_uninstalled_dir) env.prepend('LD_LIBRARY_PATH', tracker_sparql_uninstalled_dir) env.prepend('PYTHONPATH', tracker_uninstalled_testutils_dir) env.set('TRACKER_EXAMPLES_AUTOMATED_TEST', '1') env.set('TEST_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir) +env.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', join_paths(source_root, 'src', 'libtracker-common', 'stop-words')) -sandbox_python_args = ['-m', 'trackertestutils', '--store-tmpdir', '--dbus-config', meson.current_build_dir() / '..' / '..' / 'tests' / 'test-bus.conf'] +sandbox_python_args = ['-m', 'trackertestutils', + '--store-tmpdir', + '--dbus-config', meson.current_build_dir() / '..' / '..' / 'tests' / 'test-bus.conf'] examples = [ 'endpoint', @@ -16,7 +17,7 @@ examples = [ foreach example_name: examples file = meson.current_source_dir() / '@0@.py'.format(example_name) test(example_name, python, - args: sandbox_python_args + [file], + args: sandbox_python_args + [python.path(), file], env: env, suite: 'examples') endforeach -- cgit v1.2.1