From 05a4ad6994919b352b5229d0b1b0a8ebebe2a42f Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 28 Jan 2003 03:53:29 +0000 Subject: 2003-01-27 Havoc Pennington * dbus/dbus-mempool.c (time_for_size): replace printf with _dbus_verbose * dbus/dbus-message-builder.c (_dbus_message_data_load): allow empty lines; fix the SAVE_LENGTH stuff to be START_LENGTH/END_LENGTH so it actually works; couple other bugfixes * test/Makefile.am (dist-hook): add dist-hook for .message files * dbus/dbus-string.c (DBUS_STRING_COPY_PREAMBLE): source of a copy can be constant or locked. (_dbus_string_free): allow freeing a const string as documented/intended * dbus/dbus-sysdeps.c (_dbus_concat_dir_and_file): utility * dbus/dbus-test-main.c (main): take an argument which is the directory containing test data * dbus/dbus-message.c (_dbus_message_test): pass a test_data_dir argument to this and load all the messages in test/data/ checking that they can be loaded or not loaded as appropriate. --- dbus/dbus-test.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'dbus/dbus-test.c') diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c index 31ed51ab..337ef10b 100644 --- a/dbus/dbus-test.c +++ b/dbus/dbus-test.c @@ -23,13 +23,14 @@ #include #include "dbus-test.h" +#include "dbus-sysdeps.h" #include #include static void die (const char *failure) { - fprintf (stderr, "Failed: %s\n", failure); + fprintf (stderr, "Unit test failed: %s\n", failure); exit (1); } @@ -39,11 +40,21 @@ die (const char *failure) * any app other than our test app, this symbol * won't exist in some builds of the library. * (with --enable-tests=no) + * + * @param test_data_dir the directory with test data (test/data normally) */ void -dbus_internal_symbol_do_not_use_run_tests (void) +dbus_internal_symbol_do_not_use_run_tests (const char *test_data_dir) { #ifdef DBUS_BUILD_TESTS + if (test_data_dir == NULL) + test_data_dir = _dbus_getenv ("DBUS_TEST_DATA"); + + if (test_data_dir != NULL) + printf ("Test data in %s\n", test_data_dir); + else + printf ("No test data!\n"); + printf ("%s: running string tests\n", "dbus-test"); if (!_dbus_string_test ()) die ("strings"); @@ -53,7 +64,7 @@ dbus_internal_symbol_do_not_use_run_tests (void) die ("marshalling"); printf ("%s: running message tests\n", "dbus-test"); - if (!_dbus_message_test ()) + if (!_dbus_message_test (test_data_dir)) die ("messages"); printf ("%s: running memory pool tests\n", "dbus-test"); -- cgit