diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-09-15 18:38:49 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-11-06 14:29:50 +0000 |
commit | 57e67fc55124b323670bfb54e8b43750f1e49f4d (patch) | |
tree | 28ca48baff5e8a9588491f346c7db487cb6d244c | |
parent | 19dc604b2fae2d170e4777e59144d92238713bc9 (diff) | |
download | dbus-57e67fc55124b323670bfb54e8b43750f1e49f4d.tar.gz |
test_processid: only assert that it works if we expect it to work
Otherwise, this would fail on, for instance, QNX.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
-rw-r--r-- | test/dbus-daemon.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 3b8e1348..8b5ad6b5 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -603,22 +603,34 @@ test_processid (Fixture *f, while (m == NULL) test_main_context_iterate (f->ctx, TRUE); - g_assert_cmpstr (dbus_message_get_signature (m), ==, "u"); - - g_assert_true (dbus_message_get_args (m, &error, - DBUS_TYPE_UINT32, &pid, - DBUS_TYPE_INVALID)); -// g_assert_no_error (&error); + if (dbus_message_get_args (m, &error, + DBUS_TYPE_UINT32, &pid, + DBUS_TYPE_INVALID)) + { + g_assert_cmpstr (dbus_message_get_signature (m), ==, "u"); + assert_no_error (&error); - g_message ("GetConnectionUnixProcessID returned %u", pid); + g_message ("GetConnectionUnixProcessID returned %u", pid); #ifdef G_OS_UNIX - g_assert_cmpuint (pid, ==, getpid ()); + g_assert_cmpuint (pid, ==, getpid ()); #elif defined(G_OS_WIN32) - g_assert_cmpuint (pid, ==, GetCurrentProcessId ()); + g_assert_cmpuint (pid, ==, GetCurrentProcessId ()); #else - g_assert_not_reached (); + g_assert_not_reached (); #endif + } + else + { + g_assert_cmpstr (error.name, ==, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN); + +#ifdef PID_SHOULD_WORK + g_error ("Expected pid to be passed, but got %s: %s", + error.name, error.message); +#endif + + dbus_error_free (&error); + } } static void |