[PATCH weston v1 02/17] tests: link tests against libtoytoolkit

Marek Chalupa mchqwerty at gmail.com
Fri Dec 5 05:36:35 PST 2014


We want to use toytoolkit in tests. This patch also
removes collisions of symbols defined in libtoytoolkit
with symbols defined in tests (i. e. shm_listener)

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 Makefile.am                       | 26 +++++++++++++++-----------
 tests/weston-test-client-helper.c |  5 +++--
 tests/weston-test-client-helper.h | 14 ++------------
 tests/weston-test-runner.h        |  2 ++
 4 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4f4bb28..47c44dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1003,51 +1003,55 @@ libtest_client_la_SOURCES =			\
 nodist_libtest_client_la_SOURCES =		\
 	protocol/wayland-test-protocol.c	\
 	protocol/wayland-test-client-protocol.h
-libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
-libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
+libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
+libtest_client_la_LIBADD =			\
+	$(TEST_CLIENT_LIBS)			\
+	libshared.la				\
+	libtest-runner.la			\
+	libtoytoolkit.la
 
 bad_buffer_weston_SOURCES = tests/bad-buffer-test.c
-bad_buffer_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+bad_buffer_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 bad_buffer_weston_LDADD = libtest-client.la
 
 keyboard_weston_SOURCES = tests/keyboard-test.c
-keyboard_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+keyboard_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 keyboard_weston_LDADD = libtest-client.la
 
 event_weston_SOURCES = tests/event-test.c
-event_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+event_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 event_weston_LDADD = libtest-client.la
 
 button_weston_SOURCES = tests/button-test.c
-button_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+button_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 button_weston_LDADD = libtest-client.la
 
 text_weston_SOURCES = tests/text-test.c
 nodist_text_weston_SOURCES =			\
 	protocol/text-protocol.c		\
 	protocol/text-client-protocol.h
-text_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+text_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 text_weston_LDADD = libtest-client.la
 
 subsurface_weston_SOURCES = tests/subsurface-test.c
-subsurface_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+subsurface_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 subsurface_weston_LDADD = libtest-client.la
 
 presentation_weston_SOURCES = tests/presentation-test.c
 nodist_presentation_weston_SOURCES =		\
 	protocol/presentation_timing-protocol.c	\
 	protocol/presentation_timing-client-protocol.h
-presentation_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+presentation_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 presentation_weston_LDADD = libtest-client.la
 
 roles_weston_SOURCES = tests/roles-test.c
-roles_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+roles_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
 roles_weston_LDADD = libtest-client.la
 
 if ENABLE_EGL
 weston_tests += buffer-count.weston
 buffer_count_weston_SOURCES = tests/buffer-count-test.c
-buffer_count_weston_CFLAGS = $(GCC_CFLAGS) $(EGL_TESTS_CFLAGS)
+buffer_count_weston_CFLAGS = $(GCC_CFLAGS) $(EGL_TESTS_CFLAGS) $(CLIENT_CFLAGS)
 buffer_count_weston_LDADD = libtest-client.la $(EGL_TESTS_LIBS)
 endif
 
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index e374a96..45c2957 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -30,6 +30,7 @@
 #include <sys/mman.h>
 
 #include "../shared/os-compatibility.h"
+#include "../clients/window.h"
 #include "weston-test-client-helper.h"
 
 int
@@ -328,7 +329,7 @@ shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
 		client->has_argb = 1;
 }
 
-struct wl_shm_listener shm_listener = {
+struct wl_shm_listener wl_shm_listener = {
 	shm_format
 };
 
@@ -466,7 +467,7 @@ handle_global(void *data, struct wl_registry *registry,
 		client->wl_shm =
 			wl_registry_bind(registry, id,
 					 &wl_shm_interface, 1);
-		wl_shm_add_listener(client->wl_shm, &shm_listener, client);
+		wl_shm_add_listener(client->wl_shm, &wl_shm_listener, client);
 	} else if (strcmp(interface, "wl_output") == 0) {
 		output = xzalloc(sizeof *output);
 		output->wl_output =
diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
index 2cf3d8f..721fc5f 100644
--- a/tests/weston-test-client-helper.h
+++ b/tests/weston-test-client-helper.h
@@ -26,9 +26,10 @@
 #include "config.h"
 
 #include <assert.h>
-#include "weston-test-runner.h"
 #include "wayland-test-client-protocol.h"
 
+#include "weston-test-runner.h"
+
 struct client {
 	struct wl_display *wl_display;
 	struct wl_registry *wl_registry;
@@ -101,17 +102,6 @@ struct surface {
 	void *data;
 };
 
-static inline void *
-xzalloc(size_t size)
-{
-        void *p;
-
-        p = calloc(1, size);
-        assert(p);
-
-        return p;
-}
-
 struct client *
 client_create(int x, int y, int width, int height);
 
diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h
index 193b76d..33de67e 100644
--- a/tests/weston-test-runner.h
+++ b/tests/weston-test-runner.h
@@ -41,7 +41,9 @@ struct weston_test {
 	int must_fail;
 } __attribute__ ((aligned (32)));
 
+#ifndef ARRAY_LENGTH
 #define ARRAY_LENGTH(a) ((int) (sizeof (a) / sizeof (a)[0]))
+#endif
 
 #define TEST_BEGIN(name, arg)					\
 	static void name(arg)
-- 
2.1.0



More information about the wayland-devel mailing list