[tracker-miners/sam/gsettings-from-host] functional-tests: Don't depend on GSettings schemas from the host



commit 7d40358707566485e1d76e66b1c92a7ad540faa4
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed May 1 12:03:10 2019 +0200

    functional-tests: Don't depend on GSettings schemas from the host
    
    If tracker-miners is configured with the `-Dtracker_core=subproject` option,
    it should use GSettings schemas from the ./subprojects/tracker build
    tree. We weren't doing that, which meant that if you ran `dnf remove
    tracker` on your test image and then ran the test, you would see
    failures like this in the functional-tests:
    
        (process:8450): GLib-GIO-ERROR **: 09:43:34.625: Settings schema 'org.freedesktop.Tracker.Store' is 
not installed
    
    This fix is part of https://gitlab.gnome.org/GNOME/tracker/issues/24

 data/meson.build                   | 38 ++++++++++++++++++++++++++++++++++++--
 meson.build                        |  3 +++
 tests/functional-tests/meson.build |  2 +-
 3 files changed, 40 insertions(+), 3 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 246c3fa25..ac103d0f3 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -27,9 +27,43 @@ tracker_miners_settings_enums = custom_target('tracker-miners-common-settings-en
     install: true,
     install_dir: gsettings_schema_dir)
 
-# for unit tests
+
+# Compile schemas locally so that the functional-tests can use them without
+# them being installed into /usr.
+#
+compile_schemas_deps = [tracker_miners_settings_enums]
+if get_option('tracker_core') == 'subproject'
+  # Here we do an ugly dance to place GSettings schemas from tracker
+  # and tracker-miners into the same directory. The `glib-compile-schemas`
+  # tool cannot combine schemas from multiple directories, and the
+  # GSETTINGS_SCHEMA_DIR environment variable cannot point to multiple
+  # directories, so this appears to be our only option.
+
+  foreach schema : tracker_gsettings_schemas
+    target = configure_file(
+      input: schema,
+      output: '@PLAINNAME@',
+      copy: true)
+  endforeach
+
+  dep = custom_target('tracker-store-settings-enums',
+    input: tracker_common_enums_header,
+    output: 'org.freedesktop.Tracker.enums.xml',
+    command: [glib_mkenums,
+              '--comments', '<!-- @comment@ -->',
+              '--fhead', '<schemalist>',
+              '--vhead', '<@type@ id="org.freedesktop.Tracker.@EnumName@">',
+              '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+              '--vtail', '  </@type@>',
+              '--ftail', '</schemalist>', '@INPUT@'],
+    capture: true)
+  compile_schemas_deps += [dep]
+endif
+
 custom_target('tracker-miners-compile-schemas',
   output: 'gschemas.compiled',
   command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
   build_by_default: true,
-  depends: tracker_miners_settings_enums)
+  depends: compile_schemas_deps)
+
+tracker_miners_uninstalled_gsettings_schema_dir = meson.current_build_dir()
diff --git a/meson.build b/meson.build
index 75134dc70..0495f3746 100644
--- a/meson.build
+++ b/meson.build
@@ -55,6 +55,9 @@ else
   tracker_uninstalled_domain_rule = tracker_subproject.get_variable('tracker_uninstalled_domain_rule')
   tracker_uninstalled_nepomuk_ontologies_dir = 
tracker_subproject.get_variable('tracker_uninstalled_nepomuk_ontologies_dir')
   tracker_uninstalled_stop_words_dir = tracker_subproject.get_variable('tracker_uninstalled_stop_words_dir')
+
+  tracker_common_enums_header = tracker_subproject.get_variable('tracker_common_enums_header')
+  tracker_gsettings_schemas = tracker_subproject.get_variable('tracker_gsettings_schemas')
 endif
 
 avcodec = dependency('libavcodec', version: '>= 0.8.4', required: false)
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 355d4bd66..9e458552e 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -69,7 +69,7 @@ tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src'
 
 test_env = environment()
 test_env.set('DCONF_PROFILE', dconf_profile_full_path)
-test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
+test_env.set('GSETTINGS_SCHEMA_DIR', tracker_miners_uninstalled_gsettings_schema_dir)
 
 test_env.set('TRACKER_DB_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir)
 test_env.set('TRACKER_EXTRACTORS_DIR', tracker_extractors_dir)


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