[PATCH 1/3] wayland-private: add define for testing static functions
Marek Ch
mchqwerty at gmail.com
Thu Dec 5 07:38:20 PST 2013
Just like in Weston tests. This macro expands to WL_EXPORT
when being compiled in tests and to 'static' keyword otherwise.
---
src/wayland-private.h | 7 +++++++
tests/Makefile.am | 5 ++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/wayland-private.h b/src/wayland-private.h
index 67e8783..850d571 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -31,6 +31,13 @@
#include "wayland-util.h"
+/* allow test private functions */
+#ifdef UNIT_TEST
+#define WL_PRIVATE WL_EXPORT
+#else
+#define WL_PRIVATE static
+#endif
+
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
#define container_of(ptr, type, member) ({ \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9c673ae..4552159 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,7 +45,10 @@ os_wrappers_test_SOURCES = \
$(test_runner_src)
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
-AM_CFLAGS = $(GCC_CFLAGS) $(FFI_CFLAGS)
+AM_CFLAGS = \
+ $(GCC_CFLAGS) \
+ $(FFI_CFLAGS) \
+ -DUNIT_TEST
LDADD = $(top_builddir)/src/libwayland-util.la \
$(top_builddir)/src/libwayland-client.la \
$(top_builddir)/src/libwayland-server.la \
--
1.8.4.2
More information about the wayland-devel
mailing list