]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
various tests: produce better diagnostics on error
authorSimon McVittie <smcv@debian.org>
Mon, 11 Jul 2016 10:09:26 +0000 (11:09 +0100)
committerSimon McVittie <smcv@debian.org>
Fri, 12 Aug 2016 09:25:06 +0000 (10:25 +0100)
Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>:
we didn't check whether the message was in fact an error reply.

Signed-off-by: Simon McVittie <smcv@debian.org>
test/fdpass.c
test/monitor.c
test/name-test/test-privserver-client.c

index 665b4a1296dbeb55d68fa7be1fe5da96886fa496..0ea7518c32a7ca9a991fb011636935659125d4e0 100644 (file)
@@ -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))
index 914e5395e58bee0bd4f3db7a306906dfca3226ea..6133721f63c7406fe80f21098b09694cd1824f7c 100644 (file)
@@ -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);
index 56b553c0b8ba9cb7456a1a693968dd13760e7f77..4268516a17ddee53058e7fa921345c42b141fb68 100644 (file)
@@ -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);