xserver: Branch 'master' - 6 commits

Adam Jackson ajax at kemper.freedesktop.org
Thu Jan 12 20:29:11 UTC 2017


 configure.ac                             |    2 
 test/.gitignore                          |   12 --
 test/Makefile.am                         |  167 +++++++++++++++++++++----------
 test/fixes.c                             |    4 
 test/hashtabletest.c                     |    4 
 test/input.c                             |    4 
 test/list.c                              |    4 
 test/misc.c                              |    4 
 test/signal-logging.c                    |    4 
 test/string.c                            |    3 
 test/test_xkb.c                          |    4 
 test/tests-common.c                      |   33 ++++++
 test/tests-common.h                      |   10 +
 test/tests.c                             |   41 +++++++
 test/tests.h                             |   38 +++++++
 test/touch.c                             |    6 -
 test/xfree86.c                           |    4 
 test/xi1/.gitignore                      |    1 
 test/xi1/Makefile.am                     |   34 ------
 test/xi1/protocol-xchangedevicecontrol.c |    3 
 test/xi2/.gitignore                      |   11 --
 test/xi2/Makefile.am                     |   70 ------------
 test/xi2/protocol-common.c               |   41 +++++++
 test/xi2/protocol-common.h               |    2 
 test/xi2/protocol-eventconvert.c         |    4 
 test/xi2/protocol-xigetclientpointer.c   |   19 ---
 test/xi2/protocol-xigetselectedevents.c  |   24 ----
 test/xi2/protocol-xipassivegrabdevice.c  |   25 +---
 test/xi2/protocol-xiquerydevice.c        |    4 
 test/xi2/protocol-xiquerypointer.c       |   23 ----
 test/xi2/protocol-xiqueryversion.c       |    4 
 test/xi2/protocol-xiselectevents.c       |   31 +----
 test/xi2/protocol-xisetclientpointer.c   |   19 ---
 test/xi2/protocol-xiwarppointer.c        |   22 ----
 test/xi2/xi2.c                           |    6 -
 test/xtest.c                             |    4 
 36 files changed, 361 insertions(+), 330 deletions(-)

New commits:
commit 704a867f8fb7652a8b7d5569bbe44e188457db4e
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:12 2017 +0500

    tests: Remove obsolete libxservertest.la
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/test/Makefile.am b/test/Makefile.am
index f91955b..729402f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -14,7 +14,6 @@ RES_SRCS = hashtabletest.c
 AM_CPPFLAGS += -DRES_TESTS
 endif
 endif
-check_LTLIBRARIES = libxservertest.la
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -65,11 +64,7 @@ tests_LDFLAGS = \
 	-Wl,-wrap,GrabButton \
 	$()
 
-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_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_SOURCES = \
         tests-common.c \
@@ -127,14 +122,16 @@ xi2-tests:
 
 endif !HAVE_LD_WRAP
 
-libxservertest_la_LIBADD = $(XSERVER_LIBS)
+tests_LDADD += $(XSERVER_LIBS)
+
 if XORG
 
-nodist_libxservertest_la_SOURCES = sdksyms.c
-libxservertest_la_LIBADD += \
+nodist_tests_SOURCES = sdksyms.c
+
+tests_LDADD += \
             $(top_builddir)/hw/xfree86/loader/libloader.la \
-            $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
             $(top_builddir)/hw/xfree86/common/libcommon.la \
+            $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
             $(top_builddir)/hw/xfree86/parser/libxf86config.la \
             $(top_builddir)/hw/xfree86/dixmods/libdixmods.la \
             $(top_builddir)/hw/xfree86/modes/libxf86modes.la \
@@ -152,19 +149,24 @@ sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
 	$(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
 
 if DRI
-libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la
+tests_LDADD += $(top_builddir)/hw/xfree86/dri/libdri.la
 endif
 
 if DRI2
-libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
+tests_LDADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
 endif
 
-else
-nodist_libxservertest_la_SOURCES = \
+if DRI3
+tests_LDADD += $(top_builddir)/dri3/libdri3.la
+endif
+
+else !XORG
+
+nodist_tests_SOURCES = \
             ddxstubs.c \
             $(top_srcdir)/mi/miinitext.c
 
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/damageext/libdamageext.la \
             $(top_builddir)/fb/libfb.la \
             $(top_builddir)/fb/libwfb.la \
@@ -182,44 +184,45 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/xkb/libxkbstubs.la
 
 if COMPOSITE
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/composite/libcomposite.la
 endif
 
 if DBE
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/dbe/libdbe.la
 endif
 
 if GLX
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/glx/libglx.la
 endif
 
 if RECORD
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/record/librecord.la
 endif
 
 if DRI3
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/dri3/libdri3.la
 endif
 
 if XQUARTZ
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/miext/rootless/librootless.la
 tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
-libxservertest_la_LIBADD += \
+tests_LDADD += \
             $(top_builddir)/miext/rootless/librootless.la
 endif
-endif
 
-libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
-endif
+endif !XORG
+
+tests_DEPENDENCIES = $(tests_LDADD)
+endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
 	scripts/xvfb-piglit.sh \
commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:11 2017 +0500

    tests: Move test/{xi1,xi2}/tests to test/
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/configure.ac b/configure.ac
index 93c81a6..d265528 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 d51d862..f91955b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -3,10 +3,12 @@ SUBDIRS= .
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = $(XORG_INCS)
 
+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
 AM_CPPFLAGS += -DRES_TESTS
@@ -41,12 +43,28 @@ TESTS_ENVIRONMENT = \
 	$(NULL)
 
 if XORG
-AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+AM_CPPFLAGS += \
+	-I$(srcdir)/xi1 \
+	-I$(srcdir)/xi2 \
+	-I$(top_srcdir)/hw/xfree86/common \
+	-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
+tests_CPPFLAGS += $(AM_CPPFLAGS)
 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
@@ -68,6 +86,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
 
@@ -87,7 +146,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 cf72aca..add51bd 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 2b29f27..0000000
--- 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 7a054dd..0000000
--- 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 df4638d..0000000
--- 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 2b29f27..0000000
--- 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 a7f9831..0000000
--- 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 559fb23..0000000
--- 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;
-}
commit ead5064581665ff40c177dd1b447949f1420e209
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:10 2017 +0500

    tests: Convert test/ to single binary
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c..5fd66e3 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,16 +1,6 @@
-fixes
-hashtabletest
-input
-list
-misc
+tests
 os
 sdksyms.c
-string
-touch
-xfree86
-xkb
-xtest
-signal-logging
 piglit-results
 simple-xinit
 *.log
diff --git a/test/Makefile.am b/test/Makefile.am
index bbf6691..d51d862 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,20 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CPPFLAGS = $(XORG_INCS)
+
 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
-TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
 if RES
-TEST_PROGS += hashtabletest
+RES_SRCS = hashtabletest.c
+AM_CPPFLAGS += -DRES_TESTS
 endif
 endif
 check_LTLIBRARIES = libxservertest.la
 
-noinst_PROGRAMS = \
-	simple-xinit \
-	$(TEST_PROGS) \
-	$(NULL)
+noinst_PROGRAMS = simple-xinit tests
 
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
@@ -31,8 +30,7 @@ SCRIPT_TESTS = \
 	$(XEPHYR_GLAMOR_TESTS) \
 	$(NULL)
 
-TESTS = \
-	$(TEST_PROGS) \
+TESTS = tests \
 	$(SCRIPT_TESTS) \
 	$(NULL)
 
@@ -42,8 +40,6 @@ TESTS_ENVIRONMENT = \
 	$(XORG_MALLOC_DEBUG_ENV) \
 	$(NULL)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS)
 if XORG
 AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/ddc \
@@ -51,23 +47,26 @@ AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
 	-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
+tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-xkb_SOURCES = test_xkb.c
-
-xkb_LDADD=$(TEST_LDADD)
-input_LDADD=$(TEST_LDADD)
-xtest_LDADD=$(TEST_LDADD)
-misc_LDADD=$(TEST_LDADD)
-fixes_LDADD=$(TEST_LDADD)
-xfree86_LDADD=$(TEST_LDADD)
-touch_LDADD=$(TEST_LDADD)
-signal_logging_LDADD=$(TEST_LDADD)
-hashtabletest_LDADD=$(TEST_LDADD)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+tests_SOURCES = \
+        tests-common.c \
+        fixes.c \
+        input.c \
+        list.c \
+        misc.c \
+        signal-logging.c \
+        string.c \
+        touch.c \
+        xfree86.c \
+        test_xkb.c \
+        xtest.c \
+        $(RES_SRCS) \
+        tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -151,7 +150,7 @@ endif
 if XQUARTZ
 libxservertest_la_LIBADD += \
             $(top_builddir)/miext/rootless/librootless.la
-TEST_LDADD += -lXplugin
+tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
diff --git a/test/fixes.c b/test/fixes.c
index 4ac6750..573d948 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include <xfixesint.h>
 #include <X11/extensions/xfixeswire.h>
 
+#include "tests-common.h"
+
 static void
 _fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
 {
@@ -343,7 +345,7 @@ fixes_pointer_barrier_clamp_test(void)
 }
 
 int
-main(int argc, char **argv)
+fixes_test(void)
 {
 
     fixes_pointer_barriers_test();
diff --git a/test/hashtabletest.c b/test/hashtabletest.c
index 86a0c58..0387587 100644
--- a/test/hashtabletest.c
+++ b/test/hashtabletest.c
@@ -8,6 +8,8 @@
 #include "hashtable.h"
 #include "resource.h"
 
+#include "tests-common.h"
+
 static void
 print_xid(void* ptr, void* v)
 {
@@ -154,7 +156,7 @@ test3(void)
 }
 
 int
-main(void)
+hashtabletest_test(void)
 {
     int ok = test1();
     ok = ok && test2();
diff --git a/test/input.c b/test/input.c
index 91ee43c..4cd39bb 100644
--- a/test/input.c
+++ b/test/input.c
@@ -43,6 +43,8 @@
 #include "mi.h"
 #include "assert.h"
 
+#include "tests-common.h"
+
 /**
  * Init a device with axes.
  * Verify values set on the device.
@@ -1904,7 +1906,7 @@ dix_enqueue_events(void)
 }
 
 int
-main(int argc, char **argv)
+input_test(void)
 {
     dix_enqueue_events();
     dix_double_fp_conversion();
diff --git a/test/list.c b/test/list.c
index 28d9609..d710f46 100644
--- a/test/list.c
+++ b/test/list.c
@@ -31,6 +31,8 @@
 #include <assert.h>
 #include <stdlib.h>
 
+#include "tests-common.h"
+
 struct parent {
     int a;
     struct xorg_list children;
@@ -369,7 +371,7 @@ test_nt_list_delete(void)
 }
 
 int
-main(int argc, char **argv)
+list_test(void)
 {
     test_xorg_list_init();
     test_xorg_list_add();
diff --git a/test/misc.c b/test/misc.c
index 66330a1..ae46ccc 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -31,6 +31,8 @@
 #include "dix.h"
 #include "dixstruct.h"
 
+#include "tests-common.h"
+
 ScreenInfo screenInfo;
 
 static void
@@ -192,7 +194,7 @@ dix_request_size_checks(void)
 
 
 int
-main(int argc, char **argv)
+misc_test(void)
 {
     dix_version_compare();
     dix_update_desktop_dimensions();
diff --git a/test/signal-logging.c b/test/signal-logging.c
index 3d2d048..b00ee58 100644
--- a/test/signal-logging.c
+++ b/test/signal-logging.c
@@ -30,6 +30,8 @@
 #include "assert.h"
 #include "misc.h"
 
+#include "tests-common.h"
+
 struct number_format_test {
     uint64_t number;
     char string[21];
@@ -395,7 +397,7 @@ static void logging_format(void)
 #pragma GCC diagnostic pop /* "-Wformat-security" */
 
 int
-main(int argc, char **argv)
+signal_logging_test(void)
 {
     number_formatting();
     logging_format();
diff --git a/test/string.c b/test/string.c
index 93867e0..406b7bf 100644
--- a/test/string.c
+++ b/test/string.c
@@ -32,6 +32,7 @@
 
 #include <assert.h>
 #include "os.h"
+#include "tests-common.h"
 
 /* Ensure we're testing our functions, even on platforms with libc versions */
 #include <string.h>
@@ -62,7 +63,7 @@ strndup_checks(void)
 }
 
 int
-main(int argc, char **argv)
+string_test(void)
 {
     strndup_checks();
 
diff --git a/test/test_xkb.c b/test/test_xkb.c
index 9047f59..23d5b22 100644
--- a/test/test_xkb.c
+++ b/test/test_xkb.c
@@ -48,6 +48,8 @@
 #include "../xkb/xkb.h"
 #include <assert.h>
 
+#include "tests-common.h"
+
 /**
  * Initialize an empty XkbRMLVOSet.
  * Call XkbGetRulesDflts to obtain the default ruleset.
@@ -164,7 +166,7 @@ xkb_set_get_rules_test(void)
 }
 
 int
-main(int argc, char **argv)
+xkb_test(void)
 {
     xkb_set_get_rules_test();
     xkb_get_rules_test();
diff --git a/test/tests-common.h b/test/tests-common.h
index f0197ad..d5286ca 100644
--- a/test/tests-common.h
+++ b/test/tests-common.h
@@ -1,6 +1,8 @@
 #ifndef TESTS_COMMON_H
 #define TESTS_COMMON_H
 
+#include "tests.h"
+
 #define run_test(func) run_test_in_child(func, #func)
 
 void run_test_in_child(int (*func)(void), const char *funcname);
diff --git a/test/tests.c b/test/tests.c
new file mode 100644
index 0000000..cf72aca
--- /dev/null
+++ b/test/tests.c
@@ -0,0 +1,25 @@
+#include <string.h>
+#include "tests.h"
+#include "tests-common.h"
+
+int
+main(int argc, char **argv)
+{
+    run_test(fixes_test);
+
+#ifdef RES_TESTS
+    run_test(hashtabletest_test);
+#endif
+
+    run_test(input_test);
+    run_test(list_test);
+    run_test(misc_test);
+    run_test(signal_logging_test);
+    run_test(string_test);
+    run_test(touch_test);
+    run_test(xfree86_test);
+    run_test(xkb_test);
+    run_test(xtest_test);
+
+    return 0;
+}
diff --git a/test/tests.h b/test/tests.h
index 0b673ee..b96ca78 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -1,6 +1,18 @@
 #ifndef TESTS_H
 #define TESTS_H
 
+int fixes_test(void);
+int hashtabletest_test(void);
+int input_test(void);
+int list_test(void);
+int misc_test(void);
+int signal_logging_test(void);
+int string_test(void);
+int touch_test(void);
+int xfree86_test(void);
+int xkb_test(void);
+int xtest_test(void);
+
 int protocol_xchangedevicecontrol_test(void);
 
 int protocol_xiqueryversion_test(void);
diff --git a/test/touch.c b/test/touch.c
index 19c6878..16aaf4b 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -30,6 +30,8 @@
 #include "assert.h"
 #include "scrnintstr.h"
 
+#include "tests-common.h"
+
 static void
 touch_grow_queue(void)
 {
@@ -278,13 +280,15 @@ touch_init(void)
 }
 
 int
-main(int argc, char **argv)
+touch_test(void)
 {
+    printf("touch_test: start...\n");
     touch_grow_queue();
     touch_find_ddxid();
     touch_begin_ddxtouch();
     touch_init();
     touch_begin_touch();
 
+    printf("touch_test: exiting successfully\n");
     return 0;
 }
diff --git a/test/xfree86.c b/test/xfree86.c
index a986711..ff8ad2d 100644
--- a/test/xfree86.c
+++ b/test/xfree86.c
@@ -30,6 +30,8 @@
 #include "xf86.h"
 #include "xf86Parser.h"
 
+#include "tests-common.h"
+
 static void
 xfree86_option_list_duplicate(void)
 {
@@ -96,7 +98,7 @@ xfree86_add_comment(void)
 }
 
 int
-main(int argc, char **argv)
+xfree86_test(void)
 {
     xfree86_option_list_duplicate();
     xfree86_add_comment();
diff --git a/test/xtest.c b/test/xtest.c
index e9fabfb..05d7ec1 100644
--- a/test/xtest.c
+++ b/test/xtest.c
@@ -35,6 +35,8 @@
 #include "xserver-properties.h"
 #include "syncsrv.h"
 
+#include "tests-common.h"
+
 /**
  */
 
@@ -123,7 +125,7 @@ xtest_properties(void)
 }
 
 int
-main(int argc, char **argv)
+xtest_test(void)
 {
     xtest_init_devices();
     xtest_properties();
commit 773fc07e4c2f816966809492a924a9bd1a15d059
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:09 2017 +0500

    tests: Convert test/xi2/ to single binary
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/test/tests.h b/test/tests.h
index 7fa5ac2..0b673ee 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -3,4 +3,24 @@
 
 int protocol_xchangedevicecontrol_test(void);
 
+int protocol_xiqueryversion_test(void);
+int protocol_xiquerydevice_test(void);
+int protocol_xiselectevents_test(void);
+int protocol_xigetselectedevents_test(void);
+int protocol_xisetclientpointer_test(void);
+int protocol_xigetclientpointer_test(void);
+int protocol_xipassivegrabdevice_test(void);
+int protocol_xiquerypointer_test(void);
+int protocol_xiwarppointer_test(void);
+int protocol_eventconvert_test(void);
+int xi2_test(void);
+
+#ifndef INSIDE_PROTOCOL_COMMON
+
+extern int enable_XISetEventMask_wrap;
+extern int enable_GrabButton_wrap;
+
+#endif /* INSIDE_PROTOCOL_COMMON */
+
 #endif /* TESTS_H */
+
diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
index 817aa7b..2b29f27 100644
--- a/test/xi2/.gitignore
+++ b/test/xi2/.gitignore
@@ -1,11 +1 @@
-protocol-eventconvert
-protocol-xigetclientpointer
-protocol-xigetselectedevents
-protocol-xipassivegrabdevice
-protocol-xiquerydevice
-protocol-xiquerypointer
-protocol-xiqueryversion
-protocol-xiselectevents
-protocol-xisetclientpointer
-protocol-xiwarppointer
-xi2
+tests
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 49aaebb..a7f9831 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,67 +1,48 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
-	protocol-xiqueryversion \
-	protocol-xiquerydevice \
-	protocol-xiselectevents \
-	protocol-xigetselectedevents \
-        protocol-xisetclientpointer \
-        protocol-xigetclientpointer \
-        protocol-xipassivegrabdevice \
-        protocol-xiquerypointer \
-        protocol-xiwarppointer \
-        protocol-eventconvert \
-        xi2
+noinst_PROGRAMS = tests
+
+TESTS = tests
 
-TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = \
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+
+tests_CPPFLAGS = \
 	@XORG_INCS@ \
 	-I$(srcdir)/..
 
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-COMMON_SOURCES=protocol-common.h protocol-common.c
-COMMON_LD_FLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+tests_LDADD = ../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
 endif
 
-protocol_xiqueryversion_LDADD=$(TEST_LDADD)
-protocol_xiquerydevice_LDADD=$(TEST_LDADD)
-protocol_xiselectevents_LDADD=$(TEST_LDADD)
-protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
-protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
-protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
-protocol_xiquerypointer_LDADD=$(TEST_LDADD)
-protocol_xipassivegrabdevice_LDADD=$(TEST_LDADD)
-protocol_xiwarppointer_LDADD=$(TEST_LDADD)
-protocol_eventconvert_LDADD=$(TEST_LDADD)
-xi2_LDADD=$(TEST_LDADD)
-
-protocol_xiqueryversion_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,GrabButton
-protocol_xiquerypointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
-protocol_xiwarppointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
-xi2_LDFLAGS=$(COMMON_LD_FLAGS)
+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
 
-protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c
-protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c
-protocol_xiselectevents_SOURCES=$(COMMON_SOURCES) protocol-xiselectevents.c
-protocol_xigetselectedevents_SOURCES=$(COMMON_SOURCES) protocol-xigetselectedevents.c
-protocol_xisetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xisetclientpointer.c
-protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointer.c
-protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c
-protocol_xipassivegrabdevice_SOURCES=$(COMMON_SOURCES) protocol-xipassivegrabdevice.c
-protocol_xiwarppointer_SOURCES=$(COMMON_SOURCES) protocol-xiwarppointer.c
-xi2_SOURCES=$(COMMON_SOURCES) xi2.c
 else
 # Print that xi2-tests were skipped (exit code 77 for automake test harness)
 TESTS = xi2-tests
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index d30593a..b91692f 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -34,6 +34,7 @@
 #include "syncsrv.h"
 #include <X11/extensions/XI2.h>
 
+#define INSIDE_PROTOCOL_COMMON
 #include "protocol-common.h"
 
 struct devices devices;
@@ -44,6 +45,9 @@ static ClientRec server_client;
 
 void *global_userdata;
 
+int enable_GrabButton_wrap = 1;
+int enable_XISetEventMask_wrap = 1;
+
 static void
 fake_init_sprite(DeviceIntPtr dev)
 {
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index ff30bdc..8d19d53 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -1202,7 +1202,7 @@ test_convert_XIBarrierEvent(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_eventconvert_test(void)
 {
     test_convert_XIRawEvent();
     test_convert_XIFocusEvent();
diff --git a/test/xi2/protocol-xigetclientpointer.c b/test/xi2/protocol-xigetclientpointer.c
index 394f9f7..f0c27b9 100644
--- a/test/xi2/protocol-xigetclientpointer.c
+++ b/test/xi2/protocol-xigetclientpointer.c
@@ -142,7 +142,7 @@ test_XIGetClientPointer(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xigetclientpointer_test(void)
 {
     init_simple();
     client_window = init_client(0, NULL);
diff --git a/test/xi2/protocol-xigetselectedevents.c b/test/xi2/protocol-xigetselectedevents.c
index c4fae39..3a7f364 100644
--- a/test/xi2/protocol-xigetselectedevents.c
+++ b/test/xi2/protocol-xigetselectedevents.c
@@ -206,9 +206,11 @@ test_XIGetSelectedEvents(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xigetselectedevents_test(void)
 {
     init_simple();
+    enable_GrabButton_wrap = 0;
+    enable_XISetEventMask_wrap = 0;
 
     test_XIGetSelectedEvents();
 
diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c
index 29ef432..db7e6ab 100644
--- a/test/xi2/protocol-xipassivegrabdevice.c
+++ b/test/xi2/protocol-xipassivegrabdevice.c
@@ -55,6 +55,10 @@ int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
                       DeviceIntPtr modifier_device, int button,
                       GrabParameters *param, enum InputLevel grabtype,
                       GrabMask *mask);
+int __real_GrabButton(ClientPtr client, DeviceIntPtr dev,
+                      DeviceIntPtr modifier_device, int button,
+                      GrabParameters *param, enum InputLevel grabtype,
+                      GrabMask *mask);
 static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len,
                                            char *data, void *closure);
 
@@ -64,6 +68,9 @@ __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
                   GrabParameters *param, enum InputLevel grabtype,
                   GrabMask *mask)
 {
+    if (!enable_GrabButton_wrap)
+        __real_GrabButton(client, dev, modifier_device, button, param, grabtype, mask);
+
     /* Fail every odd modifier */
     if (param->modifiers % 2)
         return BadAccess;
@@ -238,7 +245,7 @@ test_XIPassiveGrabDevice(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xipassivegrabdevice_test(void)
 {
     init_simple();
 
diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c
index a07da04..a068038 100644
--- a/test/xi2/protocol-xiquerydevice.c
+++ b/test/xi2/protocol-xiquerydevice.c
@@ -335,7 +335,7 @@ test_XIQueryDevice(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xiquerydevice_test(void)
 {
     init_simple();
 
diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c
index 9d3f945..ed75d79 100644
--- a/test/xi2/protocol-xiquerypointer.c
+++ b/test/xi2/protocol-xiquerypointer.c
@@ -190,7 +190,7 @@ test_XIQueryPointer(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xiquerypointer_test(void)
 {
     init_simple();
 
diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c
index efee156..3ce758f 100644
--- a/test/xi2/protocol-xiqueryversion.c
+++ b/test/xi2/protocol-xiqueryversion.c
@@ -288,7 +288,7 @@ test_XIQueryVersion_multiple(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xiqueryversion_test(void)
 {
     init_simple();
 
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index 575a066..686e7d3 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -65,9 +65,16 @@ static unsigned char *data[4096 * 20];  /* the request data buffer */
 ClientRec client_window;
 
 int
+__real_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
+                      unsigned char *mask);
+
+int
 __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
                       unsigned char *mask)
 {
+    if (!enable_XISetEventMask_wrap)
+        return __real_XISetEventMask(dev, win, len, mask);
+
     return Success;
 }
 
@@ -324,7 +331,7 @@ test_XISelectEvents(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xiselectevents_test(void)
 {
     init_simple();
 
diff --git a/test/xi2/protocol-xisetclientpointer.c b/test/xi2/protocol-xisetclientpointer.c
index bd6267d..6584bb9 100644
--- a/test/xi2/protocol-xisetclientpointer.c
+++ b/test/xi2/protocol-xisetclientpointer.c
@@ -122,7 +122,7 @@ test_XISetClientPointer(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xisetclientpointer_test(void)
 {
     init_simple();
     client_window = init_client(0, NULL);
diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c
index 8483aac..8484d54e 100644
--- a/test/xi2/protocol-xiwarppointer.c
+++ b/test/xi2/protocol-xiwarppointer.c
@@ -186,7 +186,7 @@ test_XIWarpPointer(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xiwarppointer_test(void)
 {
     init_simple();
     screen.SetCursorPosition = ScreenSetCursorPosition;
diff --git a/test/xi2/tests.c b/test/xi2/tests.c
new file mode 100644
index 0000000..559fb23
--- /dev/null
+++ b/test/xi2/tests.c
@@ -0,0 +1,21 @@
+#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;
+}
diff --git a/test/xi2/xi2.c b/test/xi2/xi2.c
index 070d641..6ed4c7f 100644
--- a/test/xi2/xi2.c
+++ b/test/xi2/xi2.c
@@ -137,7 +137,7 @@ xi2mask_test(void)
 }
 
 int
-main(int argc, char **argv)
+xi2_test(void)
 {
     xi2mask_test();
 
commit 371576f64baa99c4ab1e736fbae7975a32577275
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:08 2017 +0500

    tests: Convert test/xi1/ to single binary
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/test/tests-common.c b/test/tests-common.c
new file mode 100644
index 0000000..6868528
--- /dev/null
+++ b/test/tests-common.c
@@ -0,0 +1,33 @@
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "tests-common.h"
+
+void
+run_test_in_child(int (*func)(void), const char *funcname)
+{
+    int cpid;
+    int csts;
+    int exit_code = -1;
+
+    printf("\n---------------------\n%s...\n", funcname);
+    cpid = fork();
+    if (cpid) {
+        waitpid(cpid, &csts, 0);
+        if (!WIFEXITED(csts))
+            goto child_failed;
+        exit_code = WEXITSTATUS(csts);
+        if (exit_code == 0)
+            printf(" Pass\n");
+        else {
+child_failed:
+            printf(" FAIL\n");
+            exit(exit_code);
+        }
+    } else {
+        exit(func());
+    }
+}
diff --git a/test/tests-common.h b/test/tests-common.h
new file mode 100644
index 0000000..f0197ad
--- /dev/null
+++ b/test/tests-common.h
@@ -0,0 +1,8 @@
+#ifndef TESTS_COMMON_H
+#define TESTS_COMMON_H
+
+#define run_test(func) run_test_in_child(func, #func)
+
+void run_test_in_child(int (*func)(void), const char *funcname);
+
+#endif /* TESTS_COMMON_H */
diff --git a/test/tests.h b/test/tests.h
new file mode 100644
index 0000000..7fa5ac2
--- /dev/null
+++ b/test/tests.h
@@ -0,0 +1,6 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+int protocol_xchangedevicecontrol_test(void);
+
+#endif /* TESTS_H */
diff --git a/test/xi1/.gitignore b/test/xi1/.gitignore
index c1b9024..2b29f27 100644
--- a/test/xi1/.gitignore
+++ b/test/xi1/.gitignore
@@ -1 +1 @@
-protocol-xchangedevicecontrol
+tests
diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index b7060e7..7a054dd 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -1,26 +1,35 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
-	protocol-xchangedevicecontrol
+noinst_PROGRAMS = tests
+
+TESTS = tests
 
-TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
-COMMON_LD_FLAGS = -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+tests_CPPFLAGS = \
+	@XORG_INCS@ \
+	-I$(srcdir)/.. \
+	-I$(srcdir)/../xi2 \
+	$()
 
-if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
+tests_LDFLAGS = \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,dixLookupClient \
+	-Wl,-wrap,WriteToClient \
+	$()
 
-protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
+tests_LDADD =../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
-protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
+tests_SOURCES = \
+	$(srcdir)/../tests-common.c \
+	$(srcdir)/../xi2/protocol-common.c \
+	protocol-xchangedevicecontrol.c \
+	tests.c
 
-protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) protocol-xchangedevicecontrol.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)
diff --git a/test/xi1/protocol-xchangedevicecontrol.c b/test/xi1/protocol-xchangedevicecontrol.c
index 64d2ca2..57a15c4 100644
--- a/test/xi1/protocol-xchangedevicecontrol.c
+++ b/test/xi1/protocol-xchangedevicecontrol.c
@@ -113,7 +113,7 @@ test_ChangeDeviceControl(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xchangedevicecontrol_test(void)
 {
     init_simple();
 
diff --git a/test/xi1/tests.c b/test/xi1/tests.c
new file mode 100644
index 0000000..df4638d
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,11 @@
+#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/Makefile.am b/test/xi2/Makefile.am
index 9231e92..49aaebb 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -17,7 +17,10 @@ TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = @XORG_INCS@
+AM_CPPFLAGS = \
+	@XORG_INCS@ \
+	-I$(srcdir)/..
+
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 COMMON_LD_FLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
diff --git a/test/xi2/protocol-common.h b/test/xi2/protocol-common.h
index f850478..7190ef0 100644
--- a/test/xi2/protocol-common.h
+++ b/test/xi2/protocol-common.h
@@ -30,6 +30,8 @@
 #include "exevents.h"
 #include <assert.h>
 
+#include "tests.h"
+
 #ifndef PROTOCOL_COMMON_H
 #define PROTOCOL_COMMON_H
 
commit ff66bca3e8797db709e03572d296358dc4b95653
Author: Mihail Konev <k.mvc at ya.ru>
Date:   Thu Jan 12 13:21:07 2017 +0500

    tests: Refactor wraps into protocol-common.c
    
    Part of refactoring the tests into a single binary,
    to make partial rebuild slightly faster and less verbose.
    
    Prepares for joining test/xi2/protocol-* into a single binary.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Mihail Konev <k.mvc at ya.ru>

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7a..b7060e7 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -10,6 +10,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
+COMMON_LD_FLAGS = -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -17,7 +18,7 @@ endif
 
 protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
 
-protocol_xchangedevicecontrol_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
 
 protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) protocol-xchangedevicecontrol.c
 
diff --git a/test/xi1/protocol-xchangedevicecontrol.c b/test/xi1/protocol-xchangedevicecontrol.c
index 8e638b2..64d2ca2 100644
--- a/test/xi1/protocol-xchangedevicecontrol.c
+++ b/test/xi1/protocol-xchangedevicecontrol.c
@@ -37,6 +37,7 @@
 
 #include "protocol-common.h"
 
+ClientRec client_window;
 static ClientRec client_request;
 
 static void
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index bfddfef..9231e92 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -20,6 +20,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
+COMMON_LD_FLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -37,16 +38,16 @@ protocol_xiwarppointer_LDADD=$(TEST_LDADD)
 protocol_eventconvert_LDADD=$(TEST_LDADD)
 xi2_LDADD=$(TEST_LDADD)
 
-protocol_xiqueryversion_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,GrabButton -Wl,-wrap,dixLookupWindow -Wl,-wrap,WriteToClient
-protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow
-protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow
-xi2_LDFLAGS=$(AM_LDFLAGS)
+protocol_xiqueryversion_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LD_FLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LD_FLAGS)
 
 protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c
 protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c
@@ -57,6 +58,7 @@ protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) protocol-xigetclientpointe
 protocol_xiquerypointer_SOURCES=$(COMMON_SOURCES) protocol-xiquerypointer.c
 protocol_xipassivegrabdevice_SOURCES=$(COMMON_SOURCES) protocol-xipassivegrabdevice.c
 protocol_xiwarppointer_SOURCES=$(COMMON_SOURCES) protocol-xiwarppointer.c
+xi2_SOURCES=$(COMMON_SOURCES) xi2.c
 else
 # Print that xi2-tests were skipped (exit code 77 for automake test harness)
 TESTS = xi2-tests
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 9265ba3..d30593a 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -284,3 +284,40 @@ __wrap_WriteToClient(ClientPtr client, int len, void *data)
 
     (*reply_handler) (client, len, data, global_userdata);
 }
+
+/* dixLookupWindow requires a lot of setup not necessary for this test.
+ * Simple wrapper that returns either one of the fake root window or the
+ * fake client window. If the requested ID is neither of those wanted,
+ * return whatever the real dixLookupWindow does.
+ */
+int
+__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
+{
+    if (id == root.drawable.id) {
+        *win = &root;
+        return Success;
+    }
+    else if (id == window.drawable.id) {
+        *win = &window;
+        return Success;
+    }
+
+    return __real_dixLookupWindow(win, id, client, access);
+}
+
+extern ClientRec client_window;
+
+int
+__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client,
+                       Mask access)
+{
+    if (rid == ROOT_WINDOW_ID)
+        return BadWindow;
+
+    if (rid == CLIENT_WINDOW_ID) {
+        *pClient = &client_window;
+        return Success;
+    }
+
+    return __real_dixLookupClient(pClient, rid, client, access);
+}
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index aea380e..ff30bdc 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -33,6 +33,8 @@
 #include "inpututils.h"
 #include <X11/extensions/XI2proto.h>
 
+#include "protocol-common.h"
+
 static void
 test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent * out, BOOL swap)
 {
diff --git a/test/xi2/protocol-xigetclientpointer.c b/test/xi2/protocol-xigetclientpointer.c
index 570c53e..394f9f7 100644
--- a/test/xi2/protocol-xigetclientpointer.c
+++ b/test/xi2/protocol-xigetclientpointer.c
@@ -46,24 +46,9 @@ struct {
     int win;
 } test_data;
 
-static ClientRec client_window;
+ClientRec client_window;
 static ClientRec client_request;
 
-int
-__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client,
-                       Mask access)
-{
-    if (rid == ROOT_WINDOW_ID)
-        return BadWindow;
-
-    if (rid == CLIENT_WINDOW_ID) {
-        *pClient = &client_window;
-        return Success;
-    }
-
-    return __real_dixLookupClient(pClient, rid, client, access);
-}
-
 static void
 reply_XIGetClientPointer(ClientPtr client, int len, char *data, void *userdata)
 {
diff --git a/test/xi2/protocol-xigetselectedevents.c b/test/xi2/protocol-xigetselectedevents.c
index bedc217..c4fae39 100644
--- a/test/xi2/protocol-xigetselectedevents.c
+++ b/test/xi2/protocol-xigetselectedevents.c
@@ -60,25 +60,7 @@ struct {
     int mask_len;
 } test_data;
 
-/* dixLookupWindow requires a lot of setup not necessary for this test.
- * Simple wrapper that returns either one of the fake root window or the
- * fake client window. If the requested ID is neither of those wanted,
- * return whatever the real dixLookupWindow does.
- */
-int
-__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
-{
-    if (id == root.drawable.id) {
-        *win = &root;
-        return Success;
-    }
-    else if (id == window.drawable.id) {
-        *win = &window;
-        return Success;
-    }
-
-    return __real_dixLookupWindow(win, id, client, access);
-}
+ClientRec client_window;
 
 /* AddResource is called from XISetSEventMask, we don't need this */
 Bool
diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c
index 95d8ebf..29ef432 100644
--- a/test/xi2/protocol-xipassivegrabdevice.c
+++ b/test/xi2/protocol-xipassivegrabdevice.c
@@ -41,6 +41,7 @@
 
 #include "protocol-common.h"
 
+ClientRec client_window;
 static ClientRec client_request;
 
 #define N_MODS 7
@@ -58,21 +59,6 @@ static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len,
                                            char *data, void *closure);
 
 int
-__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
-{
-    if (id == root.drawable.id) {
-        *win = &root;
-        return Success;
-    }
-    else if (id == window.drawable.id) {
-        *win = &window;
-        return Success;
-    }
-
-    return __real_dixLookupWindow(win, id, client, access);
-}
-
-int
 __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev,
                   DeviceIntPtr modifier_device, int button,
                   GrabParameters *param, enum InputLevel grabtype,
diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c
index deef1f1..a07da04 100644
--- a/test/xi2/protocol-xiquerydevice.c
+++ b/test/xi2/protocol-xiquerydevice.c
@@ -54,6 +54,8 @@ struct test_data {
     int num_devices_in_reply;
 };
 
+ClientRec client_window;
+
 static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data,
                                      void *closure);
 static void reply_XIQueryDevice(ClientPtr client, int len, char *data,
diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c
index 2bf18fa..9d3f945 100644
--- a/test/xi2/protocol-xiquerypointer.c
+++ b/test/xi2/protocol-xiquerypointer.c
@@ -41,6 +41,7 @@
 
 #include "protocol-common.h"
 
+ClientRec client_window;
 static ClientRec client_request;
 static void reply_XIQueryPointer_data(ClientPtr client, int len,
                                       char *data, void *closure);
@@ -50,26 +51,6 @@ static struct {
     WindowPtr win;
 } test_data;
 
-/* dixLookupWindow requires a lot of setup not necessary for this test.
- * Simple wrapper that returns either one of the fake root window or the
- * fake client window. If the requested ID is neither of those wanted,
- * return whatever the real dixLookupWindow does.
- */
-int
-__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
-{
-    if (id == root.drawable.id) {
-        *win = &root;
-        return Success;
-    }
-    else if (id == window.drawable.id) {
-        *win = &window;
-        return Success;
-    }
-
-    return __real_dixLookupWindow(win, id, client, access);
-}
-
 static void
 reply_XIQueryPointer(ClientPtr client, int len, char *data, void *closure)
 {
diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c
index 3749b30..efee156 100644
--- a/test/xi2/protocol-xiqueryversion.c
+++ b/test/xi2/protocol-xiqueryversion.c
@@ -58,6 +58,8 @@ struct test_data {
     int minor_expected;
 };
 
+ClientRec client_window;
+
 static void
 reply_XIQueryVersion(ClientPtr client, int len, char *data, void *closure)
 {
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index 183746f..575a066 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -62,6 +62,8 @@
 
 static unsigned char *data[4096 * 20];  /* the request data buffer */
 
+ClientRec client_window;
+
 int
 __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
                       unsigned char *mask)
@@ -69,26 +71,6 @@ __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len,
     return Success;
 }
 
-/* dixLookupWindow requires a lot of setup not necessary for this test.
- * Simple wrapper that returns either one of the fake root window or the
- * fake client window. If the requested ID is neither of those wanted,
- * return whatever the real dixLookupWindow does.
- */
-int
-__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
-{
-    if (id == root.drawable.id) {
-        *win = &root;
-        return Success;
-    }
-    else if (id == window.drawable.id) {
-        *win = &window;
-        return Success;
-    }
-
-    return __real_dixLookupWindow(win, id, client, access);
-}
-
 static void
 request_XISelectEvent(xXISelectEventsReq * req, int error)
 {
diff --git a/test/xi2/protocol-xisetclientpointer.c b/test/xi2/protocol-xisetclientpointer.c
index 90f1b94..bd6267d 100644
--- a/test/xi2/protocol-xisetclientpointer.c
+++ b/test/xi2/protocol-xisetclientpointer.c
@@ -48,24 +48,9 @@
 
 #include "protocol-common.h"
 
-static ClientRec client_window;
+ClientRec client_window;
 static ClientRec client_request;
 
-int
-__wrap_dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client,
-                       Mask access)
-{
-    if (rid == ROOT_WINDOW_ID)
-        return BadWindow;
-
-    if (rid == CLIENT_WINDOW_ID) {
-        *pClient = &client_window;
-        return Success;
-    }
-
-    return __real_dixLookupClient(pClient, rid, client, access);
-}
-
 static void
 request_XISetClientPointer(xXISetClientPointerReq * req, int error)
 {
diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c
index 3aaaae6..8483aac 100644
--- a/test/xi2/protocol-xiwarppointer.c
+++ b/test/xi2/protocol-xiwarppointer.c
@@ -44,25 +44,7 @@
 static int expected_x = SPRITE_X;
 static int expected_y = SPRITE_Y;
 
-/* dixLookupWindow requires a lot of setup not necessary for this test.
- * Simple wrapper that returns either one of the fake root window or the
- * fake client window. If the requested ID is neither of those wanted,
- * return whatever the real dixLookupWindow does.
- */
-int
-__wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
-{
-    if (id == root.drawable.id) {
-        *win = &root;
-        return Success;
-    }
-    else if (id == window.drawable.id) {
-        *win = &window;
-        return Success;
-    }
-
-    return __real_dixLookupWindow(win, id, client, access);
-}
+ClientRec client_window;
 
 /**
  * This function overrides the one in the screen rec.
diff --git a/test/xi2/xi2.c b/test/xi2/xi2.c
index 1cdad1d..070d641 100644
--- a/test/xi2/xi2.c
+++ b/test/xi2/xi2.c
@@ -30,6 +30,10 @@
 #include "inputstr.h"
 #include "assert.h"
 
+#include "protocol-common.h"
+
+ClientRec client_window;
+
 static void
 xi2mask_test(void)
 {


More information about the xorg-commit mailing list