diff options
Diffstat (limited to 'test/name-test')
-rw-r--r-- | 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 d3f42e35..d50dfbff 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; } |