[tracker: 1/2] Make tracker:endpoint test work on macOS




commit 51ca035697a4cdbf8bf6849cc67dc8d462358a05
Author: Daniele Nicolodi <daniele grinta net>
Date:   Sun Apr 18 13:54:18 2021 +0200

    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 +++++----
 meson.build                        | 6 ++++++
 tests/functional-tests/meson.build | 5 -----
 3 files changed, 11 insertions(+), 9 deletions(-)
---
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
diff --git a/meson.build b/meson.build
index d37ed4511..43935b803 100644
--- a/meson.build
+++ b/meson.build
@@ -65,6 +65,12 @@ if get_option('man')
   xsltproc = find_program('xsltproc')
 endif
 
+py_modules = ['gi']
+if get_option('tests_tap_protocol')
+  py_modules += 'tap'
+endif
+python = import('python').find_installation('python3', modules: py_modules)
+
 add_project_arguments('-Wformat', '-Wformat-security', language: 'c')
 
 # There are various gchar vs. unsigned char warnings that occur in extract
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 921a88386..c0a3b4bd6 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -1,14 +1,9 @@
-modules = ['gi']
-
 if get_option('tests_tap_protocol')
   protocol = 'tap'
-  modules += 'tap'
 else
   protocol = 'exitcode'
 endif
 
-python = import('python').find_installation('python3', modules: modules)
-
 testconf = configuration_data()
 
 config_json_full_path = join_paths(meson.current_build_dir(), 'configuration.json')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]