diff options
author | Havoc Pennington <hp@redhat.com> | 2003-03-26 07:16:03 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-03-26 07:16:03 +0000 |
commit | 269d74f214f87bed0f6fd58f1c848240d31e0b9f (patch) | |
tree | 61da2c953118a7e4459d8288e32246a369e0b66a /dbus | |
parent | 90ed1d84588a84697051e643175452c50d682ece (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 'dbus')
-rw-r--r-- | dbus/dbus-test.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c index 34160116..b9cf64c8 100644 --- a/dbus/dbus-test.c +++ b/dbus/dbus-test.c @@ -35,6 +35,21 @@ die (const char *failure) fprintf (stderr, "Unit test failed: %s\n", failure); exit (1); } + +static void +check_memleaks (void) +{ + dbus_shutdown (); + + printf ("%s: checking for memleaks\n", "dbus-test"); + if (_dbus_get_malloc_blocks_outstanding () != 0) + { + _dbus_warn ("%d dbus_malloc blocks were not freed\n", + _dbus_get_malloc_blocks_outstanding ()); + die ("memleaks"); + } +} + #endif /* DBUS_BUILD_TESTS */ /** @@ -61,66 +76,82 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir) printf ("%s: running string tests\n", "dbus-test"); if (!_dbus_string_test ()) die ("strings"); + + check_memleaks (); printf ("%s: running data slot tests\n", "dbus-test"); if (!_dbus_data_slot_test ()) die ("dataslot"); + + check_memleaks (); printf ("%s: running keyring tests\n", "dbus-test"); if (!_dbus_keyring_test ()) die ("keyring"); + + check_memleaks (); #if 0 printf ("%s: running md5 tests\n", "dbus-test"); if (!_dbus_md5_test ()) die ("md5"); + + check_memleaks (); #endif printf ("%s: running SHA-1 tests\n", "dbus-test"); if (!_dbus_sha_test (test_data_dir)) die ("SHA-1"); + + check_memleaks (); printf ("%s: running auth tests\n", "dbus-test"); if (!_dbus_auth_test (test_data_dir)) die ("auth"); + + check_memleaks (); printf ("%s: running address parse tests\n", "dbus-test"); if (!_dbus_address_test ()) die ("address parsing"); + + check_memleaks (); printf ("%s: running marshalling tests\n", "dbus-test"); if (!_dbus_marshal_test ()) die ("marshalling"); + check_memleaks (); + printf ("%s: running message tests\n", "dbus-test"); if (!_dbus_message_test (test_data_dir)) die ("messages"); + check_memleaks (); + printf ("%s: running memory pool tests\n", "dbus-test"); if (!_dbus_mem_pool_test ()) die ("memory pools"); + + check_memleaks (); printf ("%s: running linked list tests\n", "dbus-test"); if (!_dbus_list_test ()) die ("lists"); + check_memleaks (); + printf ("%s: running hash table tests\n", "dbus-test"); if (!_dbus_hash_test ()) die ("hash tables"); + + check_memleaks (); printf ("%s: running dict tests\n", "dbus-test"); if (!_dbus_dict_test ()) die ("dicts"); - dbus_shutdown (); - - printf ("%s: checking for memleaks\n", "dbus-test"); - 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 (); printf ("%s: completed successfully\n", "dbus-test"); #else |