From cbd14f2da76512e454d8f99cf0a5677b792f3571 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 11 Jul 2018 16:40:12 +0100 Subject: [PATCH 7/7] tests: Call dbus_shutdown() Not all of these tests will be fully valgrind-clean yet (or perhaps ever), but it's easier to add this to all of them than to think about it. Signed-off-by: Simon McVittie --- test/containers.c | 1 + test/corrupt.c | 6 +++++- test/dbus-daemon-eavesdrop.c | 6 +++++- test/dbus-daemon.c | 6 +++++- test/fdpass.c | 6 +++++- test/header-fields.c | 1 + test/internals/printf.c | 1 + test/internals/refs.c | 6 +++++- test/internals/server-oom.c | 1 + test/internals/syslog.c | 6 +++++- test/internals/variant.c | 6 +++++- test/loopback.c | 6 +++++- test/marshal.c | 1 + test/message.c | 1 + test/monitor.c | 6 +++++- test/relay.c | 6 +++++- test/sd-activation.c | 5 ++++- test/shell-test.c | 1 + test/spawn-test.c | 2 +- test/syntax.c | 6 +++++- test/test-names.c | 2 +- test/thread-blocking.c | 6 +++++- test/uid-permissions.c | 6 +++++- 23 files changed, 78 insertions(+), 16 deletions(-) diff --git a/test/containers.c b/test/containers.c index fe099831..dd1104ea 100644 --- a/test/containers.c +++ b/test/containers.c @@ -1770,5 +1770,6 @@ main (int argc, g_free (runtime_services_dir); g_free (runtime_dbus_dir); g_free (runtime_dir); + dbus_shutdown (); return ret; } diff --git a/test/corrupt.c b/test/corrupt.c index 4eaa04ff..be5314b4 100644 --- a/test/corrupt.c +++ b/test/corrupt.c @@ -403,6 +403,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/corrupt/tcp", Fixture, "tcp:host=127.0.0.1", setup, @@ -421,5 +423,7 @@ main (int argc, test_byte_order, teardown); #endif - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/dbus-daemon-eavesdrop.c b/test/dbus-daemon-eavesdrop.c index d2c0872d..be21d0ab 100644 --- a/test/dbus-daemon-eavesdrop.c +++ b/test/dbus-daemon-eavesdrop.c @@ -421,6 +421,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/eavedrop/match_keyword/broadcast", Fixture, NULL, @@ -431,5 +433,7 @@ main (int argc, g_test_add ("/eavedrop/match_keyword/unicast_to_sender", Fixture, NULL, setup, test_eavesdrop_unicast_to_sender, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 222b1028..878aa9bc 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -2050,6 +2050,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/echo/session", Fixture, NULL, setup, test_echo, teardown); @@ -2127,5 +2129,7 @@ main (int argc, setup, test_fd_limit, teardown); #endif - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/fdpass.c b/test/fdpass.c index 871d9f53..1d8ee605 100644 --- a/test/fdpass.c +++ b/test/fdpass.c @@ -877,6 +877,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); #ifdef HAVE_GETRLIMIT @@ -940,5 +942,7 @@ main (int argc, g_test_add ("/odd-limit/plus2", Fixture, GINT_TO_POINTER (+2), setup, test_odd_limit, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/header-fields.c b/test/header-fields.c index 088953bf..54e25798 100644 --- a/test/header-fields.c +++ b/test/header-fields.c @@ -822,5 +822,6 @@ main (int argc, ret = g_test_run (); g_queue_free_full (test_cases_to_free, g_free); + dbus_shutdown (); return ret; } diff --git a/test/internals/printf.c b/test/internals/printf.c index fb8f3552..1160b2ae 100644 --- a/test/internals/printf.c +++ b/test/internals/printf.c @@ -105,5 +105,6 @@ main (int argc, * This is how it can distinguish between an unexpected exit and * successful completion. */ printf ("1..%d\n", test_num); + dbus_shutdown (); return 0; } diff --git a/test/internals/refs.c b/test/internals/refs.c index e68f6606..89f581aa 100644 --- a/test/internals/refs.c +++ b/test/internals/refs.c @@ -622,6 +622,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/refs/connection", Fixture, NULL, setup_connection, @@ -633,5 +635,7 @@ main (int argc, g_test_add ("/refs/server", Fixture, NULL, setup, test_server, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/internals/server-oom.c b/test/internals/server-oom.c index 5d7fa4d0..605566c8 100644 --- a/test/internals/server-oom.c +++ b/test/internals/server-oom.c @@ -137,5 +137,6 @@ main (int argc, ret = g_test_run (); g_queue_free_full (test_cases_to_free, g_free); + dbus_shutdown (); return ret; } diff --git a/test/internals/syslog.c b/test/internals/syslog.c index e69c14a1..01236e96 100644 --- a/test/internals/syslog.c +++ b/test/internals/syslog.c @@ -102,10 +102,14 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/syslog/normal", Fixture, NULL, setup, test_syslog_normal, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/internals/variant.c b/test/internals/variant.c index 69954e7a..e5135429 100644 --- a/test/internals/variant.c +++ b/test/internals/variant.c @@ -564,10 +564,14 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add_func ("/variant/simple", test_simple); g_test_add_func ("/variant/oom", test_oom_handling); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/loopback.c b/test/loopback.c index fdade494..ad7e0e94 100644 --- a/test/loopback.c +++ b/test/loopback.c @@ -479,6 +479,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/connect/tcp", Fixture, "tcp:host=127.0.0.1", setup, @@ -515,5 +517,7 @@ main (int argc, test_bad_guid, teardown); #endif - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/marshal.c b/test/marshal.c index 3353ec00..f10bb1c2 100644 --- a/test/marshal.c +++ b/test/marshal.c @@ -271,5 +271,6 @@ main (int argc, ret = g_test_run (); g_free (aligned_le_blob); g_free (aligned_be_blob); + dbus_shutdown (); return ret; } diff --git a/test/message.c b/test/message.c index 7141e314..9aee025c 100644 --- a/test/message.c +++ b/test/message.c @@ -310,5 +310,6 @@ main (int argc, ret = g_test_run (); g_queue_free_full (test_cases_to_free, g_free); + dbus_shutdown (); return ret; } diff --git a/test/monitor.c b/test/monitor.c index 57f13af8..1199c85f 100644 --- a/test/monitor.c +++ b/test/monitor.c @@ -1949,6 +1949,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/monitor/invalid", Fixture, NULL, @@ -1992,5 +1994,7 @@ main (int argc, setup, test_activation, teardown); #endif - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/relay.c b/test/relay.c index 657f5fd3..044260af 100644 --- a/test/relay.c +++ b/test/relay.c @@ -337,6 +337,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/connect/tcp", Fixture, "tcp:host=127.0.0.1", setup, @@ -355,5 +357,7 @@ main (int argc, test_limit, teardown); #endif - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/sd-activation.c b/test/sd-activation.c index add2c264..b5a08bce 100644 --- a/test/sd-activation.c +++ b/test/sd-activation.c @@ -1056,6 +1056,7 @@ main (int argc, char **argv) { gsize i; + int ret; test_init (&argc, &argv); @@ -1089,5 +1090,7 @@ main (int argc, g_test_add ("/sd-activation/transient-services/in-advance", Fixture, &transient_service_in_advance, setup, test_transient_services, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/shell-test.c b/test/shell-test.c index 794757f3..d01dce8e 100644 --- a/test/shell-test.c +++ b/test/shell-test.c @@ -184,5 +184,6 @@ main (int argc, char **argv) * successful completion. */ printf ("1..%d\n", test_num); + dbus_shutdown (); return (num_failed != 0); } diff --git a/test/spawn-test.c b/test/spawn-test.c index a12c869f..8d42f067 100644 --- a/test/spawn-test.c +++ b/test/spawn-test.c @@ -39,6 +39,6 @@ main (int argc, char **argv) } dbus_free(argv_copy); - + dbus_shutdown (); return 0; } diff --git a/test/syntax.c b/test/syntax.c index bf960c9e..17fcba4e 100644 --- a/test/syntax.c +++ b/test/syntax.c @@ -271,6 +271,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/syntax/path", Fixture, &paths, setup, test_syntax, teardown); @@ -289,5 +291,7 @@ main (int argc, g_test_add ("/syntax/utf8", Fixture, &strings, setup, test_syntax, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/test-names.c b/test/test-names.c index eac79ee1..5ba77ae5 100644 --- a/test/test-names.c +++ b/test/test-names.c @@ -74,6 +74,6 @@ main (int argc, #endif _dbus_verbose ("*** Test service name exiting\n"); - + dbus_shutdown (); return 0; } diff --git a/test/thread-blocking.c b/test/thread-blocking.c index e814dec3..69395f35 100644 --- a/test/thread-blocking.c +++ b/test/thread-blocking.c @@ -290,10 +290,14 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); g_test_add ("/thread-blocking", Fixture, NULL, setup, test_threads, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } diff --git a/test/uid-permissions.c b/test/uid-permissions.c index 4642ff37..24f6f725 100644 --- a/test/uid-permissions.c +++ b/test/uid-permissions.c @@ -238,6 +238,8 @@ int main (int argc, char **argv) { + int ret; + test_init (&argc, &argv); /* UpdateActivationEnvironment used to be allowed by dbus-daemon for root @@ -257,5 +259,7 @@ main (int argc, g_test_add ("/uid-permissions/monitor/other", Fixture, &other_fail_config, setup, test_monitor, teardown); - return g_test_run (); + ret = g_test_run (); + dbus_shutdown (); + return ret; } -- 2.18.0