mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-22 10:30:40 +02:00
various tests: produce better diagnostics on error
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>
This commit is contained in:
parent
e9d37affcd
commit
6d8a198de9
3 changed files with 10 additions and 1 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue