[tracker] functional-tests: No longer need to install DConf profile in /etc



commit 54e9a47e4eb78c78db729684ab64446e1144f216
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Thu May 16 10:53:12 2013 +0100

    functional-tests: No longer need to install DConf profile in /etc
    
    Since version 0.11.6 the DCONF_PROFILE environment variable can
    specify an absolute path, instead of requiring a file to be installed
    in /etc. This means the functional test suite can now be installed
    without requiring root.

 tests/functional-tests/Makefile.am            |    8 ++++----
 tests/functional-tests/common/utils/dconf.py  |   23 ++++++++++++++++++-----
 tests/functional-tests/common/utils/system.py |    3 ++-
 3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 73e5ef2..33b59a5 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -12,6 +12,9 @@ SUBDIRS = \
 
 configdir = $(datadir)/tracker-tests
 
+config_DATA = \
+       trackertest
+
 config_SCRIPTS = \
        __init__.py \
        $(slow_tests) \
@@ -23,9 +26,6 @@ config_SCRIPTS += \
        tracker-tests.aegis
 endif
 
-dconfdir = $(sysconfdir)/dconf/profile
-dconf_DATA = trackertest
-
 standard_tests = \
        01-insertion.py \
        02-sparql-bugs.py
@@ -98,7 +98,7 @@ functional-test-slow: ${slow_tests}
 
 EXTRA_DIST = \
        $(config_SCRIPTS) \
-       $(dconf_DATA) \
+       $(config_DATA) \
        create-tests-xml.py
 
 if HAVE_MAEMO
diff --git a/tests/functional-tests/common/utils/dconf.py b/tests/functional-tests/common/utils/dconf.py
index d918119..8a7978c 100644
--- a/tests/functional-tests/common/utils/dconf.py
+++ b/tests/functional-tests/common/utils/dconf.py
@@ -21,11 +21,23 @@ class DConfClient:
 
     def reset (self):
         profile = os.environ ["DCONF_PROFILE"]
-        assert profile == "trackertest"
-        # XDG_CONFIG_HOME is useless
-        dconf_db = os.path.join (os.environ ["HOME"], ".config", "dconf", profile)
+        if not os.path.exists(profile):
+            raise Exception(
+                "Unable to find DConf profile '%s'. Check that Tracker and "
+                "the test suite have been correctly installed (you must pass "
+                "--enable-functional-tests to configure)." % profile)
+
+        assert os.path.basename(profile) == "trackertest"
+
+        # XDG_CONFIG_HOME is useless, so we use HOME. This code should not be
+        # needed unless for some reason the test is not being run via the
+        # 'test-runner.sh' script.
+        dconf_db = os.path.join (os.environ ["HOME"],
+                                 ".config",
+                                 "dconf",
+                                 "trackertest")
         if os.path.exists (dconf_db):
-            log ("[Conf] Removing dconf-profile: " + dconf_db)
+            log ("[Conf] Removing dconf database: " + dconf_db)
             os.remove (dconf_db)
 
 
@@ -33,7 +45,8 @@ if __name__ == "__main__":
 
 
     SCHEMA_MINER = "org.freedesktop.Tracker.Miner.Files"
-    os.environ ["DCONF_PROFILE"] = "trackertest"
+    os.environ ["DCONF_PROFILE"] = os.path.join (cfg.DATADIR, "tracker-tests",
+                                                 "trackertest")
 
     dconf = DConfClient ()
     value = dconf.read (DConfClient.SCHEMA_MINER, "throttle")
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 3490b64..2509dfe 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -23,7 +23,8 @@ TEST_ENV_DIRS =  { "XDG_DATA_HOME" : os.path.join (cfg.TEST_TMP_DIR, "xdg-data-h
 
 TEST_ENV_VARS = {  "TRACKER_DISABLE_MEEGOTOUCH_LOCALE": "",
                    "LC_COLLATE": "en_GB.utf8",
-                   "DCONF_PROFILE": "trackertest"}
+                   "DCONF_PROFILE": os.path.join (cfg.DATADIR, "tracker-tests",
+                                                  "trackertest") }
 
 EXTRA_DIRS = [os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home", "tracker"),
               os.path.join (cfg.TEST_TMP_DIR, "xdg-cache-home", "tracker")]


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