28 #include "dbus/dbus-test-tap.h"
41 static unsigned int failures = 0;
42 static unsigned int tap_test_counter = 0;
48 _dbus_test_fatal (
const char *format,
53 printf (
"Bail out! ");
54 va_start (ap, format);
66 _dbus_test_diag (
const char *format,
72 va_start (ap, format);
87 _dbus_test_skip_all (
const char *format,
94 printf (
"1..0 # SKIP - ");
95 va_start (ap, format);
108 _dbus_test_ok (
const char *format,
113 printf (
"ok %u - ", ++tap_test_counter);
114 va_start (ap, format);
115 vprintf (format, ap);
126 _dbus_test_not_ok (
const char *format,
131 printf (
"not ok %u - ", ++tap_test_counter);
132 va_start (ap, format);
133 vprintf (format, ap);
145 _dbus_test_skip (
const char *format,
150 printf (
"ok %u # SKIP ", ++tap_test_counter);
151 va_start (ap, format);
152 vprintf (format, ap);
165 _dbus_test_check_memleaks (
const char *test_name)
167 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
170 if (_dbus_get_malloc_blocks_outstanding () == 0)
172 printf (
"ok %u - %s did not leak memory\n", ++tap_test_counter,
177 printf (
"not ok %u - %s leaked %d blocks\n",
178 ++tap_test_counter, test_name,
179 _dbus_get_malloc_blocks_outstanding ());
184 "unable to determine whether %s leaked memory (not compiled "
185 "with memory instrumentation)",
195 _dbus_test_done_testing (
void)
198 _dbus_test_diag (
"%u tests passed", tap_test_counter);
200 _dbus_test_diag (
"%u/%u tests failed", failures, tap_test_counter);
202 printf (
"1..%u\n", tap_test_counter);