Make the dbus menu tests independent from the session bus

With this change,
DBUS_SESSION_BUS_ADDRESS= make check
succeed here.
This commit is contained in:
Matthias Clasen 2012-04-07 11:21:09 -04:00
parent d036960d30
commit 6a57bf1243
2 changed files with 15 additions and 2 deletions

View File

@ -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 = \

View File

@ -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: */