[glib] Make the dbus menu tests independent from the session bus



commit 6a57bf12433e241a82a7646cde33b5297bc86d3a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 7 11:21:09 2012 -0400

    Make the dbus menu tests independent from the session bus
    
    With this change,
    DBUS_SESSION_BUS_ADDRESS= make check
    succeed here.

 gio/tests/Makefile.am  |    1 +
 gio/tests/gmenumodel.c |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 42cfe7c..0d45e71 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -433,6 +433,7 @@ gapplication_example_cmdline3_LDADD   = $(progs_ldadd)
 gapplication_example_actions_SOURCES = gapplication-example-actions.c
 gapplication_example_actions_LDADD   = $(progs_ldadd)
 
+gmenumodel_SOURCES = gmenumodel.c gdbus-sessionbus.h gdbus-sessionbus.c
 gmenumodel_LDADD = $(progs_ldadd)
 
 schema_tests = \
diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c
index d8eb567..f8a6464 100644
--- a/gio/tests/gmenumodel.c
+++ b/gio/tests/gmenumodel.c
@@ -1,5 +1,7 @@
 #include <gio/gio.h>
 
+#include "gdbus-sessionbus.h"
+
 /* Markup printing {{{1 */
 
 /* This used to be part of GLib, but it was removed before the stable
@@ -1019,10 +1021,16 @@ test_mutable (void)
 int
 main (int argc, char **argv)
 {
-  g_test_init (&argc, &argv, NULL);
+  gboolean ret;
 
+  g_test_init (&argc, &argv, NULL);
   g_type_init ();
 
+  g_unsetenv ("DISPLAY");
+  g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
+
+  session_bus_up ();
+
   g_test_add_func ("/gmenu/equality", test_equality);
   g_test_add_func ("/gmenu/random", test_random);
   g_test_add_func ("/gmenu/dbus/roundtrip", test_dbus_roundtrip);
@@ -1032,6 +1040,10 @@ main (int argc, char **argv)
   g_test_add_func ("/gmenu/links", test_links);
   g_test_add_func ("/gmenu/mutable", test_mutable);
 
-  return g_test_run ();
+  ret = g_test_run ();
+
+  session_bus_down ();
+
+  return ret;
 }
 /* vim:set foldmethod=marker: */



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