gio/tests: Fix gdbus-connection when run from "make check"
authorColin Walters <walters@verbum.org>
Tue, 21 May 2013 13:21:21 +0000 (09:21 -0400)
committerColin Walters <walters@verbum.org>
Tue, 21 May 2013 13:21:21 +0000 (09:21 -0400)
gio/tests/Makefile.am
gio/tests/gdbus-connection.c

index bf56832..7697ccb 100644 (file)
@@ -136,6 +136,7 @@ other_progs =                               \
        gdbus-testserver                \
        gdbus-connection-flush-helper   \
        $(NULL)
+noinst_PROGRAMS += $(other_progs)
 
 if OS_UNIX
 test_progs +=                  \
index 1ab04a2..43c6d28 100644 (file)
@@ -28,7 +28,8 @@
 
 #include "gdbus-tests.h"
 
-const gchar *datapath;
+const gchar *srcdir;
+const gchar *builddir;
 
 /* all tests rely on a shared mainloop */
 static GMainLoop *loop = NULL;
@@ -1004,7 +1005,7 @@ test_connection_filter (void)
   g_assert_cmpint (data.num_outgoing, ==, 4);
 
   /* this is safe; testserver will exit once the bus goes away */
-  path = g_build_filename (datapath, "gdbus-testserver", NULL);
+  path = g_build_filename (builddir, "gdbus-testserver", NULL);
   g_assert (g_spawn_command_line_async (path, NULL));
   g_free (path);
 
@@ -1228,9 +1229,12 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
 
   if (g_getenv ("G_TEST_DATA"))
-    datapath = g_getenv ("G_TEST_DATA");
+    srcdir = builddir = g_getenv ("G_TEST_DATA");
   else
-    datapath = SRCDIR;
+    {
+      srcdir = SRCDIR;
+      builddir = ".";
+    }
 
   /* all the tests rely on a shared main loop */
   loop = g_main_loop_new (NULL, FALSE);