#include "utils.h"
#include <dbus/dbus-list.h>
#include <dbus/dbus-internals.h>
+#include <dbus/dbus-test-tap.h>
#include <string.h>
/**
dbus_error_init (&error);
retval = FALSE;
- printf ("Testing values from: %s\n", _dbus_string_get_const_data (full_path));
+ _dbus_test_diag ("Testing values from: %s", _dbus_string_get_const_data (full_path));
parser = bus_config_load (full_path, TRUE, NULL, &error);
if (parser == NULL)
_dbus_warn ("User was invalid; '%s'!", user);
goto finish;
}
- printf (" <user>dbus</user> OKAY!\n");
+ _dbus_test_diag (" <user>dbus</user> OKAY!");
#endif
/* check type return value is okay */
_dbus_warn ("Type was invalid; '%s'!", user);
goto finish;
}
- printf (" <type>system</type> OKAY!\n");
+ _dbus_test_diag (" <type>system</type> OKAY!");
/* check dirs return value is okay */
dirs = bus_config_parser_get_service_paths (parser);
_dbus_warn ("Service dirs are NULL!");
goto finish;
}
- printf (" <standard_system_service_dirs/> OKAY!\n");
+ _dbus_test_diag (" <standard_system_service_dirs/> OKAY!");
/* NOTE: We tested the specific return values in the config-parser tests */
/* woohoo! */
}
if (validity == VALID)
- printf ("Testing valid files:\n");
+ _dbus_test_diag ("Testing valid files:");
else if (validity == INVALID)
- printf ("Testing invalid files:\n");
+ _dbus_test_diag ("Testing invalid files:");
else
- printf ("Testing unknown files:\n");
+ _dbus_test_diag ("Testing unknown files:");
next:
while (_dbus_directory_get_next_file (dir, &filename, &error))
goto next;
}
- printf (" %s\n", _dbus_string_get_const_data (&filename));
+ _dbus_test_diag (" %s", _dbus_string_get_const_data (&filename));
_dbus_verbose (" expecting %s\n",
validity == VALID ? "valid" :
dbus_bool_t retval;
if (validity == VALID)
- printf ("Testing valid file:\n");
+ _dbus_test_diag ("Testing valid file:");
else if (validity == INVALID)
- printf ("Testing invalid file:\n");
+ _dbus_test_diag ("Testing invalid file:");
else
- printf ("Testing unknown file:\n");
+ _dbus_test_diag ("Testing unknown file:");
/* print the filename, just so we match the other output */
- printf (" %s\n", _dbus_string_get_const_data (full_path));
+ _dbus_test_diag (" %s", _dbus_string_get_const_data (full_path));
/* only test one file */
retval = do_load (full_path, validity, TRUE);
if (test_data_dir == NULL ||
_dbus_string_get_length (test_data_dir) == 0)
{
- printf ("No test data\n");
+ _dbus_test_diag ("No test data");
return TRUE;
}
#include <dbus/dbus-internals.h>
#include <dbus/dbus-misc.h>
#include <dbus/dbus-sysdeps.h>
+#include <dbus/dbus-test-tap.h>
#include <string.h>
typedef enum
_dbus_assert_not_reached ("couldn't append string");
ret = bus_policy_check_can_own (policy, &service_name);
- printf (" Check name %s: %s\n", checks[i].name,
+ _dbus_test_diag (" Check name %s: %s", checks[i].name,
ret ? "allowed" : "not allowed");
if (checks[i].allowed && !ret)
{
}
if (validity == VALID)
- printf ("Testing valid files:\n");
+ _dbus_test_diag ("Testing valid files:");
else if (validity == INVALID)
- printf ("Testing invalid files:\n");
+ _dbus_test_diag ("Testing invalid files:");
else
- printf ("Testing unknown files:\n");
+ _dbus_test_diag ("Testing unknown files:");
next:
while (_dbus_directory_get_next_file (dir, &filename, &error))
goto next;
}
- printf (" %s\n", _dbus_string_get_const_data (&filename));
+ _dbus_test_diag (" %s", _dbus_string_get_const_data (&filename));
_dbus_verbose (" expecting %s\n",
validity == VALID ? "valid" :
goto finished;
}
- printf ("Comparing equivalent files:\n");
+ _dbus_test_diag ("Comparing equivalent files:");
next:
while (_dbus_directory_get_next_file (dir, &filename, &error))
goto next;
}
- printf (" %s\n", _dbus_string_get_const_data (&filename));
+ _dbus_test_diag (" %s", _dbus_string_get_const_data (&filename));
parser = bus_config_load (&full_path, TRUE, NULL, &error);
if (dbus_test_builddir == NULL || xdg_data_home == NULL ||
xdg_runtime_dir == NULL)
{
- printf ("Not testing default session service directories because a "
+ _dbus_test_diag ("Not testing default session service directories because a "
"build-time testing environment variable is not set: "
- "see AM_TESTS_ENVIRONMENT in tests/Makefile.am\n");
+ "see AM_TESTS_ENVIRONMENT in tests/Makefile.am");
ret = TRUE;
goto out;
}
BusConfigServiceDir *dir = link->data;
BusServiceDirFlags expected = BUS_SERVICE_DIR_FLAGS_NONE;
- printf (" test service dir: '%s'\n", dir->path);
- printf (" current standard service dir: '%s'\n", test_session_service_dir_matches[i]);
+ _dbus_test_diag (" test service dir: '%s'", dir->path);
+ _dbus_test_diag (" current standard service dir: '%s'", test_session_service_dir_matches[i]);
if (test_session_service_dir_matches[i] == NULL)
{
- printf ("more directories parsed than in match set\n");
+ _dbus_test_diag ("more directories parsed than in match set");
goto out;
}
if (strcmp (test_session_service_dir_matches[i], dir->path) != 0)
{
- printf ("'%s' directory does not match '%s' in the match set\n",
+ _dbus_test_diag ("'%s' directory does not match '%s' in the match set",
dir->path, test_session_service_dir_matches[i]);
goto out;
}
if (dir->flags != expected)
{
- printf ("'%s' directory has flags 0x%x, should be 0x%x\n",
+ _dbus_test_diag ("'%s' directory has flags 0x%x, should be 0x%x",
dir->path, dir->flags, expected);
goto out;
}
if (test_session_service_dir_matches[i] != NULL)
{
- printf ("extra data %s in the match set was not matched\n",
+ _dbus_test_diag ("extra data %s in the match set was not matched",
test_session_service_dir_matches[i]);
goto out;
}
link != NULL;
link = _dbus_list_get_next_link (&watched_dirs, link), i++)
{
- printf (" watched service dir: '%s'\n", (const char *) link->data);
- printf (" current standard service dir: '%s'\n",
+ _dbus_test_diag (" watched service dir: '%s'", (const char *) link->data);
+ _dbus_test_diag (" current standard service dir: '%s'",
test_session_service_dir_matches[i]);
if (test_session_service_dir_matches[i] == NULL)
{
- printf ("more directories parsed than in match set\n");
+ _dbus_test_diag ("more directories parsed than in match set");
goto out;
}
if (strcmp (test_session_service_dir_matches[i],
(const char *) link->data) != 0)
{
- printf ("'%s' directory does not match '%s' in the match set\n",
+ _dbus_test_diag ("'%s' directory does not match '%s' in the match set",
(const char *) link->data,
test_session_service_dir_matches[i]);
goto out;
if (test_session_service_dir_matches[i] != NULL)
{
- printf ("extra data %s in the match set was not matched\n",
+ _dbus_test_diag ("extra data %s in the match set was not matched",
test_session_service_dir_matches[i]);
goto out;
}
i = 0;
while ((link = _dbus_list_pop_first_link (&dirs)))
{
- printf (" test service dir: %s\n", (char *)link->data);
+ _dbus_test_diag (" test service dir: %s", (char *)link->data);
if (test_system_service_dir_matches[i] == NULL)
{
- printf ("more directories parsed than in match set\n");
+ _dbus_test_diag ("more directories parsed than in match set");
dbus_free (link->data);
_dbus_list_free_link (link);
return FALSE;
if (strcmp (test_system_service_dir_matches[i],
(char *)link->data) != 0)
{
- printf ("%s directory does not match %s in the match set\n",
+ _dbus_test_diag ("%s directory does not match %s in the match set",
(char *)link->data,
test_system_service_dir_matches[i]);
dbus_free (link->data);
if (test_system_service_dir_matches[i] != NULL)
{
- printf ("extra data %s in the match set was not matched\n",
+ _dbus_test_diag ("extra data %s in the match set was not matched",
test_system_service_dir_matches[i]);
return FALSE;
if (test_data_dir == NULL ||
_dbus_string_get_length (test_data_dir) == 0)
{
- printf ("No test data\n");
+ _dbus_test_diag ("No test data");
return TRUE;
}
return FALSE;
#ifdef DBUS_WIN
- printf("default system service dir skipped\n");
+ _dbus_test_diag ("default system service dir skipped");
#else
if (!test_default_system_servicedirs())
return FALSE;
#include <stdlib.h>
#include <dbus/dbus-internals.h>
#include <dbus/dbus-misc.h>
+#include <dbus/dbus-test-tap.h>
#if !defined(DBUS_ENABLE_EMBEDDED_TESTS) || !defined(DBUS_UNIX)
#error This file is only relevant for the embedded tests on Unix
#endif
-static void die (const char *failure) _DBUS_GNUC_NORETURN;
-
-static void
-die (const char *failure)
-{
- fprintf (stderr, "Unit test failed: %s\n", failure);
- exit (1);
-}
-
static void
check_memleaks (const char *name)
{
dbus_shutdown ();
-
- printf ("%s: checking for memleaks\n", name);
+
+ _dbus_test_diag ("%s: checking for memleaks", name);
if (_dbus_get_malloc_blocks_outstanding () != 0)
{
- _dbus_warn ("%d dbus_malloc blocks were not freed",
- _dbus_get_malloc_blocks_outstanding ());
- die ("memleaks");
+ _dbus_test_fatal ("%d dbus_malloc blocks were not freed",
+ _dbus_get_malloc_blocks_outstanding ());
}
}
dir = _dbus_getenv ("DBUS_TEST_DATA");
if (dir == NULL)
- {
- fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n");
- return 1;
- }
+ _dbus_test_fatal ("Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable");
- printf ("%s: Running launch helper OOM checks\n", argv[0]);
+ _dbus_test_diag ("%s: Running launch helper OOM checks", argv[0]);
- if (!_dbus_string_init (&config_file))
- return 1;
- if (!_dbus_string_append (&config_file, dir))
- return 1;
- if (!_dbus_string_append (&config_file, "/valid-config-files-system/debug-allow-all-pass.conf"))
- return 1;
+ if (!_dbus_string_init (&config_file) ||
+ !_dbus_string_append (&config_file, dir) ||
+ !_dbus_string_append (&config_file, "/valid-config-files-system/debug-allow-all-pass.conf"))
+ _dbus_test_fatal ("OOM during initialization");
/* use a config file that will actually work... */
dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG",
if (!_dbus_test_oom_handling ("dbus-daemon-launch-helper",
bus_activation_helper_oom_test,
(char *) "org.freedesktop.DBus.TestSuiteEchoService"))
- die ("OOM failed");
+ _dbus_test_fatal ("OOM test failed");
test_post_hook (argv[0]);
- printf ("%s: Success\n", argv[0]);
+ _dbus_test_diag ("%s: Success", argv[0]);
return 0;
}
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-internals.h>
#include <dbus/dbus-message-internal.h>
+#include <dbus/dbus-test-tap.h>
#include "selinux.h"
#ifndef DBUS_ENABLE_EMBEDDED_TESTS
# include <dbus/dbus-sysdeps-unix.h>
#endif
-static void die (const char *failure) _DBUS_GNUC_NORETURN;
-
-static void
-die (const char *failure)
-{
- fprintf (stderr, "Unit test failed: %s\n", failure);
- exit (1);
-}
-
static void
check_memleaks (const char *name)
{
dbus_shutdown ();
- printf ("%s: checking for memleaks\n", name);
+ _dbus_test_diag ("%s: checking for memleaks", name);
if (_dbus_get_malloc_blocks_outstanding () != 0)
{
- _dbus_warn ("%d dbus_malloc blocks were not freed",
- _dbus_get_malloc_blocks_outstanding ());
- die ("memleaks");
+ _dbus_test_fatal ("%d dbus_malloc blocks were not freed",
+ _dbus_get_malloc_blocks_outstanding ());
}
}
if (_dbus_getenv ("DBUS_TEST_SELINUX")
&& (!bus_selinux_pre_init ()
|| !bus_selinux_full_init ()))
- die ("could not init selinux support");
+ _dbus_test_fatal ("Could not init selinux support");
initial_fds = _dbus_check_fdleaks_enter ();
}
only = NULL;
if (dir == NULL)
- {
- fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n");
- return 1;
- }
+ _dbus_test_fatal ("Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable");
_dbus_string_init_const (&test_data_dir, dir);
#endif
if (!_dbus_threads_init_debug ())
- die ("initializing debug threads");
+ _dbus_test_fatal ("OOM initializing debug threads");
if (only == NULL || strcmp (only, "expire-list") == 0)
{
test_pre_hook ();
- printf ("%s: Running expire list test\n", argv[0]);
+ _dbus_test_diag ("%s: Running expire list test", argv[0]);
if (!bus_expire_list_test (&test_data_dir))
- die ("expire list");
+ _dbus_test_fatal ("expire list test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "config-parser") == 0)
{
test_pre_hook ();
- printf ("%s: Running config file parser test\n", argv[0]);
+ _dbus_test_diag ("%s: Running config file parser test", argv[0]);
if (!bus_config_parser_test (&test_data_dir))
- die ("parser");
+ _dbus_test_fatal ("parser test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "signals") == 0)
{
test_pre_hook ();
- printf ("%s: Running signals test\n", argv[0]);
+ _dbus_test_diag ("%s: Running signals test", argv[0]);
if (!bus_signals_test (&test_data_dir))
- die ("signals");
+ _dbus_test_fatal ("signals test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "dispatch-sha1") == 0)
{
test_pre_hook ();
- printf ("%s: Running SHA1 connection test\n", argv[0]);
+ _dbus_test_diag ("%s: Running SHA1 connection test", argv[0]);
if (!bus_dispatch_sha1_test (&test_data_dir))
- die ("sha1");
+ _dbus_test_fatal ("sha1 test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "dispatch") == 0)
{
test_pre_hook ();
- printf ("%s: Running message dispatch test\n", argv[0]);
+ _dbus_test_diag ("%s: Running message dispatch test", argv[0]);
if (!bus_dispatch_test (&test_data_dir))
- die ("dispatch");
+ _dbus_test_fatal ("dispatch test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "activation-service-reload") == 0)
{
test_pre_hook ();
- printf ("%s: Running service files reloading test\n", argv[0]);
+ _dbus_test_diag ("%s: Running service files reloading test", argv[0]);
if (!bus_activation_service_reload_test (&test_data_dir))
- die ("service reload");
+ _dbus_test_fatal ("service reload test failed");
test_post_hook ();
}
if (only == NULL || strcmp (only, "unix-fds-passing") == 0)
{
test_pre_hook ();
- printf ("%s: Running unix fd passing test\n", argv[0]);
+ _dbus_test_diag ("%s: Running unix fd passing test", argv[0]);
if (!bus_unix_fds_passing_test (&test_data_dir))
- die ("unix fd passing");
+ _dbus_test_fatal ("unix fd passing test failed");
test_post_hook ();
}
#endif
- printf ("%s: Success\n", argv[0]);
+ _dbus_test_diag ("%s: Success", argv[0]);
-
return 0;
}
#include <dbus/dbus-string.h>
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-internals.h>
+#include <dbus/dbus-test-tap.h>
#if !defined(DBUS_ENABLE_EMBEDDED_TESTS) || !defined(DBUS_UNIX)
#error This file is only relevant for the embedded tests on Unix
#endif
-static void die (const char *failure) _DBUS_GNUC_NORETURN;
-
-static void
-die (const char *failure)
-{
- fprintf (stderr, "Unit test failed: %s\n", failure);
- exit (1);
-}
-
static void
check_memleaks (const char *name)
{
dbus_shutdown ();
- printf ("%s: checking for memleaks\n", name);
+ _dbus_test_diag ("%s: checking for memleaks", name);
if (_dbus_get_malloc_blocks_outstanding () != 0)
{
- _dbus_warn ("%d dbus_malloc blocks were not freed",
- _dbus_get_malloc_blocks_outstanding ());
- die ("memleaks");
+ _dbus_test_fatal ("%d dbus_malloc blocks were not freed",
+ _dbus_get_malloc_blocks_outstanding ());
}
}
dir = _dbus_getenv ("DBUS_TEST_DATA");
if (dir == NULL)
- {
- fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n");
- return 1;
- }
+ _dbus_test_fatal ("Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable");
_dbus_string_init_const (&test_data_dir, dir);
if (!_dbus_threads_init_debug ())
- die ("initializing debug threads");
+ _dbus_test_fatal ("OOM initializing debug threads");
test_pre_hook ();
- printf ("%s: Running config file parser (trivial) test\n", argv[0]);
+ _dbus_test_diag ("%s: Running config file parser (trivial) test", argv[0]);
if (!bus_config_parser_trivial_test (&test_data_dir))
- die ("parser");
+ _dbus_test_fatal ("OOM creating parser");
test_post_hook ();
- printf ("%s: Success\n", argv[0]);
+ _dbus_test_diag ("%s: Success", argv[0]);
return 0;
}
#include "dbus-hash.h"
#include "dbus-credentials.h"
#include "dbus-internals.h"
+#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusAuthScript code for running unit test scripts for DBusAuth
"UNIX_ONLY"))
{
/* skip this file */
- fprintf (stderr, "skipping unix only auth script\n");
+ _dbus_test_diag ("skipping unix only auth script");
retval = TRUE;
goto out;
}
"WIN_ONLY"))
{
/* skip this file */
- fprintf (stderr, "skipping windows only auth script\n");
+ _dbus_test_diag ("skipping windows only auth script");
retval = TRUE;
goto out;
}
#include "dbus-internals.h"
#include "dbus-test.h"
#include "dbus-auth.h"
+#include <dbus/dbus-test-tap.h>
/**
* @addtogroup DBusAuth
goto failed;
}
- printf ("Testing %s:\n", subdir);
-
+ _dbus_test_diag ("Testing %s:", subdir);
+
next:
while (_dbus_directory_get_next_file (dir, &filename, &error))
{
goto next;
}
- printf (" %s\n", _dbus_string_get_const_data (&filename));
-
+ _dbus_test_diag (" %s", _dbus_string_get_const_data (&filename));
+
if (!_dbus_auth_script_run (&full_path))
{
_dbus_string_free (&full_path);
#include "dbus-hash.h"
#include "dbus-internals.h"
#include "dbus-mempool.h"
+#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusHashTable Hash table
_dbus_assert_not_reached ("no memory");
}
- printf ("Computing test hash keys...\n");
+ _dbus_test_diag ("Computing test hash keys...");
i = 0;
while (i < N_HASH_KEYS)
{
_dbus_assert (*(keys[i] + len) == '\0');
++i;
}
- printf ("... done.\n");
-
+ _dbus_test_diag ("... done.");
+
table1 = _dbus_hash_table_new (DBUS_HASH_STRING,
dbus_free, dbus_free);
if (table1 == NULL)
#include <dbus/dbus-string.h>
#include <dbus/dbus-list.h>
#include <dbus/dbus-sysdeps.h>
+#include <dbus/dbus-test-tap.h>
/**
* @defgroup DBusKeyring keyring class
++i;
}
- printf (" %d keys in test\n", ring1->n_keys);
+ _dbus_test_diag (" %d keys in test", ring1->n_keys);
/* Test ref/unref */
_dbus_keyring_ref (ring1);
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-marshal-byteswap.h"
#include "dbus-test.h"
+#include <dbus/dbus-test-tap.h>
#include <stdio.h>
static void
_dbus_string_free (&signature);
_dbus_string_free (&body);
- printf (" %d blocks swapped from order '%c' to '%c'\n",
+ _dbus_test_diag (" %d blocks swapped from order '%c' to '%c'",
sequence, byte_order, opposite_order);
}
#include "dbus-message-private.h"
#include "dbus-signature.h"
#include "dbus-test.h"
+#include <dbus/dbus-test-tap.h>
#include <stdio.h>
typedef enum
_dbus_assert (iter->depth == (base_depth + 0));
#if 0
- printf ("Changing byte %d in message %d to %c\n",
+ _dbus_test_diag ("Changing byte %d in message %d to %c",
byte_seq, iter_get_sequence (iter), typecodes[typecode_seq]);
#endif
}
#if 0
- printf ("body %d change %d pos %d ",
+ _dbus_test_diag ("body %d change %d pos %d ",
body_seq, change_seq, byte_seq);
if (change->type == CHANGE_TYPE_ADJUST)
- printf ("adjust by %d", (int) change->value);
+ _dbus_test_diag ("adjust by %d", (int) change->value);
else
- printf ("set to %u", change->value);
+ _dbus_test_diag ("set to %u", change->value);
- printf (" \t%u -> %u\n",
+ _dbus_test_diag (" \t%u -> %u",
_dbus_marshal_read_uint32 (data, byte_seq, byte_order, NULL),
v_UINT32);
#endif
if (iter_first_in_series (iter))
{
- printf (" testing message loading: %s ", generators[generator].name);
- fflush (stdout);
+ _dbus_test_diag (" testing message loading: %s ", generators[generator].name);
}
func = generators[generator].func;
iter_unrecurse (iter);
iter_next (iter); /* next generator */
_dbus_string_free (&data->data);
- printf ("%d test loads cumulative\n", iter->count);
+ _dbus_test_diag ("%d test loads cumulative", iter->count);
goto restart;
}
iter_unrecurse (iter);
#ifdef HAVE_UNIX_FD_PASSING
#include "dbus-sysdeps-unix.h"
#endif
+#include <dbus/dbus-test-tap.h>
#ifdef __linux__
/* Necessary for the Linux-specific fd leak checking code only */
;
else if ((not_seen && validities_seen[i] == 0) ||
(!not_seen && validities_seen[i] > 0))
- printf ("validity %3d seen %d times\n",
+ _dbus_test_diag ("validity %3d seen %d times",
i - _DBUS_NEGATIVE_VALIDITY_COUNT,
validities_seen[i]);
++i;
goto failed;
}
- printf ("Testing %s:\n", subdir);
+ _dbus_test_diag ("Testing %s:", subdir);
next:
while (_dbus_directory_get_next_file (dir, &filename, &error))
{
if (_dbus_string_ends_with_c_str (&filename, ".message"))
{
- printf ("SKIP: Could not load %s, message builder language no longer supported\n",
+ _dbus_test_diag ("SKIP: Could not load %s, message builder language no longer supported",
_dbus_string_get_const_data (&filename));
}
goto next;
}
- printf (" %s\n",
+ _dbus_test_diag (" %s",
_dbus_string_get_const_data (&filename));
if (! (*function) (&full_path,
count += 1;
}
- printf ("%d sample messages tested\n", count);
+ _dbus_test_diag ("%d sample messages tested", count);
print_validities_seen (FALSE);
print_validities_seen (TRUE);
#include "dbus-internals.h"
#include "dbus-sha.h"
#include "dbus-marshal-basic.h" /* for byteswap routines */
+#include <dbus/dbus-test-tap.h>
#include <string.h>
/* The following comments have the history of where this code
old_byte |= current_b << bit_containing_next_bit;
#if 0
- printf ("Appending bit %d to byte %d at bit %d resulting in byte 0x%x\n",
+ _dbus_test_diag ("Appending bit %d to byte %d at bit %d resulting in byte 0x%x",
current_b, byte_containing_next_bit,
bit_containing_next_bit, old_byte);
#endif
goto next_iteration;
else if (_dbus_string_starts_with_c_str (&line, "H>"))
{
- printf ("SHA-1: %s\n", _dbus_string_get_const_data (&line));
+ _dbus_test_diag ("SHA-1: %s", _dbus_string_get_const_data (&line));
if (_dbus_string_find (&line, 0, "Type 3", NULL))
{
* to use those tests.
*/
- printf (" (ending tests due to Type 3 tests seen - this is normal)\n");
+ _dbus_test_diag (" (ending tests due to Type 3 tests seen - this is normal)");
break;
}
}
retval = TRUE;
- printf ("Passed the %d SHA-1 tests in the test file\n",
+ _dbus_test_diag ("Passed the %d SHA-1 tests in the test file",
success_count);
out:
return FALSE;
}
else
- printf ("No test data dir\n");
+ _dbus_test_diag ("No test data dir");
i = 0;
while (i < 256)
#include "dbus-string.h"
#define DBUS_CAN_USE_DBUS_STRING_PRIVATE 1
#include "dbus-string-private.h"
+#include <dbus/dbus-test-tap.h>
/**
* @addtogroup DBusString
{
const char *s;
- printf ("Original string %d bytes encoded %d bytes decoded %d bytes\n",
+
+ _dbus_test_diag ("Original string %d bytes encoded %d bytes decoded %d bytes",
_dbus_string_get_length (&orig),
_dbus_string_get_length (&encoded),
_dbus_string_get_length (&decoded));
- printf ("Original: %s\n", data);
+ _dbus_test_diag ("Original: %s", data);
s = _dbus_string_get_const_data (&decoded);
- printf ("Decoded: %s\n", s);
- _dbus_assert_not_reached ("original string not the same as string decoded from hex");
+ _dbus_test_diag ("Decoded: %s", s);
+ _dbus_test_fatal ("original string not the same as string decoded from hex");
}
_dbus_string_free (&orig);
#include "dbus-test.h"
#include "dbus-sysdeps.h"
#include "dbus-internals.h"
+#include <dbus/dbus-test-tap.h>
#include <stdio.h>
#include <stdlib.h>
{
dbus_shutdown ();
- printf ("%s: checking for memleaks\n", "test-dbus");
+ _dbus_test_diag ("%s: checking for memleaks", "test-dbus");
if (_dbus_get_malloc_blocks_outstanding () != 0)
{
_dbus_warn ("%d dbus_malloc blocks were not freed",
{
if (!specific_test || strcmp (specific_test, test_name) == 0)
{
- printf ("%s: running %s tests\n", "test-dbus", test_name);
+ _dbus_test_diag ("%s: running %s tests", "test-dbus", test_name);
if (!test ())
die (test_name);
{
if (!specific_test || strcmp (specific_test, test_name) == 0)
{
- printf ("%s: running %s tests\n", "test-dbus", test_name);
+ _dbus_test_diag ("%s: running %s tests", "test-dbus", test_name);
if (!test (test_data_dir))
die (test_name);
test_data_dir = _dbus_getenv ("DBUS_TEST_DATA");
if (test_data_dir != NULL)
- printf ("Test data in %s\n", test_data_dir);
+ _dbus_test_diag ("Test data in %s", test_data_dir);
else
- printf ("No test data!\n");
+ _dbus_test_diag ("No test data!");
run_test ("string", specific_test, _dbus_string_test);
run_data_test ("auth", specific_test, _dbus_auth_test, test_data_dir);
- printf ("%s: completed successfully\n", "test-dbus");
+ _dbus_test_diag ("%s: completed successfully", "test-dbus");
}
#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
#include "dbus-test.h"
#include "dbus-internals.h"
#include "dbus-protocol.h"
+#include <dbus/dbus-test-tap.h>
#include <string.h>
#ifdef HAVE_SYSTEMD
if (!_dbus_groups_from_uid (uid, &group_ids, &n_group_ids))
_dbus_assert_not_reached ("didn't get groups");
- printf (" Current user: %s homedir: %s gids:",
+ _dbus_test_diag (" Current user: %s homedir: %s gids:",
_dbus_string_get_const_data (username),
_dbus_string_get_const_data (homedir));
for (i=0; i<n_group_ids; i++)
- printf(" %ld", group_ids[i]);
-
- printf ("\n");
+ _dbus_test_diag ("- %ld", group_ids[i]);
dbus_error_init (&error);
- printf ("Is Console user: %i\n",
+ _dbus_test_diag ("Is Console user: %i",
_dbus_is_console_user (uid, &error));
- printf ("Invocation was OK: %s\n", error.message ? error.message : "yes");
+ _dbus_test_diag ("Invocation was OK: %s", error.message ? error.message : "yes");
dbus_error_free (&error);
- printf ("Is Console user 4711: %i\n",
+ _dbus_test_diag ("Is Console user 4711: %i",
_dbus_is_console_user (4711, &error));
- printf ("Invocation was OK: %s\n", error.message ? error.message : "yes");
+ _dbus_test_diag ("Invocation was OK: %s", error.message ? error.message : "yes");
dbus_error_free (&error);
dbus_free (group_ids);