Set up tests' backend paths in Vala code
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 26 Mar 2013 18:15:00 +0000 (18:15 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 26 Mar 2013 19:04:06 +0000 (19:04 +0000)
One less thing in TESTS_ENVIRONMENT.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=690830
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
configure.ac
folks/build-conf.vapi
tests/eds/Makefile.am
tests/folks/Makefile.am
tests/key-file/Makefile.am
tests/lib/Makefile.am
tests/lib/test-case.vala
tests/libsocialweb/Makefile.am
tests/telepathy/Makefile.am
tests/tracker/Makefile.am

index fa2ca06..2e284b3 100644 (file)
@@ -344,54 +344,6 @@ AC_DEFINE([MODULE_VERSION], "folks_module_version", [Module interface version])
 BACKEND_DIR='$(libdir)/folks/$(FOLKS_MODULE_VERSION)/backends'
 AC_SUBST([BACKEND_DIR])
 
-BACKEND_KF='$(top_builddir)/backends/key-file/.libs/key-file.so'
-AC_SUBST([BACKEND_KF])
-BACKEND_TP='$(top_builddir)/backends/telepathy/.libs/telepathy.so'
-AC_SUBST([BACKEND_TP])
-
-AS_IF([test x$have_libsocialweb_backend = xyes], [
-  BACKEND_LIBSOCIALWEB='$(top_builddir)/backends/libsocialweb/.libs/libsocialweb.so'
-  AC_SUBST([BACKEND_LIBSOCIALWEB])
-])
-
-AS_IF([test x$enable_tracker_backend = xyes], [
-  BACKEND_TRACKER='$(top_builddir)/backends/tracker/.libs/tracker.so'
-  AC_SUBST([BACKEND_TRACKER])
-])
-
-AS_IF([test x$enable_eds_backend = xyes], [
-  BACKEND_EDS='$(top_builddir)/backends/eds/.libs/eds.so'
-  AC_SUBST([BACKEND_EDS])
-])
-
-if test x$enable_ofono_backend = xyes; then
-  BACKEND_OFONO='$(top_builddir)/backends/ofono/.libs/ofono.so'
-  AC_SUBST([BACKEND_OFONO])
-fi
-
-# All of the backend libraries in our tree; to be used by the tests
-BACKEND_UNINST_PATH='$(BACKEND_KF)'
-AS_IF([test "x$enable_telepathy_backend" = "xyes"], [
-  BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$(BACKEND_TP)"
-])
-AS_IF([test x$have_libsocialweb_backend = xyes], [
-  LIBSOCIALWEB_BACKEND_UNINST_PATH='$(BACKEND_LIBSOCIALWEB)'
-  BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$LIBSOCIALWEB_BACKEND_UNINST_PATH"
-])
-AS_IF([test x$enable_tracker_backend = xyes], [
-  TRACKER_BACKEND_UNINST_PATH='$(BACKEND_TRACKER)'
-  BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$TRACKER_BACKEND_UNINST_PATH"
-])
-AS_IF([test x$enable_eds_backend = xyes], [
-  EDS_BACKEND_UNINST_PATH='$(BACKEND_EDS)'
-  BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$EDS_BACKEND_UNINST_PATH"
-])
-AS_IF([test x$enable_ofono_backend = xyes], [
-  OFONO_BACKEND_UNINST_PATH='$(BACKEND_OFONO)'
-  BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$OFONO_BACKEND_UNINST_PATH"
-])
-AC_SUBST([BACKEND_UNINST_PATH])
-
 # -----------------------------------------------------------
 # Tools
 # -----------------------------------------------------------
index 0a0046e..dbca436 100644 (file)
@@ -51,6 +51,12 @@ public class Folks.BuildConf
   [CCode (cname = "HAVE_LIBSOCIALWEB")]
   public static bool HAVE_LIBSOCIALWEB;
 
+  [CCode (cname = "HAVE_OFONO")]
+  public static bool HAVE_OFONO;
+
+  [CCode (cname = "HAVE_TELEPATHY")]
+  public static bool HAVE_TELEPATHY;
+
   [CCode (cname = "HAVE_TRACKER")]
   public static bool HAVE_TRACKER;
 
index 642e1f3..6b5a194 100644 (file)
@@ -84,7 +84,6 @@ TESTS = \
 RUN_WITH_PRIVATE_BUS = $(top_srcdir)/tests/tools/with-session-bus-eds.sh
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(RUN_WITH_PRIVATE_BUS) \
        --session \
        --
index d21e978..f0c517e 100644 (file)
@@ -64,7 +64,6 @@ noinst_PROGRAMS = \
        $(NULL)
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(top_srcdir)/tests/tools/execute-test.sh \
        $(NULL)
 
index 336e681..58c1e81 100644 (file)
@@ -36,10 +36,6 @@ noinst_PROGRAMS = \
        individual-retrieval \
        $(NULL)
 
-TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
-        $(NULL)
-
 TESTS = $(noinst_PROGRAMS)
 
 individual_retrieval_SOURCES = \
index 0e6a1d9..7054249 100644 (file)
@@ -55,6 +55,7 @@ libfolks_test_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -I$(top_srcdir) \
        -I$(top_srcdir)/folks \
+       -include $(CONFIG_HEADER) \
        -DABS_TOP_SRCDIR=\"${abs_top_srcdir}\" \
        -DABS_TOP_BUILDDIR=\"${abs_top_builddir}\" \
        -DPKGLIBEXECDIR=\"${pkglibexecdir}\" \
index c2a211a..4c31851 100644 (file)
@@ -47,6 +47,31 @@ public abstract class Folks.TestCase : Object
       this._transient_dir = this.create_transient_dir ();
       this.private_bus_up ();
 
+      if (Environment.get_variable ("FOLKS_TESTS_INSTALLED") == null)
+        {
+          string[] locations = {
+              Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/key-file/.libs/key-file.so",
+          };
+
+          if (Folks.BuildConf.HAVE_EDS)
+            locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/eds/.libs/eds.so";
+
+          if (Folks.BuildConf.HAVE_LIBSOCIALWEB)
+            locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/libsocialweb/.libs/libsocialweb.so";
+
+          if (Folks.BuildConf.HAVE_OFONO)
+            locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/ofono/.libs/ofono.so";
+
+          if (Folks.BuildConf.HAVE_TELEPATHY)
+            locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/telepathy/.libs/telepathy.so";
+
+          if (Folks.BuildConf.HAVE_TRACKER)
+            locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/tracker/.libs/tracker.so";
+
+          Environment.set_variable ("FOLKS_BACKEND_PATH",
+              string.joinv (":", locations), true);
+        }
+
       /* By default, no backend is allowed. Subclasses must override. */
       Environment.set_variable ("FOLKS_BACKENDS_ALLOWED", "", true);
     }
index 14b5e55..57e8d8c 100644 (file)
@@ -49,7 +49,6 @@ noinst_PROGRAMS = \
        $(NULL)
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(top_srcdir)/tests/tools/execute-test.sh \
        $(NULL)
 
index 1677984..8ad285b 100644 (file)
@@ -59,7 +59,6 @@ AM_VALAFLAGS += \
        $(NULL)
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        FOLKS_BACKEND_KEY_FILE_PATH=$(srcdir)/data/relationships-empty.ini \
        $(top_srcdir)/tests/tools/execute-test.sh \
        $(NULL)
index c5524c5..e74ee31 100644 (file)
@@ -106,7 +106,6 @@ noinst_PROGRAMS = \
 
 avatar_file=@abs_top_srcdir@/tests/data/avatar-01.jpg
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(RUN_WITH_PRIVATE_BUS) \
        --session \
        --