dbus-string.c
dbus-sysdeps.c
dbus-pipe.c
- dbus-test-tap.c
)
set(DBUS_SHARED_HEADERS
dbus-string-private.h
dbus-pipe.h
dbus-sysdeps.h
- dbus-test-tap.h
)
+if(DBUS_ENABLE_EMBEDDED_TESTS)
+ set(DBUS_SHARED_SOURCES ${DBUS_SHARED_SOURCES} dbus-test-tap.c)
+ set(DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS} dbus-test-tap.h)
+ # ... else they are in the test library instead
+endif()
+
### source code that is generic utility functionality used
### by the bus daemon or test apps, but is NOT included
### in the D-BUS client library (all symbols in here
$(DBUS_SHARED_arch_sources) \
dbus-sysdeps.c \
dbus-sysdeps.h \
- dbus-test-tap.c \
- dbus-test-tap.h \
dbus-valgrind-internal.h
+if DBUS_ENABLE_EMBEDDED_TESTS
+DBUS_SHARED_SOURCES += \
+ dbus-test-tap.c \
+ dbus-test-tap.h \
+ $(NULL)
+# else they are included in the test library instead
+endif
+
### source code that is generic utility functionality used
### by the bus daemon or test apps, but is NOT included
### in the D-Bus client library (all symbols in here
* will not be explained here.
*/
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
-
#include <stdio.h>
#include <stdlib.h>
void
_dbus_test_check_memleaks (const char *test_name)
{
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
dbus_shutdown ();
if (_dbus_get_malloc_blocks_outstanding () == 0)
_dbus_get_malloc_blocks_outstanding ());
failures++;
}
+#else
+ _dbus_test_skip (
+ "unable to determine whether %s leaked memory (not compiled "
+ "with memory instrumentation)",
+ test_name);
+#endif
}
/*
return 1;
}
-
-#endif
#include <dbus/dbus-internals.h>
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
-
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_fatal (const char *format,
...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_diag (const char *format,
...) _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_skip_all (const char *format,
...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_ok (const char *format,
...) _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_not_ok (const char *format,
...) _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_skip (const char *format,
...) _DBUS_GNUC_PRINTF (1, 2);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
void _dbus_test_check_memleaks (const char *test_name);
-DBUS_PRIVATE_EXPORT
+DBUS_EMBEDDED_TESTS_EXPORT
int _dbus_test_done_testing (void);
#define _dbus_test_check(a) do { \
} while (0)
#endif
-
-#endif
#endif
#include "dbus/dbus-message-internal.h"
-#include "dbus/dbus-test-tap.h"
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
/*
* Like strdup(), but crash on out-of-memory, and pass through NULL
* unchanged (the "0" in the name is meant to be a mnemonic for this,
return ret;
}
-#endif
typedef struct
{
_dbus_assert (*message_p != NULL);
}
-#ifdef DBUS_ENABLE_EMBEDDED_TESTS
-
#ifdef DBUS_UNIX
/*
return _dbus_test_done_testing ();
}
+/* If embedded tests are enabled, the TAP helpers have to be in the
+ * shared library because some of the embedded tests call them. If not,
+ * implement them here. We #include the file here instead of adding it
+ * to SOURCES because Automake versions older than 1.16 can't cope with
+ * expanding directory variables in SOURCES when using subdir-objects. */
+#ifndef DBUS_ENABLE_EMBEDDED_TESTS
+#include "dbus/dbus-test-tap.c"
#endif
#include <dbus/dbus-internals.h>
#include <dbus/dbus-types.h>
+#include "dbus/dbus-test-tap.h"
+
typedef DBusLoop TestMainContext;
_DBUS_WARN_UNUSED_RESULT