[folks] Make tests use local GConf config and store.



commit bb6b6ff44a211c1df55b4a00a41564c49b9f89e8
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Fri Jan 14 14:50:43 2011 -0800

    Make tests use local GConf config and store.
    
    This avoids reading or writing the user's GConf store and lets us start from a
    consistent state when running tests (required for repeatability).

 configure.ac             |    1 +
 tests/data/Makefile.am   |   14 ++++++++++++
 tests/data/gconf.path.in |   51 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/folks/Makefile.am  |    1 +
 4 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 15c4def..6c51708 100644
--- a/configure.ac
+++ b/configure.ac
@@ -361,6 +361,7 @@ AC_CONFIG_FILES([
     po/Makefile.in
     tests/Makefile
     tests/data/Makefile
+    tests/data/gconf.path
     tests/folks/Makefile
     tests/key-file/Makefile
     tests/telepathy/Makefile
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index a2b9838..ced9376 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -2,4 +2,18 @@ EXTRA_DIST = \
 	backend-store-all.ini \
 	$(NULL)
 
+clean-gconf:
+	rm -rf gconf.d
+
+clean-local: clean-gconf
+
+check: clean-gconf
+
+GITIGNOREFILES = \
+	gconf.d \
+	gconf.path \
+	$(NULL)
+
+.PHONY: clean-gconf clean-local
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/data/gconf.path.in b/tests/data/gconf.path.in
new file mode 100644
index 0000000..36b92cf
--- /dev/null
+++ b/tests/data/gconf.path.in
@@ -0,0 +1,51 @@
+# These settings set up gconf in a sandbox for our tests for a few reasons:
+#
+#  1. So we don't read or mangle the $USER's gconf settings
+#
+#  2. To have a consistent state every time we run the tests for
+#     repeatability
+#
+# Note that we still source the system settings to hopefully play nicely
+# with unusual (yet valid) set-ups. We can't source /etc/gconf/2/path directly
+# since it will pull in various config paths in $(HOME).
+#
+# This is based on the default /etc/gconf/2/path
+###########################################################################
+
+######################
+# 1. Forced settings #
+######################
+
+# Settings forced by the local administrator
+xml:readonly:/etc/gconf/gconf.xml.mandatory
+
+# Other forced sources imagined by the local administrator
+include /etc/gconf/2/local-mandatory.path
+
+#######################
+# 2. User Preferences #
+#######################
+
+# our in-tree writeable directory for these tests
+xml:readwrite:@abs_top_srcdir@/tests/data/gconf.d
+
+# mandatory path for desktop-profiles
+include $(ENV_MANDATORY_PATH)
+
+# default path for desktop-profiles
+include $(ENV_DEFAULTS_PATH)
+
+######################
+# 3. System defaults #
+######################
+
+# Other default sources imagined by the local administrator
+include /etc/gconf/2/local-defaults.path
+
+# System administrator's defaults. This source also serves as a legacy
+# source for packages not using a recent dh_gconf, or for applications
+# installed by hand.
+xml:readonly:/etc/gconf/gconf.xml.defaults
+
+# Upstream application defaults
+xml:readonly:/var/lib/gconf/defaults
diff --git a/tests/folks/Makefile.am b/tests/folks/Makefile.am
index 4f22112..b3111ac 100644
--- a/tests/folks/Makefile.am
+++ b/tests/folks/Makefile.am
@@ -48,6 +48,7 @@ noinst_PROGRAMS = \
 SESSION_CONF = $(top_builddir)/tests/lib/telepathy/contactlist/session.conf
 backend_store_key_file=$(top_srcdir)/tests/data/backend-store-all.ini
 TESTS_ENVIRONMENT = \
+	GCONF_DEFAULT_SOURCE_PATH= abs_top_srcdir@/tests/data/gconf.path \
 	FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
 	FOLKS_BACKEND_STORE_KEY_FILE_PATH=$(backend_store_key_file) \
 	$(RUN_WITH_PRIVATE_BUS) \



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