[PATCH xserver 5/6] tests: Move test/{xi1,xi2}/tests to test/

Mihail Konev k.mvc at ya.ru
Wed Jan 4 06:31:43 UTC 2017


Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Prevents 'make -j' from waiting until last job in xi*/ compeletes.

Signed-off-by: Mihail Konev <k.mvc at ya.ru>
---
 configure.ac         |  2 --
 test/Makefile.am     | 62 ++++++++++++++++++++++++++++++++++++++++++++++++----
 test/tests.c         | 16 ++++++++++++++
 test/xi1/.gitignore  |  1 -
 test/xi1/Makefile.am | 44 -------------------------------------
 test/xi1/tests.c     | 11 ----------
 test/xi2/.gitignore  |  1 -
 test/xi2/Makefile.am | 56 -----------------------------------------------
 test/xi2/tests.c     | 21 ------------------
 9 files changed, 74 insertions(+), 140 deletions(-)
 delete mode 100644 test/xi1/.gitignore
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi1/tests.c
 delete mode 100644 test/xi2/.gitignore
 delete mode 100644 test/xi2/Makefile.am
 delete mode 100644 test/xi2/tests.c

diff --git a/configure.ac b/configure.ac
index 93c81a644052..d265528ea124 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2679,8 +2679,6 @@ hw/kdrive/linux/Makefile
 hw/kdrive/src/Makefile
 hw/xwayland/Makefile
 test/Makefile
-test/xi1/Makefile
-test/xi2/Makefile
 xserver.ent
 xorg-server.pc
 ])
diff --git a/test/Makefile.am b/test/Makefile.am
index 88b30c9592e4..8c0530130b1a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,11 +1,10 @@
 if ENABLE_UNIT_TESTS
-SUBDIRS= .
 tests_CPPFLAGS=
+CLEANFILES=
 
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
-SUBDIRS += xi1 xi2
 if RES
 RES_SRCS = hashtabletest.c
 tests_CPPFLAGS += -DRES_TESTS
@@ -42,12 +41,26 @@ TESTS_ENVIRONMENT = \
 tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 tests_CPPFLAGS = $(XORG_INCS)
 if XORG
-tests_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+tests_CPPFLAGS += \
+        -I$(srcdir)/xi1 \
+        -I$(srcdir)/xi2 \
+        -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/ddc \
 	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
 	-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
 	-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
+
+tests_LDFLAGS = \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,dixLookupClient \
+	-Wl,-wrap,WriteToClient \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,XISetEventMask \
+	-Wl,-wrap,AddResource \
+	-Wl,-wrap,GrabButton \
+	$()
+
 tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
@@ -69,6 +82,47 @@ tests_SOURCES = \
         $(RES_SRCS) \
         tests.c
 
+if HAVE_LD_WRAP
+
+tests_CPPFLAGS += -DLDWRAP_TESTS
+
+tests_SOURCES += \
+	xi1/protocol-xchangedevicecontrol.c \
+	xi2/protocol-common.c \
+	xi2/protocol-xiqueryversion.c \
+	xi2/protocol-xiquerydevice.c \
+	xi2/protocol-xiselectevents.c \
+	xi2/protocol-xigetselectedevents.c \
+	xi2/protocol-xisetclientpointer.c \
+	xi2/protocol-xigetclientpointer.c \
+	xi2/protocol-xiquerypointer.c \
+	xi2/protocol-xipassivegrabdevice.c \
+	xi2/protocol-xiwarppointer.c \
+	xi2/protocol-eventconvert.c \
+	xi2/xi2.c
+
+else !HAVE_LD_WRAP
+
+# Print that xi1-tests were skipped (exit code 77 for automake test harness)
+TESTS += xi1-tests
+CLEANFILES += xi1-tests
+
+xi1-tests:
+	@echo 'echo "ld -wrap support required for xi1 unit tests, skipping"' > $@
+	@echo 'exit 77' >> $@
+	$(AM_V_GEN)chmod +x $@
+
+# Print that xi2-tests were skipped (exit code 77 for automake test harness)
+TESTS += xi2-tests
+CLEANFILES += xi2-tests
+
+xi2-tests:
+	@echo 'echo "ld -wrap support required for xi2 unit tests, skipping"' > $@
+	@echo 'exit 77' >> $@
+	$(AM_V_GEN)chmod +x $@
+
+endif !HAVE_LD_WRAP
+
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
 
@@ -88,7 +142,7 @@ libxservertest_la_LIBADD += \
             @XORG_LIBS@
 
 BUILT_SOURCES = sdksyms.c
-CLEANFILES = sdksyms.c
+CLEANFILES += sdksyms.c
 
 sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
 	$(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
diff --git a/test/tests.c b/test/tests.c
index cf72acafb65b..add51bd4834d 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -21,5 +21,21 @@ main(int argc, char **argv)
     run_test(xkb_test);
     run_test(xtest_test);
 
+#ifdef LDWRAP_TESTS
+    run_test(protocol_xchangedevicecontrol_test);
+
+    run_test(protocol_xiqueryversion_test);
+    run_test(protocol_xiquerydevice_test);
+    run_test(protocol_xiselectevents_test);
+    run_test(protocol_xigetselectedevents_test);
+    run_test(protocol_xisetclientpointer_test);
+    run_test(protocol_xigetclientpointer_test);
+    run_test(protocol_xipassivegrabdevice_test);
+    run_test(protocol_xiquerypointer_test);
+    run_test(protocol_xiwarppointer_test);
+    run_test(protocol_eventconvert_test);
+    run_test(xi2_test);
+#endif
+
     return 0;
 }
diff --git a/test/xi1/.gitignore b/test/xi1/.gitignore
deleted file mode 100644
index 2b29f27645f8..000000000000
--- a/test/xi1/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tests
diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
deleted file mode 100644
index 7a054dd80966..000000000000
--- a/test/xi1/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-if ENABLE_UNIT_TESTS
-if HAVE_LD_WRAP
-noinst_PROGRAMS = tests
-
-TESTS = tests
-
-TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
-
-tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-tests_CPPFLAGS = \
-	@XORG_INCS@ \
-	-I$(srcdir)/.. \
-	-I$(srcdir)/../xi2 \
-	$()
-
-tests_LDFLAGS = \
-	-Wl,-wrap,dixLookupWindow \
-	-Wl,-wrap,dixLookupClient \
-	-Wl,-wrap,WriteToClient \
-	$()
-
-tests_LDADD =../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
-tests_SOURCES = \
-	$(srcdir)/../tests-common.c \
-	$(srcdir)/../xi2/protocol-common.c \
-	protocol-xchangedevicecontrol.c \
-	tests.c
-
-if SPECIAL_DTRACE_OBJECTS
-tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-else
-# Print that xi1-tests were skipped (exit code 77 for automake test harness)
-TESTS = xi1-tests
-CLEANFILES = $(TESTS)
-
-xi1-tests:
-	@echo 'echo "ld -wrap support required for xi1 unit tests, skipping"' > $@
-	@echo 'exit 77' >> $@
-	$(AM_V_GEN)chmod +x $@
-endif
-endif
diff --git a/test/xi1/tests.c b/test/xi1/tests.c
deleted file mode 100644
index df4638dc98ab..000000000000
--- a/test/xi1/tests.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <string.h>
-#include "tests.h"
-#include "tests-common.h"
-
-int
-main(int argc, char **argv)
-{
-    run_test(protocol_xchangedevicecontrol_test);
-
-    return 0;
-}
diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
deleted file mode 100644
index 2b29f27645f8..000000000000
--- a/test/xi2/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tests
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
deleted file mode 100644
index a7f9831a93cd..000000000000
--- a/test/xi2/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-if ENABLE_UNIT_TESTS
-if HAVE_LD_WRAP
-noinst_PROGRAMS = tests
-
-TESTS = tests
-
-TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
-
-tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-
-tests_CPPFLAGS = \
-	@XORG_INCS@ \
-	-I$(srcdir)/..
-
-tests_LDADD = ../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
-if SPECIAL_DTRACE_OBJECTS
-tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-tests_LDFLAGS = \
-        -Wl,-wrap,WriteToClient \
-        -Wl,-wrap,dixLookupWindow \
-        -Wl,-wrap,XISetEventMask \
-        -Wl,-wrap,AddResource \
-        -Wl,-wrap,GrabButton \
-        -Wl,-wrap,dixLookupClient \
-        $()
-
-tests_SOURCES = \
-	$(srcdir)/../tests-common.c \
-	protocol-common.c \
-	protocol-xiqueryversion.c \
-	protocol-xiquerydevice.c \
-	protocol-xiselectevents.c \
-	protocol-xigetselectedevents.c \
-	protocol-xisetclientpointer.c \
-	protocol-xigetclientpointer.c \
-	protocol-xiquerypointer.c \
-	protocol-xipassivegrabdevice.c \
-	protocol-xiwarppointer.c \
-	protocol-eventconvert.c \
-	xi2.c \
-	tests.c
-
-else
-# Print that xi2-tests were skipped (exit code 77 for automake test harness)
-TESTS = xi2-tests
-CLEANFILES = $(TESTS)
-
-xi2-tests:
-	@echo 'echo "ld -wrap support required for xi2 unit tests, skipping"' > $@
-	@echo 'exit 77' >> $@
-	$(AM_V_GEN)chmod +x $@
-endif
-endif
diff --git a/test/xi2/tests.c b/test/xi2/tests.c
deleted file mode 100644
index 559fb23ed1d4..000000000000
--- a/test/xi2/tests.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "tests.h"
-#include "tests-common.h"
-#include "protocol-common.h"
-
-int
-main(int argc, char **argv)
-{
-    run_test(protocol_xiqueryversion_test);
-    run_test(protocol_xiquerydevice_test);
-    run_test(protocol_xiselectevents_test);
-    run_test(protocol_xigetselectedevents_test);
-    run_test(protocol_xisetclientpointer_test);
-    run_test(protocol_xigetclientpointer_test);
-    run_test(protocol_xipassivegrabdevice_test);
-    run_test(protocol_xiquerypointer_test);
-    run_test(protocol_xiwarppointer_test);
-    run_test(protocol_eventconvert_test);
-    run_test(xi2_test);
-
-    return 0;
-}
-- 
2.9.2



More information about the xorg-devel mailing list