summaryrefslogtreecommitdiffstats
path: root/bus/test-main.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-26 07:16:03 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-26 07:16:03 +0000
commit269d74f214f87bed0f6fd58f1c848240d31e0b9f (patch)
tree61da2c953118a7e4459d8288e32246a369e0b66a /bus/test-main.c
parent90ed1d84588a84697051e643175452c50d682ece (diff)
2003-03-26 Havoc Pennington <hp@pobox.com>
* 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
Diffstat (limited to 'bus/test-main.c')
-rw-r--r--bus/test-main.c30
1 files changed, 20 insertions, 10 deletions
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]);