From fcf1aa0733773f9ad0025975b0b8930f51b93172 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 11 Jul 2016 11:09:26 +0100 Subject: [PATCH] various tests: produce better diagnostics on error Same root cause as : we didn't check whether the message was in fact an error reply. Signed-off-by: Simon McVittie --- test/fdpass.c | 4 +++- test/monitor.c | 3 +++ test/name-test/test-privserver-client.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/fdpass.c b/test/fdpass.c index 665b4a1..0ea7518 100644 --- a/test/fdpass.c +++ b/test/fdpass.c @@ -359,7 +359,9 @@ test_relay (Fixture *f, g_assert_cmpstr (dbus_message_get_path (incoming), ==, "/com/example/Hello"); g_assert_cmpuint (dbus_message_get_serial (incoming), ==, serial); - if (!dbus_message_get_args (incoming, + if (dbus_set_error_from_message (&f->e, incoming)) + g_error ("%s: %s", f->e.name, f->e.message); + else if (!dbus_message_get_args (incoming, &f->e, DBUS_TYPE_UNIX_FD, &fd_after, DBUS_TYPE_INVALID)) diff --git a/test/monitor.c b/test/monitor.c index 914e539..6133721 100644 --- a/test/monitor.c +++ b/test/monitor.c @@ -678,6 +678,9 @@ test_invalid (Fixture *f, while (m == NULL) test_main_context_iterate (f->ctx, TRUE); + if (dbus_set_error_from_message (&f->e, m)) + g_error ("%s: %s", f->e.name, f->e.message); + ok = dbus_message_get_args (m, &f->e, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID); diff --git a/test/name-test/test-privserver-client.c b/test/name-test/test-privserver-client.c index 56b553c..4268516 100644 --- a/test/name-test/test-privserver-client.c +++ b/test/name-test/test-privserver-client.c @@ -100,6 +100,10 @@ open_shutdown_private_connection (dbus_bool_t use_guid) if (!(reply = dbus_connection_send_with_reply_and_block (session, msg, -1, &error))) die ("couldn't send message: %s\n", error.message); dbus_message_unref (msg); + + if (dbus_set_error_from_message (&error, reply)) + die ("%s: %s", error.name, error.message); + if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &addr, DBUS_TYPE_INVALID)) die ("couldn't parse message replym\n"); printf ("# got private temp address %s\n", addr); -- 2.8.1