From e3f09b51344fc3cad88d381d698d01f827312264 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Nov 2017 12:01:23 +0000 Subject: [PATCH 3/8] tests: Don't leak pending calls Signed-off-by: Simon McVittie --- test/sd-activation.c | 9 +++++++++ test/uid-permissions.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/test/sd-activation.c b/test/sd-activation.c index 8e0b2af6..92203b70 100644 --- a/test/sd-activation.c +++ b/test/sd-activation.c @@ -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); diff --git a/test/uid-permissions.c b/test/uid-permissions.c index 75bbb13f..ce6d7a6b 100644 --- a/test/uid-permissions.c +++ b/test/uid-permissions.c @@ -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); } -- 2.15.0