From 269d74f214f87bed0f6fd58f1c848240d31e0b9f Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 26 Mar 2003 07:16:03 +0000 Subject: 2003-03-26 Havoc Pennington * bus/test-main.c, dbus/dbus-test.c (main): check memleaks after every test so it's quick and easy to see which leaked, and so we test multiple dbus_shutdown() calls * configure.in: change configure.in XML stuff to also support expat * config-loader-libxml.c: some hacking * config-loader-expat.c: some hacking * config-parser.c: some hacking, plus tests --- bus/test-main.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'bus/test-main.c') diff --git a/bus/test-main.c b/bus/test-main.c index c7f9f7b7..3768de5f 100644 --- a/bus/test-main.c +++ b/bus/test-main.c @@ -35,6 +35,20 @@ die (const char *failure) exit (1); } +static void +check_memleaks (const char *name) +{ + dbus_shutdown (); + + printf ("%s: checking for memleaks\n", name); + if (_dbus_get_malloc_blocks_outstanding () != 0) + { + _dbus_warn ("%d dbus_malloc blocks were not freed\n", + _dbus_get_malloc_blocks_outstanding ()); + die ("memleaks"); + } +} + int main (int argc, char **argv) { @@ -56,23 +70,19 @@ main (int argc, char **argv) if (!bus_config_parser_test (&test_data_dir)) die ("parser"); + check_memleaks (argv[0]); + printf ("%s: Running policy test\n", argv[0]); if (!bus_policy_test (&test_data_dir)) die ("policy"); + + check_memleaks (argv[0]); printf ("%s: Running message dispatch test\n", argv[0]); if (!bus_dispatch_test (&test_data_dir)) die ("dispatch"); - - dbus_shutdown (); - - printf ("%s: checking for memleaks\n", argv[0]); - if (_dbus_get_malloc_blocks_outstanding () != 0) - { - _dbus_warn ("%d dbus_malloc blocks were not freed\n", - _dbus_get_malloc_blocks_outstanding ()); - die ("memleaks"); - } + + check_memleaks (argv[0]); printf ("%s: Success\n", argv[0]); -- cgit