[PATCH xserver 07/10] tests: Move test/xi1/tests binary into test/tests
Mihail Konev
k.mvc at ya.ru
Fri Dec 30 08:30:58 UTC 2016
Avoids one more linking.
Signed-off-by: Mihail Konev <k.mvc at ya.ru>
---
test/Makefile.am | 34 +++++++++++++++----------------
test/tests.c | 6 ++++++
test/xi1/protocol_xchangedevicecontrol.sh | 1 -
test/xi1/tests.c | 13 ------------
test/xi1/tests.h | 6 +++---
5 files changed, 26 insertions(+), 34 deletions(-)
delete mode 100644 test/xi1/tests.c
diff --git a/test/Makefile.am b/test/Makefile.am
index ce1e6e6ce1a3..71bfa63adae4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,6 +6,16 @@ check_LTLIBRARIES = libxservertest.la
noinst_PROGRAMS = simple-xinit tests
tests_SOURCES = list.c string.c tests.c
+tests_LDFLAGS =
+
+
+if HAVE_LD_WRAP
+tests_SOURCES += xi2/protocol-common.c
+tests_LDFLAGS += \
+ -Wl,-wrap,dixLookupWindow \
+ -Wl,-wrap,dixLookupClient \
+ $()
+endif HAVE_LD_WRAP
if XORG
# Tests that require at least some DDX functions in order to fully link
@@ -60,6 +70,8 @@ AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
endif
tests_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
+tests_CPPFLAGS = $(AM_CPPFLAGS)
+
if SPECIAL_DTRACE_OBJECTS
tests_LDADD += $(OS_LIB) $(DIX_LIB)
endif
@@ -176,30 +188,18 @@ EXTRA_DIST = \
if ENABLE_UNIT_TESTS
if HAVE_LD_WRAP
-noinst_PROGRAMS += xi1/tests
-
TESTS += \
xi1/protocol_xchangedevicecontrol.sh \
$()
-xi1_tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-xi1_tests_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/xi2
-xi1_tests_LDFLAGS = \
- -Wl,-wrap,dixLookupWindow \
- -Wl,-wrap,dixLookupClient \
- -Wl,-wrap,WriteToClient \
+tests_CPPFLAGS += \
+ -DENABLE_XI1_TESTS \
+ -I$(srcdir)/xi2 \
$()
-xi1_tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
-xi1_tests_SOURCES = \
- xi2/protocol-common.c \
+tests_SOURCES += \
xi1/protocol-xchangedevicecontrol.c \
- xi1/tests.c
-
-if SPECIAL_DTRACE_OBJECTS
-xi1_tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
+ $()
else !HAVE_LD_WRAP
diff --git a/test/tests.c b/test/tests.c
index c37e66c689b1..451631c33a8e 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -1,5 +1,7 @@
#include <string.h>
+
#include "tests.h"
+#include "xi1/tests.h"
int main(int argc, char **argv) {
if (argc < 2) { return 1; }
@@ -19,5 +21,9 @@ int main(int argc, char **argv) {
try_command(touch);
try_command(hashtable);
+#ifdef ENABLE_XI1_TESTS
+ try_command(protocol_xchangedevicecontrol);
+#endif
+
return 1;
}
diff --git a/test/xi1/protocol_xchangedevicecontrol.sh b/test/xi1/protocol_xchangedevicecontrol.sh
index 3dc42a4dbce5..dd9106615e6a 100755
--- a/test/xi1/protocol_xchangedevicecontrol.sh
+++ b/test/xi1/protocol_xchangedevicecontrol.sh
@@ -1,3 +1,2 @@
#!/bin/sh
-test_subdir=xi1
. $srcdir/common.sh
diff --git a/test/xi1/tests.c b/test/xi1/tests.c
deleted file mode 100644
index eee5bba191a7..000000000000
--- a/test/xi1/tests.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <string.h>
-#include "tests.h"
-
-int main(int argc, char **argv) {
- if (argc < 2) { return 1; }
-
-#define try_command(func) \
- if (strcmp(argv[1], #func) == 0) { return func ## _test (); };
-
- try_command(protocol_xchangedevicecontrol);
-
- return 1;
-}
diff --git a/test/xi1/tests.h b/test/xi1/tests.h
index 8a42aa0da592..65c81cdb4fbf 100644
--- a/test/xi1/tests.h
+++ b/test/xi1/tests.h
@@ -1,7 +1,7 @@
-#ifndef TESTS_H
-#define TESTS_H
+#ifndef XI1_TESTS_H
+#define XI1_TESTS_H
int protocol_xchangedevicecontrol_test(void);
-#endif /* TESTS_H */
+#endif /* XI1_TESTS_H */
--
2.9.2
More information about the xorg-devel
mailing list