[folks] Set up tests' backend paths in Vala code



commit 13113b2fd41d1bdc432142aac600bceee03d61d0
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Mar 26 18:15:00 2013 +0000

    Set up tests' backend paths in Vala code
    
    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                   |   48 ----------------------------------------
 folks/build-conf.vapi          |    6 +++++
 tests/eds/Makefile.am          |    1 -
 tests/folks/Makefile.am        |    1 -
 tests/key-file/Makefile.am     |    4 ---
 tests/lib/Makefile.am          |    1 +
 tests/lib/test-case.vala       |   25 ++++++++++++++++++++
 tests/libsocialweb/Makefile.am |    1 -
 tests/telepathy/Makefile.am    |    1 -
 tests/tracker/Makefile.am      |    1 -
 10 files changed, 32 insertions(+), 57 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fa2ca06..2e284b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
 # -----------------------------------------------------------
diff --git a/folks/build-conf.vapi b/folks/build-conf.vapi
index 0a0046e..dbca436 100644
--- a/folks/build-conf.vapi
+++ b/folks/build-conf.vapi
@@ -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;
 
diff --git a/tests/eds/Makefile.am b/tests/eds/Makefile.am
index 642e1f3..6b5a194 100644
--- a/tests/eds/Makefile.am
+++ b/tests/eds/Makefile.am
@@ -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 \
        --
diff --git a/tests/folks/Makefile.am b/tests/folks/Makefile.am
index d21e978..f0c517e 100644
--- a/tests/folks/Makefile.am
+++ b/tests/folks/Makefile.am
@@ -64,7 +64,6 @@ noinst_PROGRAMS = \
        $(NULL)
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(top_srcdir)/tests/tools/execute-test.sh \
        $(NULL)
 
diff --git a/tests/key-file/Makefile.am b/tests/key-file/Makefile.am
index 336e681..58c1e81 100644
--- a/tests/key-file/Makefile.am
+++ b/tests/key-file/Makefile.am
@@ -36,10 +36,6 @@ noinst_PROGRAMS = \
        individual-retrieval \
        $(NULL)
 
-TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
-        $(NULL)
-
 TESTS = $(noinst_PROGRAMS)
 
 individual_retrieval_SOURCES = \
diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index 0e6a1d9..7054249 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -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}\" \
diff --git a/tests/lib/test-case.vala b/tests/lib/test-case.vala
index c2a211a..4c31851 100644
--- a/tests/lib/test-case.vala
+++ b/tests/lib/test-case.vala
@@ -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);
     }
diff --git a/tests/libsocialweb/Makefile.am b/tests/libsocialweb/Makefile.am
index 14b5e55..57e8d8c 100644
--- a/tests/libsocialweb/Makefile.am
+++ b/tests/libsocialweb/Makefile.am
@@ -49,7 +49,6 @@ noinst_PROGRAMS = \
        $(NULL)
 
 TESTS_ENVIRONMENT = \
-       FOLKS_BACKEND_PATH=$(BACKEND_UNINST_PATH) \
        $(top_srcdir)/tests/tools/execute-test.sh \
        $(NULL)
 
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index 1677984..8ad285b 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -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)
diff --git a/tests/tracker/Makefile.am b/tests/tracker/Makefile.am
index c5524c5..e74ee31 100644
--- a/tests/tracker/Makefile.am
+++ b/tests/tracker/Makefile.am
@@ -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 \
        --


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