[glib] Properly bring up a session bus for application tests



commit d344e69dc291df5e5da15d6e1c1b0ef897fdeea3
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 23 21:16:28 2011 -0400

    Properly bring up a session bus for application tests
    
    As pointed out in bug 644601, session_bus_up() requires
    us to set up environment variables for things to work.

 gio/tests/gapplication.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gapplication.c b/gio/tests/gapplication.c
index be6dd94..cb4e5ef 100644
--- a/gio/tests/gapplication.c
+++ b/gio/tests/gapplication.c
@@ -361,6 +361,13 @@ main (int argc, char **argv)
 
   g_test_init (&argc, &argv, NULL);
 
+  /* all the tests use a session bus with a well-known address
+   * that we can bring up and down using session_bus_up() and
+   * session_bus_down().
+   */
+  g_unsetenv ("DISPLAY");
+  g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
+
   g_test_add_func ("/gapplication/basic", basic);
   g_test_add_func ("/gapplication/non-unique", test_nonunique);
   g_test_add_func ("/gapplication/properties", properties);



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