From 2919a5200b1625dcbc1ccee6e490885b69a3dec7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 25 Feb 2011 12:34:38 +0000 Subject: [PATCH 1/2] test-autolaunch: don't expect autolaunching to work if X11 is disabled --- test/name-test/test-autolaunch.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/test/name-test/test-autolaunch.c b/test/name-test/test-autolaunch.c index d3f42e3..d50dfbf 100644 --- a/test/name-test/test-autolaunch.c +++ b/test/name-test/test-autolaunch.c @@ -19,6 +19,8 @@ main (int argc, char *argv[]) dbus_error_init (&error); conn = dbus_bus_get (DBUS_BUS_SESSION, &error); + +#ifdef DBUS_BUILD_X11 if (dbus_error_is_set (&error)) { fprintf (stderr, "*** Failed to autolaunch session bus: %s\n", @@ -26,6 +28,23 @@ main (int argc, char *argv[]) dbus_error_free (&error); return 1; } +#else + /* We don't necessarily expect it to *work* without X (although it might - + * for instance on Mac OS it might have used launchd). Just check that the + * results are consistent. */ + + if (dbus_error_is_set (&error) && conn != NULL) + { + fprintf (stderr, "*** Autolaunched session bus, but an error was set!\n"); + return 1; + } +#endif + + if (!dbus_error_is_set (&error) && conn == NULL) + { + fprintf (stderr, "*** Failed to autolaunch session bus but no error was set\n"); + return 1; + } return 0; } -- 1.7.4.1