tests: Don't leak pending calls

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103600
This commit is contained in:
Simon McVittie 2017-11-21 12:01:23 +00:00
parent e9d38b3fcb
commit 122e26e1a8
2 changed files with 11 additions and 0 deletions

View file

@ -563,6 +563,8 @@ test_uae (Fixture *f,
assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
dbus_message_unref (m);
dbus_clear_pending_call (&pc);
/* The fake systemd connects to the bus. */
f->systemd = test_connect_to_bus (f->ctx, f->address);
if (!dbus_connection_add_filter (f->systemd, systemd_filter, f, NULL))
@ -648,6 +650,8 @@ test_uae (Fixture *f,
assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
dbus_message_unref (m);
dbus_clear_pending_call (&pc);
while (f->systemd_message == NULL)
test_main_context_iterate (f->ctx, TRUE);
@ -897,6 +901,7 @@ test_transient_services (Fixture *f,
assert_error_reply (m, DBUS_SERVICE_DBUS, f->caller_name,
DBUS_ERROR_SERVICE_UNKNOWN);
dbus_clear_pending_call (&pc);
dbus_message_unref (m);
m = NULL;
@ -930,6 +935,8 @@ test_transient_services (Fixture *f,
assert_method_reply (m, DBUS_SERVICE_DBUS, f->caller_name, "");
dbus_message_unref (m);
m = NULL;
dbus_clear_pending_call (&pc);
}
/* The service is present now. */
@ -950,6 +957,8 @@ test_transient_services (Fixture *f,
&reply, NULL))
g_error ("OOM");
dbus_clear_pending_call (&pc);
/* The mock systemd is told to start the service. */
while (f->systemd_message == NULL)
test_main_context_iterate (f->ctx, TRUE);

View file

@ -145,6 +145,7 @@ test_uae (Fixture *f,
g_assert_cmpstr (dbus_message_get_signature (m), ==, "s");
}
dbus_clear_pending_call (&pc);
dbus_message_unref (m);
}
@ -210,6 +211,7 @@ test_monitor (Fixture *f,
g_assert_cmpstr (dbus_message_get_signature (m), ==, "s");
}
dbus_clear_pending_call (&pc);
dbus_message_unref (m);
}