[glib] Fix make check with builddir != srcdir



commit 98a921045cf16cb927eae2fd13a5f025cfb76365
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 27 21:20:10 2013 -0400

    Fix make check with builddir != srcdir
    
    This broke when the tests were converted to be installable.
    My apologies.

 gio/tests/Makefile.am                   |    1 +
 gio/tests/appinfo.c                     |   16 ++++++++++------
 gio/tests/gapplication.c                |   11 ++++++++---
 gio/tests/gdbus-connection-loss.c       |    2 +-
 gio/tests/gdbus-connection-slow.c       |    2 +-
 gio/tests/gdbus-connection.c            |    2 +-
 gio/tests/gdbus-introspection.c         |    8 ++++----
 gio/tests/gdbus-proxy-well-known-name.c |    2 +-
 gio/tests/gdbus-proxy.c                 |    2 +-
 gio/tests/gdbus-threading.c             |    8 ++++----
 10 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 56950fb..20cae5b 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -16,6 +16,7 @@ AM_CPPFLAGS =                                 \
        -I$(top_srcdir)/gio             \
        $(DBUS1_CFLAGS)                 \
        -DSRCDIR=\""$(srcdir)"\"        \
+       -DBUILDDIR=\""$(abs_builddir)"\"        \
        -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\"
 
 AM_CFLAGS = $(GLIB_WARN_CFLAGS)
diff --git a/gio/tests/appinfo.c b/gio/tests/appinfo.c
index 5acba3d..f80b4e8 100644
--- a/gio/tests/appinfo.c
+++ b/gio/tests/appinfo.c
@@ -6,6 +6,7 @@
 #include <gio/gdesktopappinfo.h>
 
 static const gchar *datapath;
+static const gchar *binpath;
 
 static void
 test_launch (void)
@@ -165,7 +166,7 @@ test_commandline (void)
   gchar *cmdline;
   gchar *cmdline_out;
 
-  cmdline = g_strconcat (datapath, "/appinfo-test --option", NULL);
+  cmdline = g_strconcat (binpath, "/appinfo-test --option", NULL);
   cmdline_out = g_strconcat (cmdline, " %u", NULL);
 
   error = NULL;
@@ -211,7 +212,7 @@ test_launch_context (void)
   gchar *str;
   gchar *cmdline;
 
-  cmdline = g_strconcat (datapath, "/appinfo-test --option", NULL);
+  cmdline = g_strconcat (binpath, "/appinfo-test --option", NULL);
 
   context = g_app_launch_context_new ();
   appinfo = g_app_info_create_from_commandline (cmdline,
@@ -263,7 +264,7 @@ test_launch_context_signals (void)
   GError *error = NULL;
   gchar *cmdline;
 
-  cmdline = g_strconcat (datapath, "/appinfo-test --option", NULL);
+  cmdline = g_strconcat (binpath, "/appinfo-test --option", NULL);
 
   context = g_app_launch_context_new ();
   g_signal_connect (context, "launched", G_CALLBACK (launched), NULL);
@@ -312,7 +313,7 @@ test_associations (void)
   GList *list;
   gchar *cmdline;
 
-  cmdline = g_strconcat (datapath, "/appinfo-test --option", NULL);
+  cmdline = g_strconcat (binpath, "/appinfo-test --option", NULL);
   appinfo = g_app_info_create_from_commandline (cmdline,
                                                 "cmdline-app-test",
                                                 G_APP_INFO_CREATE_SUPPORTS_URIS,
@@ -485,9 +486,12 @@ int
 main (int argc, char *argv[])
 {
   if (g_getenv ("G_TEST_DATA"))
-    datapath = g_getenv ("G_TEST_DATA");
+    datapath = binpath = g_getenv ("G_TEST_DATA");
   else
-    datapath = SRCDIR;
+    {
+      datapath = SRCDIR;
+      binpath = BUILDDIR;
+    }
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gapplication.c b/gio/tests/gapplication.c
index f5a6e79..81d5892 100644
--- a/gio/tests/gapplication.c
+++ b/gio/tests/gapplication.c
@@ -7,6 +7,7 @@
 #include "gdbus-sessionbus.h"
 
 static const gchar *datapath;
+static const gchar *binpath;
 
 static gint outstanding_watches;
 static GMainLoop *main_loop;
@@ -67,7 +68,7 @@ spawn (const gchar *expected_stdout,
 
   va_start (ap, first_arg);
   array = g_ptr_array_new ();
-  g_ptr_array_add (array, g_build_filename (datapath, "basic-application", NULL));
+  g_ptr_array_add (array, g_build_filename (binpath, "basic-application", NULL));
   for (arg = first_arg; arg; arg = va_arg (ap, const gchar *))
     g_ptr_array_add (array, g_strdup (arg));
   g_ptr_array_add (array, NULL);
@@ -522,9 +523,13 @@ int
 main (int argc, char **argv)
 {
   if (g_getenv ("G_TEST_DATA"))
-    datapath = g_getenv ("G_TEST_DATA");
+    datapath = binpath = g_getenv ("G_TEST_DATA");
   else
-    datapath = SRCDIR;
+    {
+      datapath = SRCDIR;
+      binpath = BUILDDIR;
+    }
+
   g_test_init (&argc, &argv, NULL);
 
   g_test_dbus_unset ();
diff --git a/gio/tests/gdbus-connection-loss.c b/gio/tests/gdbus-connection-loss.c
index 4455cd7..87dc1b7 100644
--- a/gio/tests/gdbus-connection-loss.c
+++ b/gio/tests/gdbus-connection-loss.c
@@ -119,7 +119,7 @@ main (int   argc,
   if (g_getenv ("G_TEST_DATA"))
     binpath = g_getenv ("G_TEST_DATA");
   else
-    binpath = ".";
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gdbus-connection-slow.c b/gio/tests/gdbus-connection-slow.c
index f94e386..4b5e086 100644
--- a/gio/tests/gdbus-connection-slow.c
+++ b/gio/tests/gdbus-connection-slow.c
@@ -224,7 +224,7 @@ main (int   argc,
   if (g_getenv ("G_TEST_DATA"))
     binpath = g_getenv ("G_TEST_DATA");
   else
-    binpath = ".";
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c
index 43c6d28..ef4cd52 100644
--- a/gio/tests/gdbus-connection.c
+++ b/gio/tests/gdbus-connection.c
@@ -1233,7 +1233,7 @@ main (int   argc,
   else
     {
       srcdir = SRCDIR;
-      builddir = ".";
+      builddir = BUILDDIR;
     }
 
   /* all the tests rely on a shared main loop */
diff --git a/gio/tests/gdbus-introspection.c b/gio/tests/gdbus-introspection.c
index 3d00aa9..89e5f50 100644
--- a/gio/tests/gdbus-introspection.c
+++ b/gio/tests/gdbus-introspection.c
@@ -26,7 +26,7 @@
 
 #include "gdbus-tests.h"
 
-static const gchar *datapath;
+static const gchar *binpath;
 
 /* all tests rely on a shared mainloop */
 static GMainLoop *loop = NULL;
@@ -128,7 +128,7 @@ test_introspection_parser (void)
   g_assert_no_error (error);
 
   /* this is safe; testserver will exit once the bus goes away */
-  path = g_build_filename (datapath, "gdbus-testserver", NULL);
+  path = g_build_filename (binpath, "gdbus-testserver", NULL);
   g_assert (g_spawn_command_line_async (path, NULL));
   g_free (path);
 
@@ -309,9 +309,9 @@ main (int   argc,
   gint ret;
 
   if (g_getenv ("G_TEST_DATA"))
-    datapath = g_getenv ("G_TEST_DATA");
+    binpath = g_getenv ("G_TEST_DATA");
   else
-    datapath = SRCDIR;
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gdbus-proxy-well-known-name.c b/gio/tests/gdbus-proxy-well-known-name.c
index 8f13977..bc22537 100644
--- a/gio/tests/gdbus-proxy-well-known-name.c
+++ b/gio/tests/gdbus-proxy-well-known-name.c
@@ -270,7 +270,7 @@ main (int   argc,
   if (g_getenv ("G_TEST_DATA"))
     binpath = g_getenv ("G_TEST_DATA");
   else
-    binpath = ".";
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c
index f4e3181..202bee3 100644
--- a/gio/tests/gdbus-proxy.c
+++ b/gio/tests/gdbus-proxy.c
@@ -924,7 +924,7 @@ main (int   argc,
   if (g_getenv ("G_TEST_DATA"))
     binpath = g_getenv ("G_TEST_DATA");
   else
-    binpath = ".";
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c
index 355d0df..ceb20c1 100644
--- a/gio/tests/gdbus-threading.c
+++ b/gio/tests/gdbus-threading.c
@@ -26,7 +26,7 @@
 
 #include "gdbus-tests.h"
 
-static const gchar *datapath;
+static const gchar *binpath;
 
 /* all tests rely on a global connection */
 static GDBusConnection *c = NULL;
@@ -586,16 +586,16 @@ main (int   argc,
   gchar *path;
 
   if (g_getenv ("G_TEST_DATA"))
-    datapath = g_getenv ("G_TEST_DATA");
+    binpath = g_getenv ("G_TEST_DATA");
   else
-    datapath = SRCDIR;
+    binpath = BUILDDIR;
 
   g_test_init (&argc, &argv, NULL);
 
   session_bus_up ();
 
   /* this is safe; testserver will exit once the bus goes away */
-  path = g_build_filename (datapath, "gdbus-testserver", NULL);
+  path = g_build_filename (binpath, "gdbus-testserver", NULL);
   g_assert (g_spawn_command_line_async (path, NULL));
   g_free (path);
 


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