[PATCH xserver] tests: Build test programs only when testing

2016-12-10 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
In case it is the [exact] opposite of the effect intended
(test linking of test programs on every build),
should then this be conditioned as a ./configure option?

 test/Makefile.am | 2 +-
 test/xi1/Makefile.am | 2 +-
 test/xi2/Makefile.am | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 064e1c5b736f..58165aa69236 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -12,7 +12,7 @@ endif
 endif
 check_LTLIBRARIES = libxservertest.la
 
-noinst_PROGRAMS = \
+check_PROGRAMS = \
simple-xinit \
$(TEST_PROGS) \
$(NULL)
diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..d0312b63f9a7 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -1,6 +1,6 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
+check_PROGRAMS =  \
protocol-xchangedevicecontrol
 
 TESTS=$(noinst_PROGRAMS)
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index bfddfef133fd..fc5169fc4010 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,6 +1,6 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
+check_PROGRAMS =  \
protocol-xiqueryversion \
protocol-xiquerydevice \
protocol-xiselectevents \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] os,dix: Depend custom libs on libs, not objects

2016-12-28 Thread Mihail Konev
The custom os/os.O library reuses *.o files of os/libos.la.

The current rule assumes automake puts all the objects into
per-target am__*_la_OBJECTS variable.
At least with AC_REPLACE_FUNCS, this no longer holds
(as wanted objects are put into LTLIBOBJS instead).

Depend on automake's result, the *.la library instead,
to express demand of any its dependencies being built.

Should be fixing randomly occuring "undefined reference to `strlcpy'"
errors when linking Xvfb and other DDX-es that could use os.O.

Signed-off-by: Mihail Konev 
---
 dix/Makefile.am | 4 ++--
 os/Makefile.am  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dix/Makefile.am b/dix/Makefile.am
index e7ca2369cee5..a4171d7e1f12 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -61,13 +61,13 @@ endif
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libdix
-dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
+dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
$(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
 
 noinst_PROGRAMS = dix.O
 
 dix_O_SOURCES =
-dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
+dix.O: dtrace-dix.o libdix.la
$(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
 endif
 
diff --git a/os/Makefile.am b/os/Makefile.am
index b5fb9d0fa86b..c6e78cb99fd5 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -58,12 +58,12 @@ EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
-dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
+dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
.libs/*.o ../dix/.libs/*.o
 
 noinst_PROGRAMS = os.O
 
 os_O_SOURCES =
-os.O: dtrace.o $(am_libos_la_OBJECTS)
+os.O: dtrace.o libos.la
$(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
 endif
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 05/10] tests: Move test/xi1/Makefile.am to test/

2016-12-30 Thread Mihail Konev
This is to take advantage of 'make -j', as currently,
when rebuilding, make has to sequentially link ./xi1/tests,
then ./xi2/tests, then ./tests.

Signed-off-by: Mihail Konev 
---
 configure.ac  |  1 -
 test/Makefile.am  | 51 +--
 test/common.sh|  2 +-
 test/xi1/Makefile.am  | 43 --
 test/xi1/common.sh|  3 --
 test/xi1/protocol_xchangedevicecontrol.sh |  1 +
 6 files changed, 51 insertions(+), 50 deletions(-)
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi1/common.sh

diff --git a/configure.ac b/configure.ac
index 93c81a644052..765c39678277 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2679,7 +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 811f5928fb5a..02cff057e75f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,3 +1,5 @@
+CLEANFILES =
+
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
 check_LTLIBRARIES = libxservertest.la
@@ -8,7 +10,7 @@ tests_SOURCES = list.c string.c tests.c
 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
+SUBDIRS += xi2
 tests_SOURCES += xkb.c input.c xtest.c misc.c fixes.c xfree86.c 
signal-logging.c touch.c
 if RES
 tests_SOURCES += hashtabletest.c
@@ -45,6 +47,7 @@ TESTS_ENVIRONMENT = \
XSERVER_BUILDDIR=$(abs_top_builddir) \
$(XORG_MALLOC_DEBUG_ENV) \
srcdir=$(srcdir) \
+   test_subdir= \
$(NULL)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
@@ -81,7 +84,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
@@ -168,3 +171,47 @@ EXTRA_DIST = \
ddxstubs.c \
$(NULL)
 
+# --
+# -- xi1/Makefile.am
+
+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 \
+   $()
+
+xi1_tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+
+xi1_tests_SOURCES = \
+   xi2/protocol-common.c \
+   xi1/protocol-xchangedevicecontrol.c \
+   xi1/tests.c
+
+if SPECIAL_DTRACE_OBJECTS
+xi1_tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+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 $@
+
+endif !HAVE_LD_WRAP
+endif ENABLE_UNIT_TESTS
diff --git a/test/common.sh b/test/common.sh
index 892028d9a585..831f847f3a76 100644
--- a/test/common.sh
+++ b/test/common.sh
@@ -1,3 +1,3 @@
 testname=${0%.sh}
 testname=${testname##*/}
-exec ./tests "$testname"
+exec ./"$test_subdir"/tests "$testname"
diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
deleted file mode 100644
index a53b3f7b0230..
--- a/test/xi1/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-if ENABLE_UNIT_TESTS
-if HAVE_LD_WRAP
-noinst_PROGRAMS = tests
-
-TESTS = \
-   protocol_xchangedevicecontrol.sh \
-   $()
-
-TESTS_ENVIRONMENT = \
-   $(XORG_MALLOC_DEBUG_ENV) \
-   srcdir=$(srcdir) \
-   $()
-
-tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-tests_CPPFLAGS = @XORG_INCS@ -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)/../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/common.sh b/test/xi1/common.sh
deleted file mode 100644
index 892028d9a585..
--- a/test/x

[PATCH xserver 08/10] tests: Move test/xi2/tests binary into test/tests

2016-12-30 Thread Mihail Konev
Avoids one more linking.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 19 ---
 test/tests.c | 15 +++
 test/xi2/protocol_eventconvert.sh|  1 -
 test/xi2/protocol_xigetclientpointer.sh  |  1 -
 test/xi2/protocol_xigetselectedevents.sh |  1 -
 test/xi2/protocol_xipassivegrabdevice.sh |  1 -
 test/xi2/protocol_xiquerydevice.sh   |  1 -
 test/xi2/protocol_xiquerypointer.sh  |  1 -
 test/xi2/protocol_xiqueryversion.sh  |  1 -
 test/xi2/protocol_xiselectevents.sh  |  1 -
 test/xi2/protocol_xisetclientpointer.sh  |  1 -
 test/xi2/protocol_xiwarppointer.sh   |  1 -
 test/xi2/tests.c | 24 
 test/xi2/xi2.sh  |  1 -
 14 files changed, 19 insertions(+), 50 deletions(-)
 delete mode 100644 test/xi2/tests.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 71bfa63adae4..c3850f70ca4a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -220,7 +220,6 @@ endif ENABLE_UNIT_TESTS
 
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS += xi2/tests
 
 TESTS += \
xi2/protocol_xiqueryversion.sh \
@@ -235,24 +234,16 @@ TESTS += \
xi2/protocol_eventconvert.sh \
xi2/xi2.sh
 
-xi2_tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-xi2_tests_CPPFLAGS = @XORG_INCS@
-xi2_tests_LDADD= libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+tests_CPPFLAGS += -DENABLE_XI2_TESTS
 
-if SPECIAL_DTRACE_OBJECTS
-xi2_tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-xi2_tests_LDFLAGS = \
+tests_LDFLAGS += \
 -Wl,-wrap,WriteToClient \
--Wl,-wrap,dixLookupWindow \
 -Wl,-wrap,XISetEventMask \
 -Wl,-wrap,AddResource \
 -Wl,-wrap,GrabButton \
--Wl,-wrap,dixLookupClient \
 $()
 
-xi2_tests_SOURCES = \
+tests_SOURCES += \
xi2/protocol-xiqueryversion.c \
xi2/protocol-xiquerydevice.c \
xi2/protocol-xiselectevents.c \
@@ -263,9 +254,7 @@ xi2_tests_SOURCES = \
xi2/protocol-xipassivegrabdevice.c \
xi2/protocol-xiwarppointer.c \
xi2/protocol-eventconvert.c \
-   xi2/xi2.c \
-   xi2/protocol-common.c \
-   xi2/tests.c
+   xi2/xi2.c
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index 451631c33a8e..6f2b102d72f9 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -2,6 +2,7 @@
 
 #include "tests.h"
 #include "xi1/tests.h"
+#include "xi2/protocol-common.h"
 
 int main(int argc, char **argv) {
 if (argc < 2) { return 1; }
@@ -25,5 +26,19 @@ int main(int argc, char **argv) {
 try_command(protocol_xchangedevicecontrol);
 #endif
 
+#ifdef ENABLE_XI2_TESTS
+try_command(protocol_xiqueryversion);
+try_command(protocol_xiquerydevice);
+try_command(protocol_xiselectevents);
+try_command(protocol_xigetselectedevents);
+try_command(protocol_xisetclientpointer);
+try_command(protocol_xigetclientpointer);
+try_command(protocol_xipassivegrabdevice);
+try_command(protocol_xiquerypointer);
+try_command(protocol_xiwarppointer);
+try_command(protocol_eventconvert);
+try_command(xi2);
+#endif
+
 return 1;
 }
diff --git a/test/xi2/protocol_eventconvert.sh 
b/test/xi2/protocol_eventconvert.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_eventconvert.sh
+++ b/test/xi2/protocol_eventconvert.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xigetclientpointer.sh 
b/test/xi2/protocol_xigetclientpointer.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_xigetclientpointer.sh
+++ b/test/xi2/protocol_xigetclientpointer.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xigetselectedevents.sh 
b/test/xi2/protocol_xigetselectedevents.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_xigetselectedevents.sh
+++ b/test/xi2/protocol_xigetselectedevents.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xipassivegrabdevice.sh 
b/test/xi2/protocol_xipassivegrabdevice.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_xipassivegrabdevice.sh
+++ b/test/xi2/protocol_xipassivegrabdevice.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xiquerydevice.sh 
b/test/xi2/protocol_xiquerydevice.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_xiquerydevice.sh
+++ b/test/xi2/protocol_xiquerydevice.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xiquerypointer.sh 
b/test/xi2/protocol_xiquerypointer.sh
index 0ae8e960f75c..dd9106615e6a 100755
--- a/test/xi2/protocol_xiquerypointer.sh
+++ b/test/xi2/protocol_xiquerypointer.sh
@@ -1,3 +1,2 @@
 #!/bin/sh
-test_subdir=xi2
 . $srcdir/common.sh
diff --git a/test/xi2/protocol_xiqueryversion.sh 
b/te

[PATCH xserver 10/10] tests: Remove obsolete libxservertest.la

2016-12-30 Thread Mihail Konev
Avoids one more linking.

In makefile, remove OS_LIB and DIX_LIB to avoid double-inclusion.
Also move the libxorgos.la to satisfy libcommon.la.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 38 +-
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index bbb233f19842..bd19dac13d58 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,7 +2,6 @@ CLEANFILES =
 
 if ENABLE_UNIT_TESTS
 
-check_LTLIBRARIES = libxservertest.la
 noinst_PROGRAMS = simple-xinit tests
 
 tests_SOURCES = list.c string.c tests.c
@@ -68,22 +67,19 @@ 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
-tests_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_CPPFLAGS = $(AM_CPPFLAGS)
 
-if SPECIAL_DTRACE_OBJECTS
-tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-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_LDFLAGS += \
 $(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 \
@@ -101,19 +97,19 @@ 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 = \
+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 \
@@ -131,38 +127,38 @@ 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 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)
+tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 00/10] tests: Use single binary

2016-12-30 Thread Mihail Konev
As suggested, speedup partial rebuild by decreasing the number of test programs
that have to be linked.

 configure.ac   |   2 -
 hw/xfree86/os-support/linux/Makefile.am|   5 +-
 hw/xfree86/ramdac/Makefile.am  |   2 +-
 .../ramdac/{xf86Cursor.c => xf86CursorRamDac.c}|   0
 test/Makefile.am   | 200 +++--
 test/common.sh |   3 +
 test/fixes.c   |   4 +-
 test/fixes.sh  |   2 +
 test/hashtable.sh  |   2 +
 test/hashtabletest.c   |   4 +-
 test/input.c   |   4 +-
 test/input.sh  |   2 +
 test/list.c|   4 +-
 test/list.sh   |   2 +
 test/misc.c|   4 +-
 test/misc.sh   |   2 +
 test/signal-logging.c  |   4 +-
 test/signal_logging.sh |   2 +
 test/string.c  |   4 +-
 test/string.sh |   2 +
 test/{xkb.c => test_xkb.c} |   4 +-
 test/{xtest.c => test_xtest.c} |   4 +-
 test/tests.c   |  44 +
 test/tests.h   |  16 ++
 test/touch.c   |   4 +-
 test/touch.sh  |   2 +
 test/xfree86.c |   4 +-
 test/xfree86.sh|   2 +
 test/xi1/Makefile.am   |  34 
 test/xi1/protocol-xchangedevicecontrol.c   |   4 +-
 test/xi1/protocol_xchangedevicecontrol.sh  |   2 +
 test/xi1/tests.h   |   7 +
 test/xi2/.gitignore|   1 +
 test/xi2/Makefile.am   |  70 
 test/xi2/protocol-common.c |  37 
 test/xi2/protocol-common.h |  12 ++
 test/xi2/protocol-eventconvert.c   |   4 +-
 test/xi2/protocol-xigetclientpointer.c |  19 +-
 test/xi2/protocol-xigetselectedevents.c|  22 +--
 test/xi2/protocol-xipassivegrabdevice.c|  18 +-
 test/xi2/protocol-xiquerydevice.c  |   4 +-
 test/xi2/protocol-xiquerypointer.c |  23 +--
 test/xi2/protocol-xiqueryversion.c |   4 +-
 test/xi2/protocol-xiselectevents.c |  24 +--
 test/xi2/protocol-xisetclientpointer.c |  19 +-
 test/xi2/protocol-xiwarppointer.c  |  22 +--
 test/xi2/protocol_eventconvert.sh  |   2 +
 test/xi2/protocol_xigetclientpointer.sh|   2 +
 test/xi2/protocol_xigetselectedevents.sh   |   2 +
 test/xi2/protocol_xipassivegrabdevice.sh   |   2 +
 test/xi2/protocol_xiquerydevice.sh |   2 +
 test/xi2/protocol_xiquerypointer.sh|   2 +
 test/xi2/protocol_xiqueryversion.sh|   2 +
 test/xi2/protocol_xiselectevents.sh|   2 +
 test/xi2/protocol_xisetclientpointer.sh|   2 +
 test/xi2/protocol_xiwarppointer.sh |   2 +
 test/xi2/xi2.c |   6 +-
 test/xi2/xi2.sh|   2 +
 test/xkb.sh|   2 +
 test/xtest.sh  |   2 +
 60 files changed, 378 insertions(+), 314 deletions(-)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 01/10] tests: Refactor wraps into protocol-common.c

2016-12-30 Thread Mihail Konev
This is to prepare for joining test/xi2/protocol-* into a single
binary.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..813241c0aeed 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_LDFLAGS= -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_LDFLAGS) -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 8e638b218f72..64d2ca29bb95 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 bfddfef133fd..f359026cbaa0 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_LDFLAGS= -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_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LDFLAGS)
 
 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)

[PATCH xserver 07/10] tests: Move test/xi1/tests binary into test/tests

2016-12-30 Thread Mihail Konev
Avoids one more linking.

Signed-off-by: Mihail Konev 
---
 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 
+
 #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..
--- a/test/xi1/tests.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include 
-#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

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 06/10] tests: Move test/xi2/Makefile.am to test/

2016-12-30 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
 configure.ac |  1 -
 test/Makefile.am | 70 +++-
 test/xi2/Makefile.am | 69 ---
 test/xi2/common.sh   |  3 --
 test/xi2/protocol_eventconvert.sh|  1 +
 test/xi2/protocol_xigetclientpointer.sh  |  1 +
 test/xi2/protocol_xigetselectedevents.sh |  1 +
 test/xi2/protocol_xipassivegrabdevice.sh |  1 +
 test/xi2/protocol_xiquerydevice.sh   |  1 +
 test/xi2/protocol_xiquerypointer.sh  |  1 +
 test/xi2/protocol_xiqueryversion.sh  |  1 +
 test/xi2/protocol_xiselectevents.sh  |  1 +
 test/xi2/protocol_xisetclientpointer.sh  |  1 +
 test/xi2/protocol_xiwarppointer.sh   |  1 +
 test/xi2/xi2.sh  |  1 +
 15 files changed, 79 insertions(+), 75 deletions(-)
 delete mode 100644 test/xi2/Makefile.am
 delete mode 100644 test/xi2/common.sh

diff --git a/configure.ac b/configure.ac
index 765c39678277..d265528ea124 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2679,7 +2679,6 @@ hw/kdrive/linux/Makefile
 hw/kdrive/src/Makefile
 hw/xwayland/Makefile
 test/Makefile
-test/xi2/Makefile
 xserver.ent
 xorg-server.pc
 ])
diff --git a/test/Makefile.am b/test/Makefile.am
index 02cff057e75f..ce1e6e6ce1a3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 CLEANFILES =
 
 if ENABLE_UNIT_TESTS
-SUBDIRS= .
+
 check_LTLIBRARIES = libxservertest.la
 noinst_PROGRAMS = simple-xinit tests
 
@@ -10,7 +10,6 @@ tests_SOURCES = list.c string.c tests.c
 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 += xi2
 tests_SOURCES += xkb.c input.c xtest.c misc.c fixes.c xfree86.c 
signal-logging.c touch.c
 if RES
 tests_SOURCES += hashtabletest.c
@@ -215,3 +214,70 @@ xi1-tests:
 
 endif !HAVE_LD_WRAP
 endif ENABLE_UNIT_TESTS
+
+# --
+# -- xi2/Makefile.am
+
+if ENABLE_UNIT_TESTS
+if HAVE_LD_WRAP
+noinst_PROGRAMS += xi2/tests
+
+TESTS += \
+   xi2/protocol_xiqueryversion.sh \
+   xi2/protocol_xiquerydevice.sh \
+   xi2/protocol_xiselectevents.sh \
+   xi2/protocol_xigetselectedevents.sh \
+   xi2/protocol_xisetclientpointer.sh \
+   xi2/protocol_xigetclientpointer.sh \
+   xi2/protocol_xipassivegrabdevice.sh \
+   xi2/protocol_xiquerypointer.sh \
+   xi2/protocol_xiwarppointer.sh \
+   xi2/protocol_eventconvert.sh \
+   xi2/xi2.sh
+
+xi2_tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+xi2_tests_CPPFLAGS = @XORG_INCS@
+xi2_tests_LDADD= libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+
+if SPECIAL_DTRACE_OBJECTS
+xi2_tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+xi2_tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+-Wl,-wrap,dixLookupWindow \
+-Wl,-wrap,XISetEventMask \
+-Wl,-wrap,AddResource \
+-Wl,-wrap,GrabButton \
+-Wl,-wrap,dixLookupClient \
+$()
+
+xi2_tests_SOURCES = \
+   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 \
+   xi2/protocol-common.c \
+   xi2/tests.c
+
+else !HAVE_LD_WRAP
+
+# 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 !HAVE_LD_WRAP
+endif ENABLE_UNIT_TESTS
+
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
deleted file mode 100644
index 1b81eca0ad5e..
--- a/test/xi2/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-if ENABLE_UNIT_TESTS
-if HAVE_LD_WRAP
-noinst_PROGRAMS = tests
-
-TESTS = \
-   protocol_xiqueryversion.sh \
-   protocol_xiquerydevice.sh \
-   protocol_xiselectevents.sh \
-   protocol_xigetselectedevents.sh \
-   protocol_xisetclientpointer.sh \
-   protocol_xigetclientpointer.sh \
-   protocol_xipassivegrabdevice.sh \
-   protocol_xiquerypointer.sh \
-   protocol_xiwarppointer.sh \
-   protocol_eventconvert.sh \
-   xi2.sh
-
-TESTS_ENVIRONMENT = \
-   $(XORG_MALLOC_DEBUG_ENV) \
-   srcdir=$(srcdir) \
-   $()
-
-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_LDFLAGS= -Wl,-wrap,dixLooku

[PATCH xserver 04/10] tests: Convert test/ to single binary

2016-12-30 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
 test/Makefile.am   | 53 +++---
 test/common.sh |  3 +++
 test/fixes.c   |  4 +++-
 test/fixes.sh  |  2 ++
 test/hashtable.sh  |  2 ++
 test/hashtabletest.c   |  4 +++-
 test/input.c   |  4 +++-
 test/input.sh  |  2 ++
 test/list.c|  4 +++-
 test/list.sh   |  2 ++
 test/misc.c|  4 +++-
 test/misc.sh   |  2 ++
 test/signal-logging.c  |  4 +++-
 test/signal_logging.sh |  2 ++
 test/string.c  |  4 +++-
 test/string.sh |  2 ++
 test/tests.c   | 23 ++
 test/tests.h   | 16 +++
 test/touch.c   |  4 +++-
 test/touch.sh  |  2 ++
 test/xfree86.c |  4 +++-
 test/xfree86.sh|  2 ++
 test/xkb.c |  4 +++-
 test/xkb.sh|  2 ++
 test/xtest.c   |  4 +++-
 test/xtest.sh  |  2 ++
 26 files changed, 121 insertions(+), 40 deletions(-)
 create mode 100644 test/common.sh
 create mode 100755 test/fixes.sh
 create mode 100755 test/hashtable.sh
 create mode 100755 test/input.sh
 create mode 100755 test/list.sh
 create mode 100755 test/misc.sh
 create mode 100755 test/signal_logging.sh
 create mode 100755 test/string.sh
 create mode 100644 test/tests.c
 create mode 100644 test/tests.h
 create mode 100755 test/touch.sh
 create mode 100755 test/xfree86.sh
 create mode 100755 test/xkb.sh
 create mode 100755 test/xtest.sh

diff --git a/test/Makefile.am b/test/Makefile.am
index 064e1c5b736f..811f5928fb5a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,19 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+check_LTLIBRARIES = libxservertest.la
+noinst_PROGRAMS = simple-xinit tests
+
+tests_SOURCES = list.c string.c tests.c
+
 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
+tests_SOURCES += xkb.c input.c xtest.c misc.c fixes.c xfree86.c 
signal-logging.c touch.c
 if RES
-TEST_PROGS += hashtabletest
+tests_SOURCES += hashtabletest.c
 endif
 endif
-check_LTLIBRARIES = libxservertest.la
-
-noinst_PROGRAMS = \
-   simple-xinit \
-   $(TEST_PROGS) \
-   $(NULL)
 
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
@@ -26,20 +24,27 @@ endif
 endif
 endif
 
-SCRIPT_TESTS = \
+TESTS = \
$(XVFB_TESTS) \
$(XEPHYR_GLAMOR_TESTS) \
-   $(NULL)
-
-TESTS = \
-   $(TEST_PROGS) \
-   $(SCRIPT_TESTS) \
+   list.sh \
+   string.sh \
+   xkb.sh \
+   input.sh \
+   xtest.sh \
+   misc.sh \
+   fixes.sh \
+   xfree86.sh \
+   signal_logging.sh \
+   touch.sh \
+   hashtable.sh \
$(NULL)
 
 TESTS_ENVIRONMENT = \
XSERVER_DIR=$(abs_top_srcdir) \
XSERVER_BUILDDIR=$(abs_top_builddir) \
$(XORG_MALLOC_DEBUG_ENV) \
+   srcdir=$(srcdir) \
$(NULL)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
@@ -51,22 +56,12 @@ 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)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
 endif
 
-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)
-
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
 
@@ -153,7 +148,7 @@ endif
 if XQUARTZ
 libxservertest_la_LIBADD += \
 $(top_builddir)/miext/rootless/librootless.la
-TEST_LDADD += -lXplugin
+tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
@@ -163,7 +158,7 @@ endif
 endif
 
 libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
-endif
+endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
scripts/xvfb-piglit.sh \
diff --git a/test/common.sh b/test/common.sh
new file mode 100644
index ..892028d9a585
--- /dev/null
+++ b/test/common.sh
@@ -0,0 +1,3 @@
+testname=${0%.sh}
+testname=${testname##*/}
+exec ./tests "$testname"
diff --git a/test/fixes.c b/test/fixes.c
index 4ac6750e4179..39b7030d00e1 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#include "tests.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 --g

[PATCH xserver 09/10] tests: Rename files for linking speed

2016-12-30 Thread Mihail Konev
To include two *.o files with same names in an *.a file, libtool has
to first copy and rename one of them.
This is the case with libxservertest.la.

Avoid it by changing names of source files themselves,
and not double-including libdri3.la and lnx_apm.o.
Slightly speeds up linking of tests, and gets rid of the
"copying object files to avoid basename conflicts" message.

Signed-off-by: Mihail Konev 
---
 hw/xfree86/os-support/linux/Makefile.am|  5 -
 hw/xfree86/ramdac/Makefile.am  |  2 +-
 hw/xfree86/ramdac/{xf86Cursor.c => xf86CursorRamDac.c} |  0
 test/Makefile.am   | 11 +--
 test/{xkb.c => test_xkb.c} |  0
 test/{xtest.c => test_xtest.c} |  0
 6 files changed, 6 insertions(+), 12 deletions(-)
 rename hw/xfree86/ramdac/{xf86Cursor.c => xf86CursorRamDac.c} (100%)
 rename test/{xkb.c => test_xkb.c} (100%)
 rename test/{xtest.c => test_xtest.c} (100%)

diff --git a/hw/xfree86/os-support/linux/Makefile.am 
b/hw/xfree86/os-support/linux/Makefile.am
index d8cb1a8b..26e40bb935e3 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -9,7 +9,10 @@ liblinuxev56_la_SOURCES = lnx_ev56.c
 endif
 
 if LNXACPI
-ACPI_SRCS = lnx_acpi.c lnx_apm.c
+ACPI_SRCS = lnx_acpi.c
+if !LNXAPM
+ACPI_SRCS += lnx_apm.c
+endif
 XORG_CFLAGS += -DHAVE_ACPI
 endif
 
diff --git a/hw/xfree86/ramdac/Makefile.am b/hw/xfree86/ramdac/Makefile.am
index a3d77628c944..68951794482d 100644
--- a/hw/xfree86/ramdac/Makefile.am
+++ b/hw/xfree86/ramdac/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = libramdac.la
 
 libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
-  xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c
+   xf86CursorRamDac.c xf86HWCurs.c IBM.c BT.c TI.c
 
 sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
 
diff --git a/hw/xfree86/ramdac/xf86Cursor.c 
b/hw/xfree86/ramdac/xf86CursorRamDac.c
similarity index 100%
rename from hw/xfree86/ramdac/xf86Cursor.c
rename to hw/xfree86/ramdac/xf86CursorRamDac.c
diff --git a/test/Makefile.am b/test/Makefile.am
index c3850f70ca4a..bbb233f19842 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,7 +20,7 @@ endif HAVE_LD_WRAP
 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
-tests_SOURCES += xkb.c input.c xtest.c misc.c fixes.c xfree86.c 
signal-logging.c touch.c
+tests_SOURCES += test_xkb.c input.c test_xtest.c misc.c fixes.c xfree86.c 
signal-logging.c touch.c
 if RES
 tests_SOURCES += hashtabletest.c
 endif
@@ -108,10 +108,6 @@ if DRI2
 libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
 endif
 
-if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
-endif
-
 else
 nodist_libxservertest_la_SOURCES = \
 ddxstubs.c \
@@ -154,11 +150,6 @@ libxservertest_la_LIBADD += \
 $(top_builddir)/record/librecord.la
 endif
 
-if DRI3
-libxservertest_la_LIBADD += \
-$(top_builddir)/dri3/libdri3.la
-endif
-
 if XQUARTZ
 libxservertest_la_LIBADD += \
 $(top_builddir)/miext/rootless/librootless.la
diff --git a/test/xkb.c b/test/test_xkb.c
similarity index 100%
rename from test/xkb.c
rename to test/test_xkb.c
diff --git a/test/xtest.c b/test/test_xtest.c
similarity index 100%
rename from test/xtest.c
rename to test/test_xtest.c
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 03/10] tests: Convert test/xi2/ to single binary

2016-12-30 Thread Mihail Konev
Instead of multiple test binaries, use a single one which executes
a test depending on the command-line argument being passed.

For testsuite, emulate multiple binaries with shell scripts
that pass an appropriate argument.

Speeds up partial rebuild, as each linking takes a noticeable
amount of time, and all of them have to be done for verification
purposes.

Signed-off-by: Mihail Konev 
---
 test/xi2/.gitignore  |  1 +
 test/xi2/Makefile.am | 87 +++-
 test/xi2/common.sh   |  3 ++
 test/xi2/protocol-common.h   | 12 +
 test/xi2/protocol-eventconvert.c |  2 +-
 test/xi2/protocol-xigetclientpointer.c   |  2 +-
 test/xi2/protocol-xigetselectedevents.c  |  2 +-
 test/xi2/protocol-xipassivegrabdevice.c  |  2 +-
 test/xi2/protocol-xiquerydevice.c|  2 +-
 test/xi2/protocol-xiquerypointer.c   |  2 +-
 test/xi2/protocol-xiqueryversion.c   |  2 +-
 test/xi2/protocol-xiselectevents.c   |  2 +-
 test/xi2/protocol-xisetclientpointer.c   |  2 +-
 test/xi2/protocol-xiwarppointer.c|  2 +-
 test/xi2/protocol_eventconvert.sh|  2 +
 test/xi2/protocol_xigetclientpointer.sh  |  2 +
 test/xi2/protocol_xigetselectedevents.sh |  2 +
 test/xi2/protocol_xipassivegrabdevice.sh |  2 +
 test/xi2/protocol_xiquerydevice.sh   |  2 +
 test/xi2/protocol_xiquerypointer.sh  |  2 +
 test/xi2/protocol_xiqueryversion.sh  |  2 +
 test/xi2/protocol_xiselectevents.sh  |  2 +
 test/xi2/protocol_xisetclientpointer.sh  |  2 +
 test/xi2/protocol_xiwarppointer.sh   |  2 +
 test/xi2/tests.c | 24 +
 test/xi2/xi2.c   |  2 +-
 test/xi2/xi2.sh  |  2 +
 27 files changed, 115 insertions(+), 56 deletions(-)
 create mode 100644 test/xi2/common.sh
 create mode 100755 test/xi2/protocol_eventconvert.sh
 create mode 100755 test/xi2/protocol_xigetclientpointer.sh
 create mode 100755 test/xi2/protocol_xigetselectedevents.sh
 create mode 100755 test/xi2/protocol_xipassivegrabdevice.sh
 create mode 100755 test/xi2/protocol_xiquerydevice.sh
 create mode 100755 test/xi2/protocol_xiquerypointer.sh
 create mode 100755 test/xi2/protocol_xiqueryversion.sh
 create mode 100755 test/xi2/protocol_xiselectevents.sh
 create mode 100755 test/xi2/protocol_xisetclientpointer.sh
 create mode 100755 test/xi2/protocol_xiwarppointer.sh
 create mode 100644 test/xi2/tests.c
 create mode 100755 test/xi2/xi2.sh

diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
index 817aa7b6b83b..53a2d8936272 100644
--- a/test/xi2/.gitignore
+++ b/test/xi2/.gitignore
@@ -9,3 +9,4 @@ protocol-xiselectevents
 protocol-xisetclientpointer
 protocol-xiwarppointer
 xi2
+tests
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index f359026cbaa0..1b81eca0ad5e 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,20 +1,24 @@
 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=$(noinst_PROGRAMS)
-TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
+TESTS = \
+   protocol_xiqueryversion.sh \
+   protocol_xiquerydevice.sh \
+   protocol_xiselectevents.sh \
+   protocol_xigetselectedevents.sh \
+   protocol_xisetclientpointer.sh \
+   protocol_xigetclientpointer.sh \
+   protocol_xipassivegrabdevice.sh \
+   protocol_xiquerypointer.sh \
+   protocol_xiwarppointer.sh \
+   protocol_eventconvert.sh \
+   xi2.sh
+
+TESTS_ENVIRONMENT = \
+   $(XORG_MALLOC_DEBUG_ENV) \
+   srcdir=$(srcdir) \
+   $()
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@
@@ -26,39 +30,32 @@ if SPECIAL_DTRACE_OBJECTS
 TEST_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)
+tests_LDADD = $(TEST_LDADD)
+
+tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+-Wl,-wrap,dixLookupWindow \
+-Wl,-wrap,XISetEventMask \
+-Wl,-wrap,AddResource \
+-Wl,-wrap,GrabButton \
+-Wl,-wrap,dixLookupClient \
+$()
 
-protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient

[PATCH xserver 02/10] tests: Convert test/xi1/ to single binary

2016-12-30 Thread Mihail Konev
While there is no functional change, it prepares for joining
makefiles under test/ into a single one.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am  | 38 +++
 test/xi1/common.sh|  3 +++
 test/xi1/protocol-xchangedevicecontrol.c  |  3 ++-
 test/xi1/protocol_xchangedevicecontrol.sh |  2 ++
 test/xi1/tests.c  | 13 +++
 test/xi1/tests.h  |  7 ++
 6 files changed, 50 insertions(+), 16 deletions(-)
 create mode 100644 test/xi1/common.sh
 create mode 100755 test/xi1/protocol_xchangedevicecontrol.sh
 create mode 100644 test/xi1/tests.c
 create mode 100644 test/xi1/tests.h

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 813241c0aeed..a53b3f7b0230 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -1,26 +1,34 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
-   protocol-xchangedevicecontrol
+noinst_PROGRAMS = tests
 
-TESTS=$(noinst_PROGRAMS)
-TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
+TESTS = \
+   protocol_xchangedevicecontrol.sh \
+   $()
 
-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_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+TESTS_ENVIRONMENT = \
+   $(XORG_MALLOC_DEBUG_ENV) \
+   srcdir=$(srcdir) \
+   $()
 
-if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+tests_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
+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_LDFLAGS) -Wl,-wrap,WriteToClient
+tests_SOURCES = \
+   $(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/common.sh b/test/xi1/common.sh
new file mode 100644
index ..892028d9a585
--- /dev/null
+++ b/test/xi1/common.sh
@@ -0,0 +1,3 @@
+testname=${0%.sh}
+testname=${testname##*/}
+exec ./tests "$testname"
diff --git a/test/xi1/protocol-xchangedevicecontrol.c 
b/test/xi1/protocol-xchangedevicecontrol.c
index 64d2ca29bb95..0e4ce2a38093 100644
--- a/test/xi1/protocol-xchangedevicecontrol.c
+++ b/test/xi1/protocol-xchangedevicecontrol.c
@@ -36,6 +36,7 @@
 #include "chgdctl.h"
 
 #include "protocol-common.h"
+#include "tests.h"
 
 ClientRec client_window;
 static ClientRec client_request;
@@ -113,7 +114,7 @@ test_ChangeDeviceControl(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xchangedevicecontrol_test(void)
 {
 init_simple();
 
diff --git a/test/xi1/protocol_xchangedevicecontrol.sh 
b/test/xi1/protocol_xchangedevicecontrol.sh
new file mode 100755
index ..dd9106615e6a
--- /dev/null
+++ b/test/xi1/protocol_xchangedevicecontrol.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+. $srcdir/common.sh
diff --git a/test/xi1/tests.c b/test/xi1/tests.c
new file mode 100644
index ..eee5bba191a7
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,13 @@
+#include 
+#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
new file mode 100644
index ..8a42aa0da592
--- /dev/null
+++ b/test/xi1/tests.h
@@ -0,0 +1,7 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+int protocol_xchangedevicecontrol_test(void);
+
+#endif /* TESTS_H */
+
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/2] xkb: Match key releases with an overlaid press

2017-01-01 Thread Mihail Konev
Testcase:

In ~/.xbindkeysrc:
  "xterm &"
   XF86LaunchA

In ~/ov.xkb:
  xkb_keymap {
  xkb_keycodes { include "evdev" };
  xkb_types{ include "complete" };
  xkb_compat   { include "complete"
  interpret Overlay1_Enable+AnyOfOrNone(all) {
  action= SetControls(controls=Overlay1);
  };
  };
  xkb_symbols  { include "pc+inet(evdev)+us"
  key  { [ Overlay1_Enable ] };
  key  { overlay1 =  }; // Insert+1 => 2
  key  { overlay1 =  }; // Insert+~ => XF86LaunchA
  };
  xkb_geometry { include "pc(pc104)" };
  };

Apply this layout: 'xkbcomp ~/ov.xkb $DISPLAY'.
Run "xbindkeys -n -v"
In the exact order:
- press Insert
- press Tilde
- release Insert
- wait
- release Tilde
Keyboard input in the new terminal window(s) would be locked
until another Insert+Tilde .

Reported-by: Mariusz Mazur 
Signed-off-by: Mihail Konev 
---
 include/xkbsrv.h |  2 ++
 xkb/xkbInit.c|  9 +
 xkb/xkbPrKeyEv.c | 29 +
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 6e4ad44d49f9..c766284d9cf3 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -195,6 +195,8 @@ typedef struct _XkbSrvInfo {
 XkbFilterPtr filters;
 
 XkbSrvCheckRepeatPtr checkRepeat;
+
+char overlay_perkey_state[256];
 } XkbSrvInfoRec, *XkbSrvInfoPtr;
 
 #defineXkbSLI_IsDefault(1L<<0)
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 9c772f549be0..46016aba5553 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -505,6 +505,13 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
 return Success;
 }
 
+static Status
+XkbInitOverlayState(XkbSrvInfoPtr xkbi)
+{
+memset(xkbi->overlay_perkey_state, 0, sizeof(xkbi->overlay_perkey_state));
+return Success;
+}
+
 static Bool
 InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
  const char *keymap, int keymap_length,
@@ -608,6 +615,8 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, 
XkbRMLVOSet * rmlvo,
 
 XkbInitIndicatorMap(xkbi);
 
+XkbInitOverlayState(xkbi);
+
 XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &changes,
  &check, &cause);
 
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index f7a6b4b14306..6f93291f8304 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -121,20 +121,33 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr 
keybd)
 case XkbKB_Overlay2:
 {
 unsigned which;
+unsigned overlay_active_now;
+unsigned is_keyrelease = (event->type == ET_KeyRelease) ? 1 : 0;
+/* Remembers whether the key was pressed while overlay was down,
+ * for when overlay is already released, but the key is not. */
+unsigned key_was_overlaid = 0;
 
 if (behavior.type == XkbKB_Overlay1)
 which = XkbOverlay1Mask;
 else
 which = XkbOverlay2Mask;
-if ((xkbi->desc->ctrls->enabled_ctrls & which) == 0)
-break;
-if ((behavior.data >= xkbi->desc->min_key_code) &&
-(behavior.data <= xkbi->desc->max_key_code)) {
+overlay_active_now = (xkbi->desc->ctrls->enabled_ctrls & which) ? 
1 : 0;
+
+if ((unsigned char)key == key) {
+key_was_overlaid = xkbi->overlay_perkey_state[key];
+if (!is_keyrelease) {
+if (overlay_active_now)
+xkbi->overlay_perkey_state[key] = 1;
+} else {
+if (key_was_overlaid)
+xkbi->overlay_perkey_state[key] = 0;
+}
+}
+
+if ((overlay_active_now || key_was_overlaid) &&
+(behavior.data >= xkbi->desc->min_key_code) &&
+(behavior.data <= xkbi->desc->max_key_code)) {
 event->detail.key = behavior.data;
-/* 9/11/94 (ef) -- XXX! need to match release with */
-/* press even if the state of the  */
-/* corresponding overlay control   */
-/* changes while the key is down   */
 }
 }
 break;
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/2] xkb: Make overlay_perkey_state a bitfield

2017-01-01 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
 include/xkbsrv.h |  3 ++-
 xkb/xkbPrKeyEv.c | 10 +++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index c766284d9cf3..7a3e3a46d823 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -53,6 +53,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #defineXkbApplyVirtualModChanges   SrvXkbApplyVirtualModChanges
 
 #include 
+#include 
 #include "xkbstr.h"
 #include "xkbrules.h"
 #include "inputstr.h"
@@ -196,7 +197,7 @@ typedef struct _XkbSrvInfo {
 
 XkbSrvCheckRepeatPtr checkRepeat;
 
-char overlay_perkey_state[256];
+char overlay_perkey_state[256/BitsInByte];
 } XkbSrvInfoRec, *XkbSrvInfoPtr;
 
 #defineXkbSLI_IsDefault(1L<<0)
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index 6f93291f8304..8e453bca2a10 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -41,6 +41,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include 
 #include "events.h"
 
+#define True 1
+#define False 0
+#include 
+
 /******/
 
 void
@@ -134,13 +138,13 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr 
keybd)
 overlay_active_now = (xkbi->desc->ctrls->enabled_ctrls & which) ? 
1 : 0;
 
 if ((unsigned char)key == key) {
-key_was_overlaid = xkbi->overlay_perkey_state[key];
+key_was_overlaid = BitValue(xkbi->overlay_perkey_state, key);
 if (!is_keyrelease) {
 if (overlay_active_now)
-xkbi->overlay_perkey_state[key] = 1;
+BitTrue(xkbi->overlay_perkey_state, key);
 } else {
 if (key_was_overlaid)
-xkbi->overlay_perkey_state[key] = 0;
+BitFalse(xkbi->overlay_perkey_state, key);
 }
 }
 
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v6 xserver 0/2] xkb: Fix overlay releasing locking input

2017-01-01 Thread Mihail Konev
Simplifying v4 made unnecessary the cryptic if branch.
(It must have been working around patch's own bug).

 include/xkbsrv.h |  3 +++
 xkb/xkbInit.c|  9 +
 xkb/xkbPrKeyEv.c | 33 +
 3 files changed, 37 insertions(+), 8 deletions(-)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 xserver 01/10] tests: Refactor wraps into protocol-common.c

2017-01-02 Thread Mihail Konev
This is to prepare for joining test/xi2/protocol-* into a single
binary.

Signed-off-by: Mihail Konev 
---
v2: fix omitted WriteToClient in protocol_xipassivegrabdevice_LDFLAGS

 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..813241c0aeed 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_LDFLAGS= -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_LDFLAGS) -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 8e638b218f72..64d2ca29bb95 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 bfddfef133fd..6b9679872b48 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_LDFLAGS= -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_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LDFLAGS)
 
 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

[PATCH v2 xserver 03/10] tests: Convert test/xi2/ to single binary

2017-01-02 Thread Mihail Konev
Instead of multiple test binaries, use a single one which executes
a test depending on the command-line argument being passed.

For testsuite, emulate multiple binaries with shell scripts
that pass an appropriate argument.

Speeds up partial rebuild, as each linking takes a noticeable
amount of time, and all of them have to be done for verification
purposes.

Signed-off-by: Mihail Konev 
---
 test/xi2/.gitignore  |  1 +
 test/xi2/Makefile.am | 87 +++-
 test/xi2/common.sh   |  3 ++
 test/xi2/protocol-common.h   | 12 +
 test/xi2/protocol-eventconvert.c |  2 +-
 test/xi2/protocol-xigetclientpointer.c   |  2 +-
 test/xi2/protocol-xigetselectedevents.c  |  2 +-
 test/xi2/protocol-xipassivegrabdevice.c  |  2 +-
 test/xi2/protocol-xiquerydevice.c|  2 +-
 test/xi2/protocol-xiquerypointer.c   |  2 +-
 test/xi2/protocol-xiqueryversion.c   |  2 +-
 test/xi2/protocol-xiselectevents.c   |  2 +-
 test/xi2/protocol-xisetclientpointer.c   |  2 +-
 test/xi2/protocol-xiwarppointer.c|  2 +-
 test/xi2/protocol_eventconvert.sh|  2 +
 test/xi2/protocol_xigetclientpointer.sh  |  2 +
 test/xi2/protocol_xigetselectedevents.sh |  2 +
 test/xi2/protocol_xipassivegrabdevice.sh |  2 +
 test/xi2/protocol_xiquerydevice.sh   |  2 +
 test/xi2/protocol_xiquerypointer.sh  |  2 +
 test/xi2/protocol_xiqueryversion.sh  |  2 +
 test/xi2/protocol_xiselectevents.sh  |  2 +
 test/xi2/protocol_xisetclientpointer.sh  |  2 +
 test/xi2/protocol_xiwarppointer.sh   |  2 +
 test/xi2/tests.c | 24 +
 test/xi2/xi2.c   |  2 +-
 test/xi2/xi2.sh  |  2 +
 27 files changed, 115 insertions(+), 56 deletions(-)
 create mode 100644 test/xi2/common.sh
 create mode 100755 test/xi2/protocol_eventconvert.sh
 create mode 100755 test/xi2/protocol_xigetclientpointer.sh
 create mode 100755 test/xi2/protocol_xigetselectedevents.sh
 create mode 100755 test/xi2/protocol_xipassivegrabdevice.sh
 create mode 100755 test/xi2/protocol_xiquerydevice.sh
 create mode 100755 test/xi2/protocol_xiquerypointer.sh
 create mode 100755 test/xi2/protocol_xiqueryversion.sh
 create mode 100755 test/xi2/protocol_xiselectevents.sh
 create mode 100755 test/xi2/protocol_xisetclientpointer.sh
 create mode 100755 test/xi2/protocol_xiwarppointer.sh
 create mode 100644 test/xi2/tests.c
 create mode 100755 test/xi2/xi2.sh

diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
index 817aa7b6b83b..53a2d8936272 100644
--- a/test/xi2/.gitignore
+++ b/test/xi2/.gitignore
@@ -9,3 +9,4 @@ protocol-xiselectevents
 protocol-xisetclientpointer
 protocol-xiwarppointer
 xi2
+tests
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 6b9679872b48..1b81eca0ad5e 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,20 +1,24 @@
 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=$(noinst_PROGRAMS)
-TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
+TESTS = \
+   protocol_xiqueryversion.sh \
+   protocol_xiquerydevice.sh \
+   protocol_xiselectevents.sh \
+   protocol_xigetselectedevents.sh \
+   protocol_xisetclientpointer.sh \
+   protocol_xigetclientpointer.sh \
+   protocol_xipassivegrabdevice.sh \
+   protocol_xiquerypointer.sh \
+   protocol_xiwarppointer.sh \
+   protocol_eventconvert.sh \
+   xi2.sh
+
+TESTS_ENVIRONMENT = \
+   $(XORG_MALLOC_DEBUG_ENV) \
+   srcdir=$(srcdir) \
+   $()
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@
@@ -26,39 +30,32 @@ if SPECIAL_DTRACE_OBJECTS
 TEST_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)
+tests_LDADD = $(TEST_LDADD)
+
+tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+-Wl,-wrap,dixLookupWindow \
+-Wl,-wrap,XISetEventMask \
+-Wl,-wrap,AddResource \
+-Wl,-wrap,GrabButton \
+-Wl,-wrap,dixLookupClient \
+$()
 
-protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient

[PATCH xserver] tests: Avoid libtool message

2017-01-03 Thread Mihail Konev
The "copying selected object files" message appears as some source
files have the same name, and some objects are included twice.

Signed-off-by: Mihail Konev 
---
 hw/xfree86/os-support/linux/Makefile.am| 5 -
 hw/xfree86/ramdac/Makefile.am  | 2 +-
 hw/xfree86/ramdac/{xf86Cursor.c => xf86CursorRD.c} | 0
 test/Makefile.am   | 6 ++
 test/{xkb.c => test_xkb.c} | 0
 5 files changed, 7 insertions(+), 6 deletions(-)
 rename hw/xfree86/ramdac/{xf86Cursor.c => xf86CursorRD.c} (100%)
 rename test/{xkb.c => test_xkb.c} (100%)

diff --git a/hw/xfree86/os-support/linux/Makefile.am 
b/hw/xfree86/os-support/linux/Makefile.am
index d8cb1a8b..26e40bb935e3 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -9,7 +9,10 @@ liblinuxev56_la_SOURCES = lnx_ev56.c
 endif
 
 if LNXACPI
-ACPI_SRCS = lnx_acpi.c lnx_apm.c
+ACPI_SRCS = lnx_acpi.c
+if !LNXAPM
+ACPI_SRCS += lnx_apm.c
+endif
 XORG_CFLAGS += -DHAVE_ACPI
 endif
 
diff --git a/hw/xfree86/ramdac/Makefile.am b/hw/xfree86/ramdac/Makefile.am
index a3d77628c944..59e0996ad387 100644
--- a/hw/xfree86/ramdac/Makefile.am
+++ b/hw/xfree86/ramdac/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = libramdac.la
 
 libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
-  xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c
+   xf86CursorRD.c xf86HWCurs.c IBM.c BT.c TI.c
 
 sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
 
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86CursorRD.c
similarity index 100%
rename from hw/xfree86/ramdac/xf86Cursor.c
rename to hw/xfree86/ramdac/xf86CursorRD.c
diff --git a/test/Makefile.am b/test/Makefile.am
index 064e1c5b736f..bbf66913a9e7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -57,6 +57,8 @@ 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)
@@ -99,10 +101,6 @@ if DRI2
 libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
 endif
 
-if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
-endif
-
 else
 nodist_libxservertest_la_SOURCES = \
 ddxstubs.c \
diff --git a/test/xkb.c b/test/test_xkb.c
similarity index 100%
rename from test/xkb.c
rename to test/test_xkb.c
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v7 xserver] xkb: Match key releases with an overlaid press

2017-01-03 Thread Mihail Konev
Testcase:

In ~/.xbindkeysrc:
  "xterm &"
   XF86LaunchA

In ~/ov.xkb:
  xkb_keymap {
  xkb_keycodes { include "evdev" };
  xkb_types{ include "complete" };
  xkb_compat   { include "complete"
  interpret Overlay1_Enable+AnyOfOrNone(all) {
  action= SetControls(controls=Overlay1);
  };
  };
  xkb_symbols  { include "pc+inet(evdev)+us"
  key  { [ Overlay1_Enable ] };
  key  { overlay1 =  }; // Insert+1 => 2
  key  { overlay1 =  }; // Insert+~ => XF86LaunchA
  };
  xkb_geometry { include "pc(pc104)" };
  };

Apply this layout: 'xkbcomp ~/ov.xkb $DISPLAY'.
Run "xbindkeys -n -v"
In the exact order:
- press Insert
- press Tilde
- release Insert
- wait
- release Tilde
Keyboard input in the new terminal window(s) would be locked
until another Insert+Tilde .

Reported-by: Mariusz Mazur 
Signed-off-by: Mihail Konev 
---
 include/xkbsrv.h |  2 ++
 xkb/xkbInit.c|  9 +
 xkb/xkbPrKeyEv.c | 29 +
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 6e4ad44d49f9..2870f3987f66 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -195,6 +195,8 @@ typedef struct _XkbSrvInfo {
 XkbFilterPtr filters;
 
 XkbSrvCheckRepeatPtr checkRepeat;
+
+char overlay_perkey_state[256/8]; /* bitfield */
 } XkbSrvInfoRec, *XkbSrvInfoPtr;
 
 #defineXkbSLI_IsDefault(1L<<0)
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 9c772f549be0..46016aba5553 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -505,6 +505,13 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
 return Success;
 }
 
+static Status
+XkbInitOverlayState(XkbSrvInfoPtr xkbi)
+{
+memset(xkbi->overlay_perkey_state, 0, sizeof(xkbi->overlay_perkey_state));
+return Success;
+}
+
 static Bool
 InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
  const char *keymap, int keymap_length,
@@ -608,6 +615,8 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, 
XkbRMLVOSet * rmlvo,
 
 XkbInitIndicatorMap(xkbi);
 
+XkbInitOverlayState(xkbi);
+
 XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &changes,
  &check, &cause);
 
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index f7a6b4b14306..d2c7e33f4213 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -121,20 +121,33 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr 
keybd)
 case XkbKB_Overlay2:
 {
 unsigned which;
+unsigned overlay_active_now;
+unsigned is_keyrelease = (event->type == ET_KeyRelease) ? 1 : 0;
+/* Remembers whether the key was pressed while overlay was down,
+ * for when overlay is already released, but the key is not. */
+unsigned key_was_overlaid = 0;
 
 if (behavior.type == XkbKB_Overlay1)
 which = XkbOverlay1Mask;
 else
 which = XkbOverlay2Mask;
-if ((xkbi->desc->ctrls->enabled_ctrls & which) == 0)
-break;
-if ((behavior.data >= xkbi->desc->min_key_code) &&
-(behavior.data <= xkbi->desc->max_key_code)) {
+overlay_active_now = (xkbi->desc->ctrls->enabled_ctrls & which) ? 
1 : 0;
+
+if ((unsigned char)key == key) {
+key_was_overlaid = BitIsOn(xkbi->overlay_perkey_state, key);
+if (!is_keyrelease) {
+if (overlay_active_now)
+SetBit(xkbi->overlay_perkey_state, key);
+} else {
+if (key_was_overlaid)
+ClearBit(xkbi->overlay_perkey_state, key);
+}
+}
+
+if ((overlay_active_now || key_was_overlaid) &&
+(behavior.data >= xkbi->desc->min_key_code) &&
+(behavior.data <= xkbi->desc->max_key_code)) {
 event->detail.key = behavior.data;
-/* 9/11/94 (ef) -- XXX! need to match release with */
-/* press even if the state of the  */
-/* corresponding overlay control   */
-/* changes while the key is down   */
 }
 }
 break;
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/6] tests: Refactor wraps into protocol-common.c

2017-01-03 Thread Mihail Konev
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.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..813241c0aeed 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_LDFLAGS= -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_LDFLAGS) -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 8e638b218f72..64d2ca29bb95 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 bfddfef133fd..6b9679872b48 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_LDFLAGS= -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_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LDFLAGS)
 
 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_xiquerypoint

[PATCH xserver 3/6] tests: Convert test/xi2/ to single binary

2017-01-03 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests.h| 19 
 test/xi2/.gitignore | 12 +
 test/xi2/Makefile.am| 84 +
 test/xi2/protocol-common.c  |  4 ++
 test/xi2/protocol-eventconvert.c|  2 +-
 test/xi2/protocol-xigetclientpointer.c  |  2 +-
 test/xi2/protocol-xigetselectedevents.c |  4 +-
 test/xi2/protocol-xipassivegrabdevice.c |  9 +++-
 test/xi2/protocol-xiquerydevice.c   |  2 +-
 test/xi2/protocol-xiquerypointer.c  |  2 +-
 test/xi2/protocol-xiqueryversion.c  |  2 +-
 test/xi2/protocol-xiselectevents.c  |  9 +++-
 test/xi2/protocol-xisetclientpointer.c  |  2 +-
 test/xi2/protocol-xiwarppointer.c   |  2 +-
 test/xi2/tests.c| 21 +
 test/xi2/xi2.c  |  2 +-
 16 files changed, 106 insertions(+), 72 deletions(-)
 create mode 100644 test/xi2/tests.c

diff --git a/test/tests.h b/test/tests.h
index 8a42aa0da592..0b673ee7ae79 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -3,5 +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 817aa7b6b83b..2b29f27645f8 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 6b9679872b48..a7f9831a93cd 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,64 +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 = @XORG_INCS@
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
-COMMON_SOURCES=protocol-common.h protocol-common.c
-COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+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
-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)
+tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+-Wl,-wrap,dixLookupWindow \
+-Wl,-wrap,XISetEventMask \
+-Wl,-wrap,AddResource \
+-Wl,-wrap,GrabButton \
+-Wl,-wrap,dixLookupClient \
+$()
 
-protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton

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

2017-01-03 Thread Mihail Konev
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 
---
 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_tes

[PATCH xserver 2/6] tests: Convert test/xi1/ to single binary

2017-01-03 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests-common.c  | 33 
 test/tests-common.h  |  9 
 test/tests.h |  7 ++
 test/xi1/.gitignore  |  2 +-
 test/xi1/Makefile.am | 37 
 test/xi1/protocol-xchangedevicecontrol.c |  2 +-
 test/xi1/tests.c | 11 ++
 test/xi2/protocol-common.h   |  2 ++
 8 files changed, 87 insertions(+), 16 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.h
 create mode 100644 test/xi1/tests.c

diff --git a/test/tests-common.c b/test/tests-common.c
new file mode 100644
index ..686852827765
--- /dev/null
+++ b/test/tests-common.c
@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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 ..b02f746f6f56
--- /dev/null
+++ b/test/tests-common.h
@@ -0,0 +1,9 @@
+#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 ..8a42aa0da592
--- /dev/null
+++ b/test/tests.h
@@ -0,0 +1,7 @@
+#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 c1b9024ee958..2b29f27645f8 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 813241c0aeed..7a054dd80966 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_LDFLAGS= -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_LDFLAGS) -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 64d2ca29bb95..57a15c4076f5 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 ..df4638dc98ab
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,11 @@
+#include 
+#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/protocol-common.h b/test/xi2/protocol-common.h
index f8

[PATCH xserver 6/6] tests: Remove obsolete libxservertest.la

2017-01-03 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuilt slightly faster and less verbose.

Prevents 'make -j' from not linking test/tests until it links
test/libxserver.la

In makefile, remove OS_LIB and DIX_LIB to avoid double-inclusion.
Also move the libxorgos.la to satisfy libcommon.la.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 51 +--
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 8c0530130b1a..271719879019 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -10,7 +10,6 @@ RES_SRCS = hashtabletest.c
 tests_CPPFLAGS += -DRES_TESTS
 endif
 endif
-check_LTLIBRARIES = libxservertest.la
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -61,11 +60,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 \
@@ -123,14 +118,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 \
@@ -148,23 +145,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
 
 if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
+tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else
-nodist_libxservertest_la_SOURCES = \
+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 +180,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 \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 4/6] tests: Convert test/ to single binary

2017-01-03 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/.gitignore   | 12 +---
 test/Makefile.am  | 54 ++-
 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/tests-common.h   |  2 ++
 test/tests.c  | 25 
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 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 064e1c5b736f..88b30c9592e4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,19 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+tests_CPPFLAGS=
+
 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
+tests_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 +29,7 @@ SCRIPT_TESTS = \
$(XEPHYR_GLAMOR_TESTS) \
$(NULL)
 
-TESTS = \
-   $(TEST_PROGS) \
+TESTS = tests \
$(SCRIPT_TESTS) \
$(NULL)
 
@@ -42,30 +39,35 @@ TESTS_ENVIRONMENT = \
$(XORG_MALLOC_DEBUG_ENV) \
$(NULL)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS)
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+tests_CPPFLAGS = $(XORG_INCS)
 if XORG
-AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+tests_CPPFLAGS += -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
-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_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 \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +155,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 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#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 86a0c58c6bb0..0387587cb5d1 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 91ee43c46ad9..4cd39bb48073 100644
--- a/test/input.c
+++ b/test/input.c
@@ -43,6 +43,8 @@
 #include "mi.h"
 #include "assert.h"
 
+#include "tests-common.h"
+
 /**
  * In

Timings

2017-01-03 Thread Mihail Konev
In mesurements below, caches were warm (i.e. configure; make; make; touch; time 
make).
Speedups are not purely linking ones, as they include non-recursifying the make.

  CCLD libxservertest.la
real0m2.192s
user0m1.367s
sys 0m0.758s

  CCLD protocol-xchangedevicecontrol
real0m0.682s
user0m0.588s
sys 0m0.079s

  CCLD tests
real0m2.103s
user0m1.508s
sys 0m0.450s

Worst case: make -j12, i.e. 6 physical CPU cores

  Recursive test/:
test/libxservertest.la + test/* + test/xi1/* + test/xi2/* ~=
  2+  0.5   +0.5 +0.5 ~=
3.5

  Speedup:
Recursive test/ - tests ~=
  3.5   -   2   ~=
1.5 sec

make -j4, Xorg-only rebuild with recursive test/, built in-source:

  # touch os/backtrace.c
  # make
  0m11.25s real

make -j4, Xorg-only rebuild with nonrecursive test/, built out-of-source:

  # touch os/backtrace.c
  # make
  0m07.30s real

  Speedup: (11 - 7) = 4 sec = 100% * 4 / 11 = 36%

make -j4, non-DMX, non-KDrive rebuild with recursive test/, built in-source:

  # touch os/backtrace.c
  # make
0m20.34s real

make -j4, non-DMX, non-KDrive rebuild with nonrecursive test/, built 
out-of-source:

  # touch os/backtrace.c
  # make
0m12.66s real # cache too warm?
0m12.65s real # maybe it's srcdir != builddir

  Speedup: (20 - 12) = 8 sec = 100% * 8 / 20 = 40%

make -j4, non-DMX, non-KDrive rebuild with nonrecursive test/, built in-source:

  # touch os/backtrace.c
  # make
0m12.27s real

  Speedup: 40%
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[no subject]

2017-01-03 Thread Mihail Konev
Does not use shell script wrappers as v1 did.
Fixes protocol-xgetselectedevents crash by cancelling wraps.

 configure.ac |   2 -
 test/.gitignore  |  12 +--
 test/Makefile.am | 157 +--
 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/tests-common.c  |  33 +++
 test/tests-common.h  |  11 +++
 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/xkb.c   |   4 +-
 test/xtest.c |   4 +-
 36 files changed, 354 insertions(+), 328 deletions(-)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] tests: Fix declaration warning in simple-xinit.c

2017-01-03 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
 test/simple-xinit.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/test/simple-xinit.c b/test/simple-xinit.c
index 89189a609c19..92a38d4b5319 100644
--- a/test/simple-xinit.c
+++ b/test/simple-xinit.c
@@ -25,6 +25,11 @@
 #include 
 #endif
 
+/* for asprintf */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #include 
 #include 
 #include 
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2-2 xserver 3/6] tests: Convert test/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
Fix v2's simple-xinit warning about asprintf declaration
(AM_CFLAGS vs. tests_CFLAGS).

 test/.gitignore   | 12 +---
 test/Makefile.am  | 51 +++
 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/tests-common.h   |  2 ++
 test/tests.c  | 25 +
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 101 insertions(+), 46 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 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 064e1c5b736f..4d38a219d0ef 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,19 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+tests_CPPFLAGS=
+
 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
+tests_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 +29,7 @@ SCRIPT_TESTS = \
$(XEPHYR_GLAMOR_TESTS) \
$(NULL)
 
-TESTS = \
-   $(TEST_PROGS) \
+TESTS = tests \
$(SCRIPT_TESTS) \
$(NULL)
 
@@ -44,28 +41,34 @@ TESTS_ENVIRONMENT = \
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = $(XORG_INCS)
+
 if XORG
-AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+tests_CPPFLAGS += -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
-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_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 \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +156,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 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#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 86a0c58c6bb0..0387587cb5d1 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 91ee43c46ad9..4cd39bb48073 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

[PATCH v3 xserver 0/6] tests: Use single binary

2017-01-04 Thread Mihail Konev
v3: fix build of v2-2 (and maybe v2 too)

Mihail Konev (6):
  tests: Refactor wraps into protocol-common.c
  tests: Convert test/xi1/ to single binary
  tests: Convert test/xi2/ to single binary
  tests: Convert test/ to single binary
  tests: Move test/{xi1,xi2}/tests to test/
  tests: Remove obsolete libxservertest.la

 configure.ac |   2 -
 test/.gitignore  |  12 +--
 test/Makefile.am | 157 +--
 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/tests-common.c  |  33 +++
 test/tests-common.h  |  11 +++
 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/xkb.c   |   4 +-
 test/xtest.c |   4 +-
 36 files changed, 355 insertions(+), 327 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.c
 create mode 100644 test/tests.h
 delete mode 100644 test/xi1/.gitignore
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi2/.gitignore
 delete mode 100644 test/xi2/Makefile.am

-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v3 xserver 4/6] tests: Convert test/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/.gitignore   | 12 +---
 test/Makefile.am  | 51 ++-
 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/tests-common.h   |  2 ++
 test/tests.c  | 25 +
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 100 insertions(+), 47 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 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 064e1c5b736f..8fdf08c3db96 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,21 +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_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 \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +154,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 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#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 86a0c58c6bb0..0387587cb5d1 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 91ee43c46ad9..4cd39bb48073 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 @@ di

[PATCH v3 xserver 3/6] tests: Convert test/xi2/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests.h| 19 
 test/xi2/.gitignore | 12 +
 test/xi2/Makefile.am| 83 +
 test/xi2/protocol-common.c  |  4 ++
 test/xi2/protocol-eventconvert.c|  2 +-
 test/xi2/protocol-xigetclientpointer.c  |  2 +-
 test/xi2/protocol-xigetselectedevents.c |  4 +-
 test/xi2/protocol-xipassivegrabdevice.c |  9 +++-
 test/xi2/protocol-xiquerydevice.c   |  2 +-
 test/xi2/protocol-xiquerypointer.c  |  2 +-
 test/xi2/protocol-xiqueryversion.c  |  2 +-
 test/xi2/protocol-xiselectevents.c  |  9 +++-
 test/xi2/protocol-xisetclientpointer.c  |  2 +-
 test/xi2/protocol-xiwarppointer.c   |  2 +-
 test/xi2/tests.c| 21 +
 test/xi2/xi2.c  |  2 +-
 16 files changed, 104 insertions(+), 73 deletions(-)
 create mode 100644 test/xi2/tests.c

diff --git a/test/tests.h b/test/tests.h
index 8a42aa0da592..0b673ee7ae79 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -3,5 +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 817aa7b6b83b..2b29f27645f8 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 46768fb29ad4..a7f9831a93cd 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_LDFLAGS= -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_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
-protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-xi2_LDFLAGS=$(COMMON_LDFLAGS)
+tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+-Wl,-wrap,dixLookupWindow

[PATCH v3 xserver 6/6] tests: Remove obsolete libxservertest.la

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuilt slightly faster and less verbose.

Prevents 'make -j' from not linking test/tests until it links
test/libxserver.la

In makefile, remove OS_LIB and DIX_LIB to avoid double-inclusion.
Also move the libxorgos.la to satisfy libcommon.la.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 51 +--
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 6178a2fb0166..70e33eaa7bd7 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
 
@@ -63,11 +62,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 \
@@ -125,14 +120,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 \
@@ -150,23 +147,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
 
 if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
+tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else
-nodist_libxservertest_la_SOURCES = \
+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 \
@@ -184,44 +182,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 \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v3 xserver 1/6] tests: Refactor wraps into protocol-common.c

2017-01-04 Thread Mihail Konev
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.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..813241c0aeed 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_LDFLAGS= -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_LDFLAGS) -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 8e638b218f72..64d2ca29bb95 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 bfddfef133fd..6b9679872b48 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_LDFLAGS= -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_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LDFLAGS)
 
 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_xiquerypoint

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

2017-01-04 Thread Mihail Konev
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 
---
 configure.ac |  2 --
 test/Makefile.am | 63 +---
 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, 76 insertions(+), 139 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 8fdf08c3db96..6178a2fb0166 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,26 @@ 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/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
@@ -68,6 +84,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 +144,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(protoco

[PATCH v3 xserver 2/6] tests: Convert test/xi1/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests-common.c  | 33 
 test/tests-common.h  |  9 
 test/tests.h |  7 ++
 test/xi1/.gitignore  |  2 +-
 test/xi1/Makefile.am | 37 
 test/xi1/protocol-xchangedevicecontrol.c |  2 +-
 test/xi1/tests.c | 11 ++
 test/xi2/Makefile.am |  5 -
 test/xi2/protocol-common.h   |  2 ++
 9 files changed, 91 insertions(+), 17 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.h
 create mode 100644 test/xi1/tests.c

diff --git a/test/tests-common.c b/test/tests-common.c
new file mode 100644
index ..686852827765
--- /dev/null
+++ b/test/tests-common.c
@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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 ..b02f746f6f56
--- /dev/null
+++ b/test/tests-common.h
@@ -0,0 +1,9 @@
+#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 ..8a42aa0da592
--- /dev/null
+++ b/test/tests.h
@@ -0,0 +1,7 @@
+#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 c1b9024ee958..2b29f27645f8 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 813241c0aeed..7a054dd80966 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_LDFLAGS= -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_LDFLAGS) -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 64d2ca29bb95..57a15c4076f5 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 ..df4638dc98ab
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,11 @@
+#include 
+#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/Mak

Re: Timings

2017-01-06 Thread Mihail Konev
On Wed, Jan 04, 2017 at 11:37:51AM +0500, Mihail Konev wrote:
> In mesurements below, caches were warm (i.e. configure; make; make; touch; 
> time make).

Mistake - I confused ccache with drive cache; the latter is completely 
irrelevant.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v4 xserver 2/6] tests: Convert test/xi1/ to single binary

2017-01-12 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests-common.c  | 33 
 test/tests-common.h  |  9 
 test/tests.h |  7 ++
 test/xi1/.gitignore  |  2 +-
 test/xi1/Makefile.am | 37 
 test/xi1/protocol-xchangedevicecontrol.c |  2 +-
 test/xi1/tests.c | 11 ++
 test/xi2/Makefile.am |  5 -
 test/xi2/protocol-common.h   |  2 ++
 9 files changed, 91 insertions(+), 17 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.h
 create mode 100644 test/xi1/tests.c

diff --git a/test/tests-common.c b/test/tests-common.c
new file mode 100644
index ..686852827765
--- /dev/null
+++ b/test/tests-common.c
@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#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 ..b02f746f6f56
--- /dev/null
+++ b/test/tests-common.h
@@ -0,0 +1,9 @@
+#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 ..8a42aa0da592
--- /dev/null
+++ b/test/tests.h
@@ -0,0 +1,7 @@
+#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 c1b9024ee958..2b29f27645f8 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 b7060e7d48d8..7a054dd80966 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 64d2ca29bb95..57a15c4076f5 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 ..df4638dc98ab
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,11 @@
+#include 
+#include "tests.h"
+#include "tests-common.h"
+
+int
+main(int argc, char **argv)
+{
+run_test(protocol_xchangedevicecontrol_test);
+
+return 0;
+}
diff --git 

[PATCH v4 xserver 1/6] tests: Refactor wraps into protocol-common.c

2017-01-12 Thread Mihail Konev
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.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..b7060e7d48d8 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 8e638b218f72..64d2ca29bb95 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 bfddfef133fd..9231e92db96c 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-xigetcl

[PATCH v4 xserver 6/6] tests: Remove obsolete libxservertest.la

2017-01-12 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuilt slightly faster and less verbose.

Prevents 'make -j' from not linking test/tests until it links
test/libxserver.la

In makefile, remove OS_LIB and DIX_LIB to avoid double-inclusion.
Also move the libxorgos.la to satisfy libcommon.la.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 51 +--
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 77e5fee67ca2..79b3f1c0a19b 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,23 +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
 
 if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
+tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else
-nodist_libxservertest_la_SOURCES = \
+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 \
@@ -186,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 \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v4 xserver 4/6] tests: Convert test/ to single binary

2017-01-12 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/.gitignore   | 12 +---
 test/Makefile.am  | 51 ++-
 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/tests-common.h   |  2 ++
 test/tests.c  | 25 +
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 100 insertions(+), 47 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 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 064e1c5b736f..8fdf08c3db96 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,21 +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_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 \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +154,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 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#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 86a0c58c6bb0..0387587cb5d1 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 91ee43c46ad9..4cd39bb48073 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 @@ di

[PATCH v4 xserver 0/6] Use single test binary

2017-01-12 Thread Mihail Konev
v3: Rename 'AM_CPPFLAGS +=' -> test_CPPFLAGS (fixes build of 2/6, breaks 5/6).

v4: Rename COMMON_LDFLAGS -> COMMON_LD_FLAGS (fixes automake warning).
Add 'test_CPPFLAGS += AM_CPPFLAGS' (fixes 5/6 build).

Mihail Konev (6):
  tests: Refactor wraps into protocol-common.c
  tests: Convert test/xi1/ to single binary
  tests: Convert test/xi2/ to single binary
  tests: Convert test/ to single binary
  tests: Move test/{xi1,xi2}/tests to test/
  tests: Remove obsolete libxservertest.la

 configure.ac |   2 -
 test/.gitignore  |  12 +--
 test/Makefile.am | 163 +--
 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/tests-common.c  |  33 +++
 test/tests-common.h  |  11 +++
 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/xkb.c   |   4 +-
 test/xtest.c |   4 +-
 36 files changed, 359 insertions(+), 329 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.c
 create mode 100644 test/tests.h
 delete mode 100644 test/xi1/.gitignore
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi2/.gitignore
 delete mode 100644 test/xi2/Makefile.am

-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v4 xserver 3/6] tests: Convert test/xi2/ to single binary

2017-01-12 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests.h| 19 
 test/xi2/.gitignore | 12 +
 test/xi2/Makefile.am| 83 +
 test/xi2/protocol-common.c  |  4 ++
 test/xi2/protocol-eventconvert.c|  2 +-
 test/xi2/protocol-xigetclientpointer.c  |  2 +-
 test/xi2/protocol-xigetselectedevents.c |  4 +-
 test/xi2/protocol-xipassivegrabdevice.c |  9 +++-
 test/xi2/protocol-xiquerydevice.c   |  2 +-
 test/xi2/protocol-xiquerypointer.c  |  2 +-
 test/xi2/protocol-xiqueryversion.c  |  2 +-
 test/xi2/protocol-xiselectevents.c  |  9 +++-
 test/xi2/protocol-xisetclientpointer.c  |  2 +-
 test/xi2/protocol-xiwarppointer.c   |  2 +-
 test/xi2/tests.c| 21 +
 test/xi2/xi2.c  |  2 +-
 16 files changed, 104 insertions(+), 73 deletions(-)
 create mode 100644 test/xi2/tests.c

diff --git a/test/tests.h b/test/tests.h
index 8a42aa0da592..0b673ee7ae79 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -3,5 +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 817aa7b6b83b..2b29f27645f8 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 49aaebb36e4b..a7f9831a93cd 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

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

2017-01-12 Thread Mihail Konev
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 
---
 configure.ac |  2 --
 test/Makefile.am | 65 +---
 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, 78 insertions(+), 139 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 8fdf08c3db96..77e5fee67ca2 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 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)

Re: [PATCH xserver 3/6] tests: Convert test/xi2/ to single binary

2017-01-12 Thread Mihail Konev
On Mon, Jan 09, 2017 at 01:29:17PM +1000, Peter Hutterer wrote:
> > +#ifndef INSIDE_PROTOCOL_COMMON
> > +
> > +extern int enable_XISetEventMask_wrap;
> > +extern int enable_GrabButton_wrap;
> > +
> > +#endif /* INSIDE_PROTOCOL_COMMON */
> 
> something tells me this woudl be nicer solved by just having a header that
> applies to all tests vs a header that applies to the protocol-common bits
> only. Would be nice as follow-up.
> 
> > +#define INSIDE_PROTOCOL_COMMON
> >  #include "protocol-common.h"
> 
> this seems odd: we have a #define here but the only thing it does is declare
> two externs at the bottom of the header file. Can't we just move those
> extern int here? Skips the ifdefs and makes the code cleaner.

But this is a negated define, and would be:

  protocol-common.h -> protocol-common-priv.h
  protocol-common.h:
#include "protocol-common-priv.h"
extern int
extern int

> 
> Unfortunately, this breaks make check.
> 
> _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
> _XSERVTransMakeAllCOTSServerListeners: server already running
> XTEST_DIR must be set to the directory of the xtest repository.
> SKIP scripts/xephyr-glamor-piglit.sh (exit status: 77)
> 
> 1/6 still passes it but 2/6 doesn't build, so it's one of those two patches.
> Please fix this and re-send the series (with a v3 subjectprefix). Test suite
> failures really shouldn't happen during a test suite refactoring, that's the
> one time all the attention is on the test suite ;)
> 
> Cheers,
>Peter
> 

It looks like xvfb-piglit.sh misses PIGLIT_DIR and XTEST_DIR in
the environment, which must be provided to make by user.
However, I didn't tested the scripts, as:

On c49e820f796c27cbd2907709576a3fb672acd453 (introduces 
test/scripts/xephyr-glamor-piglit.sh),
recent b5dffbbac193aa640ffcfa0a431c21b862854e53,
and v4 3/6 (after 'make -C test clean').
In terminal window:

  ./configure --enable-xvfb --enable-kdrive --enable-xephyr --enable-glamor
  make
  make check
  # ok; 2 tests were SKIPped:
  #  test/scripts/xvfb-piglit.sh
  #  test/scripts/xephyr-glamor-piglit.sh

  cd ~/piglit
  make
  # ok

  cd ~/xts
  make
  ---
  make[3]: Entering directory '~/xts/xts5/fonts'
  bdftopcf -t -o xtfont4.pcf xtfont4.bdf
  BDF Error on line 32: character 'ascii001' has out of range width, -8
  bdftopcf: bdf input, xtfont4.bdf, corrupt
  Makefile:767: recipe for target 'xtfont4.pcf' failed
  ...
  # Any autotools-ed version of bdftopcf fails on the file ...
  # yet xtfont4.bdf never changed.

  cd ~/xserver
  PIGLIT_DIR=$HOME/piglit XTEST_DIR=$HOME/xts make check
  --
  make[5]: Entering directory '~/xserver/test'
  PASS: list
  PASS: ...
  PASS: input
  FAIL: scripts/xvfb-piglit.sh
  # Freezes. ^C
  make[5]: *** Deleting file 'scripts/xephyr-glamor-piglit.sh.log'
  ...
  --
  cat test/scripts/xvfb-piglit.sh.log
  --
  _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
  _XSERVTransMakeAllCOTSServerListeners: server already running
  [001/475] skip: 1 |^
  [002/475] skip: 2 /  Xvfb needs an unused :DISPLAY argument
   (or to be run without another X).
   Adding it into xvfb-piglit.sh makes 
these two
   lines disappear; but changes nothing else
   (at least on recent master).

On deae9c7e846e244e5d62b2dcfb6663fde0e12cbb (introduces test/scripts/):

   make check
   # ok; 1 test was skipped

   PIGLIT_DIR=$HOME/piglit XTEST_DIR=$HOME/xts make check
   # scripts/xvfb-piglit.sh fails
   ---
   xauth:  file ~/.serverauth.19121 does not exist
   xinit: XFree86_VT property unexpectedly has 0 items instead of 1
   [001/473] skip: 1 |
   [002/473] skip: 2 /
   ...

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: Avoid libtool message

2017-01-12 Thread Mihail Konev
On Thu, Jan 12, 2017 at 01:36:56PM -0500, Adam Jackson wrote:
> On Tue, 2017-01-03 at 23:40 +0500, Mihail Konev wrote:
> > The "copying selected object files" message appears as some source
> > files have the same name, and some objects are included twice.
> 
> remote: E: failed to find patch for rev 
> 45546219e117c1b6129fd9f9be2ce5b592486feb.
> remote: I: 0 patch(es) updated to state Accepted.
> To ssh://git.freedesktop.org/git/xorg/xserver
>785053d..4554621  master -> master
> 
> - ajx

v4 6/6 (remove libxservertest.la) makes this unnecessary.
So must have been doing v1 10/10.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] tests: Fix LDADD

2017-01-13 Thread Mihail Konev
704a867 tries to preserve libxservertest_la_LIBADD violations,
but it breaks some use cases.

Follow the automake manual.

Buglink: https://lists.x.org/archives/xorg-devel/2017-January/052320.html
Reported-by: Michel Dänzer 
Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..409e010b55f9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -55,6 +55,9 @@ tests_CPPFLAGS += $(AM_CPPFLAGS)
 endif
 
 tests_LDFLAGS = \
+   $(XORG_SYS_LIBS) \
+   $(XSERVER_SYS_LIBS) \
+   $(GLX_SYS_LIBS) \
-Wl,-wrap,dixLookupWindow \
-Wl,-wrap,dixLookupClient \
-Wl,-wrap,WriteToClient \
@@ -64,8 +67,6 @@ tests_LDFLAGS = \
-Wl,-wrap,GrabButton \
$()
 
-tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
 tests_SOURCES = \
 tests-common.c \
 fixes.c \
@@ -221,7 +222,6 @@ endif
 
 endif !XORG
 
-tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 xserver] tests: Fix DEPENDENCIES typo

2017-01-13 Thread Mihail Konev
704a867 preserves DEPENDENCIES = LIBADD,
but it breaks user-supplied -l/-L.
Remove the assignment, as automake already does this.

Buglink: https://lists.x.org/archives/xorg-devel/2017-January/052320.html
Reported-by: Michel Dänzer 
Signed-off-by: Mihail Konev 
---
v2: Fix misinterpretation of LDADD documentation.

 test/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..b850dd8a7ce7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -221,7 +221,6 @@ endif
 
 endif !XORG
 
-tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v3 xserver] tests: Fix typo

2017-01-13 Thread Mihail Konev
Remove redundrant/incorrect automake assignment.

Buglink: https://lists.x.org/archives/xorg-devel/2017-January/052320.html
Reported-by: Michel Dänzer 
Signed-off-by: Mihail Konev 
---
v3: reword

 test/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..b850dd8a7ce7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -221,7 +221,6 @@ endif
 
 endif !XORG
 
-tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v5 xserver 7/6] tests: fix --disable-xorg build

2017-01-14 Thread Mihail Konev
Commit ead5064581665ff40c177dd1b447949f1420e209 missed that xi1/
and xi2/ were conditioned on XORG, and made xfree86-only tests to be
built unconditionally.
Ifdef the tests and split tests_SOURCES.

Commit 704a867f8fb7652a8b7d5569bbe44e188457db4e missed that when
XORG is false, libxservertest.la isn't linked into anything.
However, before putting them into tests_LDADD, its static libraries
likely need to be reordered for linking not to fail.
Remove the former libxservertest.la for !XORG, as its build was only
triggered by 'make check'.
XSERVER_LIBS were depending on it; remove them too.

Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 missed that -wrap
arguments to 'ld' could only be present when HAVE_LD_WRAP is true.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 107 ++-
 test/tests.c |   9 ++---
 2 files changed, 31 insertions(+), 85 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..33ac65c37084 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -7,6 +7,7 @@ tests_CPPFLAGS=
 CLEANFILES=
 
 if XORG
+AM_CPPFLAGS += -DXORG_TESTS
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 if RES
@@ -54,6 +55,16 @@ AM_CPPFLAGS += \
 tests_CPPFLAGS += $(AM_CPPFLAGS)
 endif
 
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
+
+tests_SOURCES = \
+tests-common.c \
+tests.c \
+list.c \
+string.c
+
+if HAVE_LD_WRAP
+
 tests_LDFLAGS = \
-Wl,-wrap,dixLookupWindow \
-Wl,-wrap,dixLookupClient \
@@ -64,27 +75,8 @@ tests_LDFLAGS = \
-Wl,-wrap,GrabButton \
$()
 
-tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
-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
-
-if HAVE_LD_WRAP
-
+if XORG
 tests_CPPFLAGS += -DLDWRAP_TESTS
-
 tests_SOURCES += \
xi1/protocol-xchangedevicecontrol.c \
xi2/protocol-common.c \
@@ -99,6 +91,7 @@ tests_SOURCES += \
xi2/protocol-xiwarppointer.c \
xi2/protocol-eventconvert.c \
xi2/xi2.c
+endif
 
 else !HAVE_LD_WRAP
 
@@ -122,9 +115,20 @@ xi2-tests:
 
 endif !HAVE_LD_WRAP
 
+if XORG
+
 tests_LDADD += $(XSERVER_LIBS)
 
-if XORG
+tests_SOURCES += \
+$(RES_SRCS) \
+fixes.c \
+input.c \
+misc.c \
+signal-logging.c \
+touch.c \
+xfree86.c \
+test_xkb.c \
+xtest.c
 
 nodist_tests_SOURCES = sdksyms.c
 
@@ -160,66 +164,7 @@ if DRI3
 tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else !XORG
-
-nodist_tests_SOURCES = \
-ddxstubs.c \
-$(top_srcdir)/mi/miinitext.c
-
-tests_LDADD += \
-$(top_builddir)/damageext/libdamageext.la \
-$(top_builddir)/fb/libfb.la \
-$(top_builddir)/fb/libwfb.la \
-$(top_builddir)/miext/damage/libdamage.la \
-$(top_builddir)/miext/sync/libsync.la \
-$(top_builddir)/randr/librandr.la \
-$(top_builddir)/render/librender.la \
-$(top_builddir)/Xext/libXext.la \
-$(top_builddir)/Xext/libXextdpmsstubs.la \
-$(top_builddir)/Xext/libXvidmode.la \
-$(top_builddir)/Xi/libXi.la \
-$(top_builddir)/Xi/libXistubs.la \
-$(top_builddir)/xfixes/libxfixes.la \
-$(top_builddir)/xkb/libxkb.la \
-$(top_builddir)/xkb/libxkbstubs.la
-
-if COMPOSITE
-tests_LDADD += \
-$(top_builddir)/composite/libcomposite.la
-endif
-
-if DBE
-tests_LDADD += \
-$(top_builddir)/dbe/libdbe.la
-endif
-
-if GLX
-tests_LDADD += \
-$(top_builddir)/glx/libglx.la
-endif
-
-if RECORD
-tests_LDADD += \
-$(top_builddir)/record/librecord.la
-endif
-
-if DRI3
-tests_LDADD += \
-$(top_builddir)/dri3/libdri3.la
-endif
-
-if XQUARTZ
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-tests_LDADD += -lXplugin
-endif
-
-if XWIN_MULTIWINDOWEXTWM
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-endif
-
-endif !XORG
+endif XORG
 
 tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..45b390af29fc 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,21 +5,22 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
+run_test(list_test);
+run_test(string_test);
 
+#if XORG_TESTS
+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(st

Re: [PATCH xserver] tests: link against libos too

2017-01-14 Thread Mihail Konev
Thanks and sorry for late response.
With dtrace being present, this breaks the build.
Conditioned patch attached.
>From 226055e126e27e099c151899d09603e5ad29e50f Mon Sep 17 00:00:00 2001
From: Giuseppe Bilotta 
Date: Fri, 13 Jan 2017 18:44:01 +0100
Subject: [PATCH xserver] tests: Fix without-dtrace build

Signed-off-by: Giuseppe Bilotta 
Reviewed-by: Mihail Konev 
Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 4 
 1 file changed, 4 insertions(+)

diff --git a/test/Makefile.am b/test/Makefile.am
index 33ac65c37084..6a92946e41d4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -146,6 +146,10 @@ tests_LDADD += \
 $(top_builddir)/Xext/libXvidmode.la \
 @XORG_LIBS@
 
+if !SPECIAL_DTRACE_OBJECTS
+tests_LDADD += $(top_builddir)/os/libos.la
+endif
+
 BUILT_SOURCES = sdksyms.c
 CLEANFILES += sdksyms.c
 
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 3/3] tests: Remove what was libxservertest.la for !XORG

2017-01-16 Thread Mihail Konev
Before 704a867f8fb7652a8b7d5569bbe44e188457db4e, when XORG is false,
libxservertest.la was not ever linked and only built by 'make check'.

Remove it (and its XSERVER_LIBS dependency) to fix the build errors
likely caused by ordering of its libraries.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 66 +++-
 1 file changed, 3 insertions(+), 63 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index d56c8fe50515..06e7a382a614 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -126,8 +126,6 @@ xi2-tests:
 
 endif !HAVE_LD_WRAP
 
-tests_LDADD += $(XSERVER_LIBS)
-
 if XORG
 
 nodist_tests_SOURCES = sdksyms.c
@@ -144,7 +142,8 @@ tests_LDADD += \
 $(top_builddir)/hw/xfree86/i2c/libi2c.la \
 $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
 $(top_builddir)/Xext/libXvidmode.la \
-@XORG_LIBS@
+$(XSERVER_LIBS) \
+$(XORG_LIBS)
 
 BUILT_SOURCES = sdksyms.c
 CLEANFILES += sdksyms.c
@@ -164,66 +163,7 @@ if DRI3
 tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else !XORG
-
-nodist_tests_SOURCES = \
-ddxstubs.c \
-$(top_srcdir)/mi/miinitext.c
-
-tests_LDADD += \
-$(top_builddir)/damageext/libdamageext.la \
-$(top_builddir)/fb/libfb.la \
-$(top_builddir)/fb/libwfb.la \
-$(top_builddir)/miext/damage/libdamage.la \
-$(top_builddir)/miext/sync/libsync.la \
-$(top_builddir)/randr/librandr.la \
-$(top_builddir)/render/librender.la \
-$(top_builddir)/Xext/libXext.la \
-$(top_builddir)/Xext/libXextdpmsstubs.la \
-$(top_builddir)/Xext/libXvidmode.la \
-$(top_builddir)/Xi/libXi.la \
-$(top_builddir)/Xi/libXistubs.la \
-$(top_builddir)/xfixes/libxfixes.la \
-$(top_builddir)/xkb/libxkb.la \
-$(top_builddir)/xkb/libxkbstubs.la
-
-if COMPOSITE
-tests_LDADD += \
-$(top_builddir)/composite/libcomposite.la
-endif
-
-if DBE
-tests_LDADD += \
-$(top_builddir)/dbe/libdbe.la
-endif
-
-if GLX
-tests_LDADD += \
-$(top_builddir)/glx/libglx.la
-endif
-
-if RECORD
-tests_LDADD += \
-$(top_builddir)/record/librecord.la
-endif
-
-if DRI3
-tests_LDADD += \
-$(top_builddir)/dri3/libdri3.la
-endif
-
-if XQUARTZ
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-tests_LDADD += -lXplugin
-endif
-
-if XWIN_MULTIWINDOWEXTWM
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-endif
-
-endif !XORG
+endif XORG
 
 tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] tests: fix guards for ld -wrap

2017-01-16 Thread Mihail Konev
Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 moved -wrap out of
HAVE_LD_WRAP, which made the build fail if linker does not support
the flag.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..8caec21b6415 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
xi2/protocol-eventconvert.c \
xi2/xi2.c
 
+tests_LDFLAGS = \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,dixLookupClient \
+   -Wl,-wrap,WriteToClient \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,XISetEventMask \
+   -Wl,-wrap,AddResource \
+   -Wl,-wrap,GrabButton \
+   $()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 0/3] tests: fixes for non-xfree86 build

2017-01-16 Thread Mihail Konev
Mihail Konev (3):
  tests: Fix guards for ld -wrap
  tests: Fix guards for xfree86 tests
  tests: Remove what was libxservertest.la for !XORG

 test/Makefile.am | 126 ---
 test/tests.c |  17 
 2 files changed, 45 insertions(+), 98 deletions(-)

-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/3] tests: fix guards for xfree86 tests

2017-01-16 Thread Mihail Konev
Commit ead5064581665ff40c177dd1b447949f1420e209 missed that
xi1/ and xi2/ were conditioned on XORG, making them built
unconditionally.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 40 ++--
 test/tests.c | 17 ++---
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 8caec21b6415..d56c8fe50515 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -42,6 +39,7 @@ TESTS_ENVIRONMENT = \
$(NULL)
 
 if XORG
+
 AM_CPPFLAGS += \
-I$(srcdir)/xi1 \
-I$(srcdir)/xi2 \
@@ -52,29 +50,34 @@ AM_CPPFLAGS += \
-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_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
-tests_SOURCES = \
-tests-common.c \
+# Tests that require at least some DDX functions in order to fully link
+# For now, requires xf86 ddx, could be adjusted to use another
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
+
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
xi1/protocol-xchangedevicecontrol.c \
xi2/protocol-common.c \
@@ -99,6 +102,7 @@ tests_LDFLAGS = \
-Wl,-wrap,AddResource \
-Wl,-wrap,GrabButton \
$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/3] tests: Fix guards for xfree86 tests

2017-01-16 Thread Mihail Konev
Commit ead5064581665ff40c177dd1b447949f1420e209 missed that most of
tests are xfree86-specific, making them being built unconditionally.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 40 ++--
 test/tests.c | 17 ++---
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 8caec21b6415..d56c8fe50515 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -42,6 +39,7 @@ TESTS_ENVIRONMENT = \
$(NULL)
 
 if XORG
+
 AM_CPPFLAGS += \
-I$(srcdir)/xi1 \
-I$(srcdir)/xi2 \
@@ -52,29 +50,34 @@ AM_CPPFLAGS += \
-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_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
-tests_SOURCES = \
-tests-common.c \
+# Tests that require at least some DDX functions in order to fully link
+# For now, requires xf86 ddx, could be adjusted to use another
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
+
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
xi1/protocol-xchangedevicecontrol.c \
xi2/protocol-common.c \
@@ -99,6 +102,7 @@ tests_LDFLAGS = \
-Wl,-wrap,AddResource \
-Wl,-wrap,GrabButton \
$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] tests: Fix guards for ld -wrap

2017-01-16 Thread Mihail Konev
Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 moved -wrap out of
HAVE_LD_WRAP, which made the build fail if linker does not support
the flag.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..8caec21b6415 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
xi2/protocol-eventconvert.c \
xi2/xi2.c
 
+tests_LDFLAGS = \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,dixLookupClient \
+   -Wl,-wrap,WriteToClient \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,XISetEventMask \
+   -Wl,-wrap,AddResource \
+   -Wl,-wrap,GrabButton \
+   $()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] tests: fix guards for ld -wrap

2017-01-16 Thread Mihail Konev
Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 moved -wrap out of
HAVE_LD_WRAP, which made the build fail if linker does not support
the flag.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 729402f104ce..8caec21b6415 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
xi2/protocol-eventconvert.c \
xi2/xi2.c
 
+tests_LDFLAGS = \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,dixLookupClient \
+   -Wl,-wrap,WriteToClient \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,XISetEventMask \
+   -Wl,-wrap,AddResource \
+   -Wl,-wrap,GrabButton \
+   $()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 3/3] tests: Remove what was libxservertest.la for !XORG

2017-01-16 Thread Mihail Konev
Before 704a867f8fb7652a8b7d5569bbe44e188457db4e, when XORG is false,
libxservertest.la was not ever linked and only built by 'make check'.

Remove it (and its XSERVER_LIBS dependency) to fix the build errors
likely caused by ordering of its libraries.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 66 +++-
 1 file changed, 3 insertions(+), 63 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index d56c8fe50515..06e7a382a614 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -126,8 +126,6 @@ xi2-tests:
 
 endif !HAVE_LD_WRAP
 
-tests_LDADD += $(XSERVER_LIBS)
-
 if XORG
 
 nodist_tests_SOURCES = sdksyms.c
@@ -144,7 +142,8 @@ tests_LDADD += \
 $(top_builddir)/hw/xfree86/i2c/libi2c.la \
 $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
 $(top_builddir)/Xext/libXvidmode.la \
-@XORG_LIBS@
+$(XSERVER_LIBS) \
+$(XORG_LIBS)
 
 BUILT_SOURCES = sdksyms.c
 CLEANFILES += sdksyms.c
@@ -164,66 +163,7 @@ if DRI3
 tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else !XORG
-
-nodist_tests_SOURCES = \
-ddxstubs.c \
-$(top_srcdir)/mi/miinitext.c
-
-tests_LDADD += \
-$(top_builddir)/damageext/libdamageext.la \
-$(top_builddir)/fb/libfb.la \
-$(top_builddir)/fb/libwfb.la \
-$(top_builddir)/miext/damage/libdamage.la \
-$(top_builddir)/miext/sync/libsync.la \
-$(top_builddir)/randr/librandr.la \
-$(top_builddir)/render/librender.la \
-$(top_builddir)/Xext/libXext.la \
-$(top_builddir)/Xext/libXextdpmsstubs.la \
-$(top_builddir)/Xext/libXvidmode.la \
-$(top_builddir)/Xi/libXi.la \
-$(top_builddir)/Xi/libXistubs.la \
-$(top_builddir)/xfixes/libxfixes.la \
-$(top_builddir)/xkb/libxkb.la \
-$(top_builddir)/xkb/libxkbstubs.la
-
-if COMPOSITE
-tests_LDADD += \
-$(top_builddir)/composite/libcomposite.la
-endif
-
-if DBE
-tests_LDADD += \
-$(top_builddir)/dbe/libdbe.la
-endif
-
-if GLX
-tests_LDADD += \
-$(top_builddir)/glx/libglx.la
-endif
-
-if RECORD
-tests_LDADD += \
-$(top_builddir)/record/librecord.la
-endif
-
-if DRI3
-tests_LDADD += \
-$(top_builddir)/dri3/libdri3.la
-endif
-
-if XQUARTZ
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-tests_LDADD += -lXplugin
-endif
-
-if XWIN_MULTIWINDOWEXTWM
-tests_LDADD += \
-$(top_builddir)/miext/rootless/librootless.la
-endif
-
-endif !XORG
+endif XORG
 
 tests_DEPENDENCIES = $(tests_LDADD)
 endif ENABLE_UNIT_TESTS
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 0/3] tests: fixes for non-xfree86 build

2017-01-16 Thread Mihail Konev
Mihail Konev (3):
  tests: Fix guards for ld -wrap
  tests: Fix guards for xfree86 tests
  tests: Remove what was libxservertest.la for !XORG

 test/Makefile.am | 126 ---
 test/tests.c |  17 
 2 files changed, 45 insertions(+), 98 deletions(-)

-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/3] tests: Fix guards for xfree86 tests

2017-01-16 Thread Mihail Konev
Commit ead5064581665ff40c177dd1b447949f1420e209 missed that most of
tests are xfree86-specific, making them being built unconditionally.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 40 ++--
 test/tests.c | 17 ++---
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 8caec21b6415..d56c8fe50515 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -42,6 +39,7 @@ TESTS_ENVIRONMENT = \
$(NULL)
 
 if XORG
+
 AM_CPPFLAGS += \
-I$(srcdir)/xi1 \
-I$(srcdir)/xi2 \
@@ -52,29 +50,34 @@ AM_CPPFLAGS += \
-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_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
-tests_SOURCES = \
-tests-common.c \
+# Tests that require at least some DDX functions in order to fully link
+# For now, requires xf86 ddx, could be adjusted to use another
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
+
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
xi1/protocol-xchangedevicecontrol.c \
xi2/protocol-common.c \
@@ -99,6 +102,7 @@ tests_LDFLAGS = \
-Wl,-wrap,AddResource \
-Wl,-wrap,GrabButton \
$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: shuffle around the linking order to please GNU ld

2017-01-24 Thread Mihail Konev
On Mon, Jan 23, 2017 at 07:15:46PM +0200, Martin Peres wrote:
> Classic GNU ld resolves symbol dependencies only forward, while GOLD
> seems to work regardless of the specified library order.
> 
> I assume that the original author of the changes (just like me), has
> been using GNU ld with GOLD enabled (default on ArchLinux), and did
> not check on older distros like Ubuntu 16.04 which shows the issue.
> 
> Suggested-by: Eero Tamminen 
> Signed-off-by: Martin Peres 
> ---
>  test/Makefile.am | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Should be another libxservertest.la_LIBADD -> tests_LDADD breakage.
(The static library was acting like ld's --begin-group ... --end-group
for all its LIBADD-s).

Reviewed-by: Mihail Konev 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: shuffle around the linking order to please GNU ld

2017-01-25 Thread Mihail Konev
On Wed, Jan 25, 2017 at 09:28:21AM +0500, Mihail Konev wrote:
> On Mon, Jan 23, 2017 at 07:15:46PM +0200, Martin Peres wrote:
> > Classic GNU ld resolves symbol dependencies only forward, while GOLD
> > seems to work regardless of the specified library order.
> > 

> > I assume that the original author of the changes (just like me), has
> > been using GNU ld with GOLD enabled (default on ArchLinux), and did
> > not check on older distros like Ubuntu 16.04 which shows the issue.

Shouldn 't this be _under_ "---" ? :)

> > 
> > Suggested-by: Eero Tamminen 
> > Signed-off-by: Martin Peres 
> > ---
> >  test/Makefile.am | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> 
> Should be another libxservertest.la_LIBADD -> tests_LDADD breakage.
> (The static library was acting like ld's --begin-group ... --end-group
> for all its LIBADD-s).
> 
> Reviewed-by: Mihail Konev 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: shuffle around the linking order to please GNU ld

2017-01-25 Thread Mihail Konev
On Wed, Jan 25, 2017 at 09:28:21AM +0500, Mihail Konev wrote:
> (The static library was acting like ld's --begin-group ... --end-group
> for all its LIBADD-s).

Wrong, this would only apply to .a libraries; but *_SYS_LIBS in question
are all "-l*"-s.

Instead, libtool was remembering the args in the xservertest.la file as
dependencies, then appending them to test/{string,list,...} link command
after the test/.libs/xservertest.a .

As there is nothing now that tells libtool that the former xservertest.la
components depend on the *_SYS_LIBS, moving "-l"-s to the end of ld command
has to be done manually.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v5 xserver 7/6] tests: fix --disable-xorg build

2017-01-30 Thread Mihail Konev
Split and rebased on top of 7617a0a1 version attached.
Fixes build failures occuring when  not  building xfree86 DDX.
Works for XWin ./configure --enable-static=yes
Works for ./configure --disable-xorg
>From 2949b5229dc6557dd12f1b9c12a10b12d7ab97fd Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Mon, 16 Jan 2017 23:55:36 +0500
Subject: [PATCH xserver 1/3] tests: Fix guards for ld -wrap

Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 moved -wrap out of
HAVE_LD_WRAP, which made the build fail if linker does not support
the flag.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..1c1f1da0e31f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 =
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
 	xi2/protocol-eventconvert.c \
 	xi2/xi2.c
 
+tests_LDFLAGS = \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,dixLookupClient \
+	-Wl,-wrap,WriteToClient \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,XISetEventMask \
+	-Wl,-wrap,AddResource \
+	-Wl,-wrap,GrabButton \
+	$()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2


>From 38ea941be10a59565c89e4f312ffcf3d63e4a02c Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:11:03 +0500
Subject: [PATCH xserver 2/3] tests: Fix guards for xfree86 tests

Commit ead5064581665ff40c177dd1b447949f1420e209 missed that most of
tests were xfre86 DDX only, making them being unconditional.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 41 +++--
 test/tests.c | 17 ++---
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 1c1f1da0e31f..e72bfe19bede 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -41,7 +38,13 @@ TESTS_ENVIRONMENT = \
 	$(XORG_MALLOC_DEBUG_ENV) \
 	$(NULL)
 
+tests_LDADD =
+
 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
+
 AM_CPPFLAGS += \
 	-I$(srcdir)/xi1 \
 	-I$(srcdir)/xi2 \
@@ -52,29 +55,30 @@ AM_CPPFLAGS += \
 	-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_LDADD =
 
-tests_SOURCES = \
-tests-common.c \
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
 	xi1/protocol-xchangedevicecontrol.c \
 	xi2/protocol-common.c \
@@ -99,6 +103,7 @@ tests_LDFLAGS = \
 	-Wl,-wrap,AddResource \
 	-Wl,-wrap,GrabButton \
 	$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2


>From 50a6371d3140685f8b22a23d40387f25bc57ab29 Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:36:49 +0500
Subject: [PATCH xserver 3/3] tests: Make

[PATCH v6 xserver] tests: fixes for non-enable-xorg build

2017-01-31 Thread Mihail Konev
v6: Fix commit descriptions - explain failures, and do not
duplicate 'git log -L'.

I could reorder libxservertest.la libraries if it's better to do so,
it just looks time-consuming.
>From 0490a7874b9385f6e076596e0834167357b3e229 Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Mon, 16 Jan 2017 23:55:36 +0500
Subject: [PATCH v6 xserver 1/3] tests: Fix guards for ld -wrap

Fixes XQuartz build.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..1c1f1da0e31f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 =
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
 	xi2/protocol-eventconvert.c \
 	xi2/xi2.c
 
+tests_LDFLAGS = \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,dixLookupClient \
+	-Wl,-wrap,WriteToClient \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,XISetEventMask \
+	-Wl,-wrap,AddResource \
+	-Wl,-wrap,GrabButton \
+	$()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2


>From 0a0310cc0052cf0acdcfaf7cc0292cba07bf8979 Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:11:03 +0500
Subject: [PATCH v6 xserver 2/3] tests: Fix guards for xfree86 tests

Fixes xfree86 includes being pulled in by tests with --disable-xorg
or --enable-xwin.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 41 +++--
 test/tests.c | 17 ++---
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 1c1f1da0e31f..e72bfe19bede 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -41,7 +38,13 @@ TESTS_ENVIRONMENT = \
 	$(XORG_MALLOC_DEBUG_ENV) \
 	$(NULL)
 
+tests_LDADD =
+
 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
+
 AM_CPPFLAGS += \
 	-I$(srcdir)/xi1 \
 	-I$(srcdir)/xi2 \
@@ -52,29 +55,30 @@ AM_CPPFLAGS += \
 	-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_LDADD =
 
-tests_SOURCES = \
-tests-common.c \
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
 	xi1/protocol-xchangedevicecontrol.c \
 	xi2/protocol-common.c \
@@ -99,6 +103,7 @@ tests_LDFLAGS = \
 	-Wl,-wrap,AddResource \
 	-Wl,-wrap,GrabButton \
 	$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2


>From d8f7f71191016ae564a2da501596759109841e5f Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:36:49 +0500
Subject: [PATCH v6 xserver 3/3] tests: Link additional libs only for xfree86

The libxservertest.la encapsulated libraries that could have been
needed by tests.

However, it was only needed for tests spec

Re: [PATCH v7 xserver] tests: fixes for non-enable-xorg build

2017-01-31 Thread Mihail Konev
v7: add regressed-by lines
>From c55acff0f1c9bd67ec67119979589b4982a934d3 Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Mon, 16 Jan 2017 23:55:36 +0500
Subject: [PATCH v7 xserver 1/3] tests: Fix guards for ld -wrap

Fixes XQuartz build.

Regressed-in: 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9
Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..1c1f1da0e31f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,16 +54,6 @@ AM_CPPFLAGS += \
 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 =
 
 tests_SOURCES = \
@@ -100,6 +90,16 @@ tests_SOURCES += \
 	xi2/protocol-eventconvert.c \
 	xi2/xi2.c
 
+tests_LDFLAGS = \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,dixLookupClient \
+	-Wl,-wrap,WriteToClient \
+	-Wl,-wrap,dixLookupWindow \
+	-Wl,-wrap,XISetEventMask \
+	-Wl,-wrap,AddResource \
+	-Wl,-wrap,GrabButton \
+	$()
+
 else !HAVE_LD_WRAP
 
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
-- 
2.9.2


>From f016925934b8bc71d6908b0e18d99b320b10ab2a Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:11:03 +0500
Subject: [PATCH v7 xserver 2/3] tests: Fix guards for xfree86 tests

Fixes xfree86 includes being pulled in by tests with --disable-xorg
or --enable-xwin.

Regressed-in: ead5064581665ff40c177dd1b447949f1420e209
Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 41 +++--
 test/tests.c | 17 ++---
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 1c1f1da0e31f..e72bfe19bede 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,14 +6,11 @@ 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
-if RES
-RES_SRCS = hashtabletest.c
-AM_CPPFLAGS += -DRES_TESTS
-endif
-endif
+tests_SOURCES = \
+tests-common.c \
+list.c \
+string.c \
+tests.c
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -41,7 +38,13 @@ TESTS_ENVIRONMENT = \
 	$(XORG_MALLOC_DEBUG_ENV) \
 	$(NULL)
 
+tests_LDADD =
+
 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
+
 AM_CPPFLAGS += \
 	-I$(srcdir)/xi1 \
 	-I$(srcdir)/xi2 \
@@ -52,29 +55,30 @@ AM_CPPFLAGS += \
 	-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_LDADD =
 
-tests_SOURCES = \
-tests-common.c \
+tests_SOURCES += \
 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
+xtest.c
+tests_CPPFLAGS += -DXORG_TESTS
+
+if RES
+tests_SOURCES += hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
+endif
+
+endif XORG
 
 if HAVE_LD_WRAP
 
 tests_CPPFLAGS += -DLDWRAP_TESTS
 
+if XORG
 tests_SOURCES += \
 	xi1/protocol-xchangedevicecontrol.c \
 	xi2/protocol-common.c \
@@ -99,6 +103,7 @@ tests_LDFLAGS = \
 	-Wl,-wrap,AddResource \
 	-Wl,-wrap,GrabButton \
 	$()
+endif XORG
 
 else !HAVE_LD_WRAP
 
diff --git a/test/tests.c b/test/tests.c
index add51bd4834d..97603822abaf 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -5,22 +5,23 @@
 int
 main(int argc, char **argv)
 {
-run_test(fixes_test);
-
-#ifdef RES_TESTS
-run_test(hashtabletest_test);
-#endif
+run_test(list_test);
+run_test(string_test);
 
+#ifdef XORG_TESTS
+run_test(fixes_test);
 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);
 
+#ifdef RES_TESTS
+run_test(hashtabletest_test);
+#endif
+
 #ifdef LDWRAP_TESTS
 run_test(protocol_xchangedevicecontrol_test);
 
@@ -37,5 +38,7 @@ main(int argc, char **argv)
 run_test(xi2_test);
 #endif
 
+#endif /* XORG_TESTS */
+
 return 0;
 }
-- 
2.9.2


>From 90cbde44c121c762cc8c77cb7bb78228c52f9bab Mon Sep 17 00:00:00 2001
From: Mihail Konev 
Date: Tue, 17 Jan 2017 00:36:49 +0500
Subject: [PATCH v7 xserver 3/3] tests: Link additional libs only for xfree86

The libxservertest.la encapsulated libraries that could have been
needed by tests.

However, it was only needed for tests specific to xfree86 DDX.
For others, the components differed, but

[PATCH xserver] tests: fix library order comment

2017-02-01 Thread Mihail Konev
ld.gold ignores --as-needed
(Observable by: make -C test tests V=1 CFLAGS='-v')

Fixes: b1a69863 ("tests: shuffle around the linking order")
Signed-off-by: Mihail Konev 
---
Ubuntu patches gcc builtin -specs= file (the gcc -dumpspec),
but gold ignores the arg.

 test/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..1cf03c472bc4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -225,8 +225,8 @@ endif
 
 endif !XORG
 
-# GNU LD scans only in one direction, add the following dependencies at the end
-# so as they get picked up by the previously-linked libraries
+# Shared libraries must be added at the end to not be discarded by
+#  gcc -Wl,--as-needed ...
 tests_LDADD += $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 endif ENABLE_UNIT_TESTS
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: fix library order comment

2017-02-01 Thread Mihail Konev
Actually those *_SYS_LIBS are missing from LIBADD's in other makefiles,
and libtool does no reordering.

As the original patch then needs to be reverted anyway,
maybe merging the fix would be noisy.

On Thu, Feb 02, 2017 at 10:04:03AM +0500, Mihail Konev wrote:
> ld.gold ignores --as-needed
> (Observable by: make -C test tests V=1 CFLAGS='-v')
> 
> Fixes: b1a69863 ("tests: shuffle around the linking order")
> Signed-off-by: Mihail Konev 
> ---
> Ubuntu patches gcc builtin -specs= file (the gcc -dumpspec),
> but gold ignores the arg.
> 
>  test/Makefile.am | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/Makefile.am b/test/Makefile.am
> index e7fe587bb858..1cf03c472bc4 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -225,8 +225,8 @@ endif
>  
>  endif !XORG
>  
> -# GNU LD scans only in one direction, add the following dependencies at the 
> end
> -# so as they get picked up by the previously-linked libraries
> +# Shared libraries must be added at the end to not be discarded by
> +#  gcc -Wl,--as-needed ...
>  tests_LDADD += $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
>  
>  endif ENABLE_UNIT_TESTS
> -- 
> 2.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] tests: Add missing -l dependencies

2017-02-02 Thread Mihail Konev
It is worth noting, that it was not ld.bfd that scanning in one
direction, but rather ld.gold ignoring the --as-needed flag
(which, at the time of testing, was built-in into gcc -dumpspecs).

Reproducible-by: make CC=" gcc -Wl,--as-needed "

Corrects: b1a69863 ("tests: shuffle around the linking order")
Signed-off-by: Mihail Konev 
---
Tested with all --enable-... except for:
  werror, strict-compilation, config-hal, xselinux, xwin, xquartz

"make -C test tests" works, only Xdmx fails to link :)

 hw/xfree86/dri/Makefile.am | 2 ++
 miext/sync/Makefile.am | 2 ++
 test/Makefile.am   | 4 
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index ced04ff388fa..9dd79d018af2 100644
--- a/hw/xfree86/dri/Makefile.am
+++ b/hw/xfree86/dri/Makefile.am
@@ -17,4 +17,6 @@ libdri_la_SOURCES = \
sarea.h \
xf86dri.c
 
+libdri_la_LIBADD = $(XORG_SYS_LIBS)
+
 sdk_HEADERS = dri.h sarea.h dristruct.h
diff --git a/miext/sync/Makefile.am b/miext/sync/Makefile.am
index 34961d5ff14b..f9b34899727a 100644
--- a/miext/sync/Makefile.am
+++ b/miext/sync/Makefile.am
@@ -16,6 +16,8 @@ libsync_la_SOURCES =  \
misyncfd.c  \
misyncstr.h
 
+libsync_la_LIBADD = $(XSERVERLIBS_LIBS)
+
 if XSHMFENCE
 libsync_la_SOURCES += $(XSHMFENCE_SRCS)
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..859bd731cabc 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -225,10 +225,6 @@ endif
 
 endif !XORG
 
-# GNU LD scans only in one direction, add the following dependencies at the end
-# so as they get picked up by the previously-linked libraries
-tests_LDADD += $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
 endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: Add missing -l dependencies

2017-02-02 Thread Mihail Konev
On Thu, Feb 02, 2017 at 10:40:07PM +0500, Mihail Konev wrote:
> It is worth noting, that it was not ld.bfd that scanning in one
> direction, but rather ld.gold ignoring the --as-needed flag
> (which, at the time of testing, was built-in into gcc -dumpspecs).
> 
> Reproducible-by: make CC=" gcc -Wl,--as-needed "
> 
> Corrects: b1a69863 ("tests: shuffle around the linking order")
> Signed-off-by: Mihail Konev 
> ---
> Tested with all --enable-... except for:
>   werror, strict-compilation, config-hal, xselinux, xwin, xquartz
> 
> "make -C test tests" works, only Xdmx fails to link :)

Mistake; but "make CC=' gcc -Wl,--as-needed ' -C test tests" works too.

> 
>  hw/xfree86/dri/Makefile.am | 2 ++
>  miext/sync/Makefile.am | 2 ++
>  test/Makefile.am   | 4 
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
> index ced04ff388fa..9dd79d018af2 100644
> --- a/hw/xfree86/dri/Makefile.am
> +++ b/hw/xfree86/dri/Makefile.am
> @@ -17,4 +17,6 @@ libdri_la_SOURCES = \
>   sarea.h \
>   xf86dri.c
>  
> +libdri_la_LIBADD = $(XORG_SYS_LIBS)
> +
>  sdk_HEADERS = dri.h sarea.h dristruct.h
> diff --git a/miext/sync/Makefile.am b/miext/sync/Makefile.am
> index 34961d5ff14b..f9b34899727a 100644
> --- a/miext/sync/Makefile.am
> +++ b/miext/sync/Makefile.am
> @@ -16,6 +16,8 @@ libsync_la_SOURCES =\
>   misyncfd.c  \
>   misyncstr.h
>  
> +libsync_la_LIBADD = $(XSERVERLIBS_LIBS)
> +
>  if XSHMFENCE
>  libsync_la_SOURCES += $(XSHMFENCE_SRCS)
>  endif
> diff --git a/test/Makefile.am b/test/Makefile.am
> index e7fe587bb858..859bd731cabc 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -225,10 +225,6 @@ endif
>  
>  endif !XORG
>  
> -# GNU LD scans only in one direction, add the following dependencies at the 
> end
> -# so as they get picked up by the previously-linked libraries
> -tests_LDADD += $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
> -
>  endif ENABLE_UNIT_TESTS
>  
>  EXTRA_DIST = \
> -- 
> 2.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] tests: Add missing -l dependencies

2017-02-02 Thread Mihail Konev
On Thu, Feb 02, 2017 at 10:40:07PM +0500, Mihail Konev wrote:
> It is worth noting, that it was not ld.bfd that scanning in one
  :) , please edit
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] dmx: fix linking

2017-02-02 Thread Mihail Konev
Regressed-in: bb9128fd ("present: disable page flip")
Signed-off-by: Mihail Konev 
---
Maybe there should be #ifdef-s instead - I only bisected :)

 randr/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/randr/Makefile.am b/randr/Makefile.am
index 90dc9ec9aac4..90aa1289f958 100644
--- a/randr/Makefile.am
+++ b/randr/Makefile.am
@@ -30,3 +30,4 @@ if XINERAMA
 librandr_la_SOURCES += ${XINERAMA_SRCS}
 endif
 
+librandr_la_LIBADD = $(top_builddir)/render/librender.la
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] dmx: fix linking

2017-02-03 Thread Mihail Konev
On Fri, Feb 03, 2017 at 10:08:03AM +0900, Michel Dänzer wrote:
> On 03/02/17 06:57 AM, Mihail Konev wrote:
> > Regressed-in: bb9128fd ("present: disable page flip")
> > Signed-off-by: Mihail Konev 
> > ---
> > Maybe there should be #ifdef-s instead - I only bisected :)
> > 
> >  randr/Makefile.am | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/randr/Makefile.am b/randr/Makefile.am
> > index 90dc9ec9aac4..90aa1289f958 100644
> > --- a/randr/Makefile.am
> > +++ b/randr/Makefile.am
> > @@ -30,3 +30,4 @@ if XINERAMA
> >  librandr_la_SOURCES += ${XINERAMA_SRCS}
> >  endif
> >  
> > +librandr_la_LIBADD = $(top_builddir)/render/librender.la
> > 
> 
> This looks weird. bb9128fd added a RRHasScanoutPixmap call in present
> code; I'd expect that to require linking randr to wherever the present
> code ends up, not sure why it would require linking render to randr.
> 
> Anyway, https://patchwork.freedesktop.org/patch/136239/ and
> https://patchwork.freedesktop.org/patch/136238/ basically undo bb9128fd,
> can you test that the DMX failure is fixed with those?
> 

No failure with them on top of bb9128fdc86decd6f6e3b0e145011a8c08b1d2b5

Was:

../../randr/.libs/librandr.a(rrcrtc.o): In function `ProcRRSetCrtcTransform':
/xserver/randr/rrcrtc.c:1655: undefined reference to 
`PictTransform_from_xRenderTransform'
../../randr/.libs/librandr.a(rrcrtc.o): In function `transform_encode':
/xserver/randr/rrcrtc.c:1718: undefined reference to 
`xRenderTransform_from_PictTransform'
/xserver/randr/rrcrtc.c:1718: undefined reference to 
`xRenderTransform_from_PictTransform'
collect2: error: ld returned 1 exit status
Makefile:760: recipe for target 'Xdmx' failed

Corrected fix that does not link into, but with:

diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index eef84cb66a76..38d6ac409e76 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -80,7 +80,8 @@ XDMX_LIBS = \
 
 Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) \
+ $(top_builddir)/render/librender.la
 
 relink:
$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)

> 
> -- 
> Earthling Michel Dänzer   |   http://www.amd.com
> Libre software enthusiast | Mesa and X developer
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] dmx: fix linking

2017-02-03 Thread Mihail Konev
On Fri, Feb 03, 2017 at 10:08:03AM +0900, Michel Dänzer wrote:
> On 03/02/17 06:57 AM, Mihail Konev wrote:
> > Regressed-in: bb9128fd ("present: disable page flip")
> > Signed-off-by: Mihail Konev 
> > ---
> > Maybe there should be #ifdef-s instead - I only bisected :)
> > 
> >  randr/Makefile.am | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/randr/Makefile.am b/randr/Makefile.am
> > index 90dc9ec9aac4..90aa1289f958 100644
> > --- a/randr/Makefile.am
> > +++ b/randr/Makefile.am
> > @@ -30,3 +30,4 @@ if XINERAMA
> >  librandr_la_SOURCES += ${XINERAMA_SRCS}
> >  endif
> >  
> > +librandr_la_LIBADD = $(top_builddir)/render/librender.la
> > 
> 
> This looks weird. bb9128fd added a RRHasScanoutPixmap call in present
> code; I'd expect that to require linking randr to wherever the present
> code ends up, not sure why it would require linking render to randr.
> 

Linker command line for Xdmx was: render, present, randr
With bb9128fd, needs to be: present, randr, render

Probably this is due to how inter-dependencies are resolved, as randr, present, 
render gives:

  ../../present/.libs/libpresent.a(present.o): In function 
`present_check_output_slaves_active':
  /xserver/present/present.c:126: undefined reference to `RRHasScanoutPixmap'
  collect2: error: ld returned 1 exit status

Adding render at the end of Xdmx_LDADD gives just the needed "present, randr, 
render".
(libtool probably only leaves the last librender.a).
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v5 xserver 7/6] tests: fix --disable-xorg build

2017-02-08 Thread Mihail Konev
On Mon, Jan 16, 2017 at 02:47:26PM -0500, Adam Jackson wrote:
> On Sat, 2017-01-14 at 15:19 +0500, Mihail Konev wrote:
> > Commit ead5064581665ff40c177dd1b447949f1420e209 missed that xi1/
> > and xi2/ were conditioned on XORG, and made xfree86-only tests to be
> > built unconditionally.
> > Ifdef the tests and split tests_SOURCES.
> > 
> > Commit 704a867f8fb7652a8b7d5569bbe44e188457db4e missed that when
> > XORG is false, libxservertest.la isn't linked into anything.
> > However, before putting them into tests_LDADD, its static libraries
> > likely need to be reordered for linking not to fail.
> > Remove the former libxservertest.la for !XORG, as its build was only
> > triggered by 'make check'.
> > XSERVER_LIBS were depending on it; remove them too.
> > 
> > Commit 23f6dbc96e47be6cbeed78cc9ef303987c3e29a9 missed that -wrap
> > arguments to 'ld' could only be present when HAVE_LD_WRAP is true.
> 
> While this does make --disabled-xorg fail differently, it does not work
> for me:
> 
> tests-tests.o: In function `main':
> /home/ajax/git/xserver/test/tests.c:12: undefined reference to `fixes_test'
> /home/ajax/git/xserver/test/tests.c:14: undefined reference to 
> `hashtabletest_test'
> /home/ajax/git/xserver/test/tests.c:16: undefined reference to `input_test'
> /home/ajax/git/xserver/test/tests.c:17: undefined reference to `misc_test'
> /home/ajax/git/xserver/test/tests.c:18: undefined reference to 
> `signal_logging_test'
> /home/ajax/git/xserver/test/tests.c:19: undefined reference to `touch_test'
> /home/ajax/git/xserver/test/tests.c:20: undefined reference to `xfree86_test'
> /home/ajax/git/xserver/test/tests.c:21: undefined reference to `xkb_test'
> /home/ajax/git/xserver/test/tests.c:22: undefined reference to `xtest_test'
> /home/ajax/git/xserver/test/tests.c:26: undefined reference to 
> `protocol_xchangedevicecontrol_test'
> /home/ajax/git/xserver/test/tests.c:28: undefined reference to 
> `protocol_xiqueryversion_test'
> /home/ajax/git/xserver/test/tests.c:29: undefined reference to 
> `protocol_xiquerydevice_test'
> /home/ajax/git/xserver/test/tests.c:30: undefined reference to 
> `protocol_xiselectevents_test'
> /home/ajax/git/xserver/test/tests.c:31: undefined reference to 
> `protocol_xigetselectedevents_test'
> /home/ajax/git/xserver/test/tests.c:32: undefined reference to 
> `protocol_xisetclientpointer_test'
> /home/ajax/git/xserver/test/tests.c:33: undefined reference to 
> `protocol_xigetclientpointer_test'
> /home/ajax/git/xserver/test/tests.c:34: undefined reference to 
> `protocol_xipassivegrabdevice_test'
> /home/ajax/git/xserver/test/tests.c:35: undefined reference to 
> `protocol_xiquerypointer_test'
> /home/ajax/git/xserver/test/tests.c:36: undefined reference to 
> `protocol_xiwarppointer_test'
> /home/ajax/git/xserver/test/tests.c:37: undefined reference to 
> `protocol_eventconvert_test'
> /home/ajax/git/xserver/test/tests.c:38: undefined reference to `xi2_test'
> collect2: error: ld returned 1 exit status
> 
> - ajax

This cannot happen on a clean build, at least for fixes_test():
(I should have sent this earlier, but grepping wouldn't come to mind).

  [xserver]$ git status
  HEAD detached at 730fd8c05f56
  nothing to commit, working tree clean
  [xserver]$

  [xserver]$ git show | head -n1
  commit 730fd8c05f56da21894691bbd2e7ff37f67b45f4
  [xserver]$

The only invocation of fixes_test is guarded by XORG_TESTS #define ..

  [xserver]$ grep '\bfixes_test\b' -r -C1
  Binary file test/tests-fixes.o matches
  --
  test/tests.c-#if XORG_TESTS
  test/tests.c:run_test(fixes_test);
  test/tests.c-#ifdef RES_TESTS
  --
  test/fixes.c-int
  test/fixes.c:fixes_test(void)
  test/fixes.c-{
  --
  test/tests.h-
  test/tests.h:int fixes_test(void);
  test/tests.h-int hashtabletest_test(void);
  [xserver]$

And the only XORG_TESTS definition is guarded by XORG automake define ..

  [xserver]$ grep 'XORG_TESTS\b' -r -C1
  test/Makefile.am-if XORG
  test/Makefile.am:AM_CPPFLAGS += -DXORG_TESTS
  test/Makefile.am-# Tests that require at least some DDX functions in order to 
fully link
  --
  test/tests.c-
  test/tests.c:#if XORG_TESTS
  test/tests.c-run_test(fixes_test);
  --
  test/Makefile.in-host_triplet = @host@
  test/Makefile.in:@ENABLE_UNIT_TESTS_TRUE@@XORG_TRUE@am__append_1 = 
-DXORG_TESTS
  test/Makefile.in-@ENABLE_UNIT_TESTS_TRUE@@RES_TRUE@@XORG_TRUE@am__append_2 = 
-DRES_TESTS
  --
  test/Makefile-host_triplet = x86_64-pc-linux-gnu
  test/Makefile:#am__append_1 = -DXORG_TESTS
  test/Makefile-#am__append_2 = -DRES_TESTS
  [xserver]$

Which is guarded by the XORG shell variable ..

  [xserve

[PATCH xserver] randr,render: link some necessary symbols into

2017-02-08 Thread Mihail Konev
Fixes dmx build, even on Ubuntu 17.04 alpha, where just adding
librender at the end of Xdmx doesn't work (librender HashGlyph then
cannot find x_sha1_init from libos).

This links some libos.a functions into render, and some librender.a
ones into randr.
Adjust the subdirectory order to allow for this.

"Linking into" seems to be the only reliable way to have two
subdirectory libraries reference symbols from each other - before,
it seems, Xserver just happened to have library order that allowed
linkers to find all the symbols in such cases; this broke
in e50da50118408a195d4d2e1b39817fe7c4447c56.

Somehow this does not result in multiple definition errors.

Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---

This requires 3ef16dfb to be reverted first.

Seems to be a sufficient "emulation" of libddx_Xdmx.la,
the to-be only library collecting all the _LIB-s to link into Xdmx,
whose purpose would be to avoid the subdirectory libs dependency
resolution nightmare (i.e. configure.ac/Makefile.am reorderings).
(I brute-forced it as well, but this patch looks to be making more
sense than per-OS adjustments).

 Makefile.am| 2 +-
 randr/Makefile.am  | 3 +++
 render/Makefile.am | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index f0fa2d839f7e..270c56103dff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,8 +45,8 @@ SUBDIRS = \
Xext \
miext \
os \
+   render \
randr \
-   render  \
Xi \
xkb \
$(PSEUDORAMIX_DIR) \
diff --git a/randr/Makefile.am b/randr/Makefile.am
index 90dc9ec9aac4..94db11dc12cd 100644
--- a/randr/Makefile.am
+++ b/randr/Makefile.am
@@ -26,6 +26,9 @@ librandr_la_SOURCES = \
rrtransform.h   \
rrtransform.c
 
+librandr_la_DEPENDENCIES = $(top_builddir)/render/librender.la
+librandr_la_LIBADD = $(top_builddir)/render/librender.la
+
 if XINERAMA
 librandr_la_SOURCES += ${XINERAMA_SRCS}
 endif
diff --git a/render/Makefile.am b/render/Makefile.am
index d02028b3b749..f2b0944d51f1 100644
--- a/render/Makefile.am
+++ b/render/Makefile.am
@@ -15,6 +15,9 @@ librender_la_SOURCES =\
picture.c   \
render.c
 
+librender_la_DEPENDENCIES = $(OS_LIB)
+librender_la_LIBADD = $(OS_LIB)
+
 if XORG
 sdk_HEADERS = picture.h mipict.h glyphstr.h picturestr.h
 endif
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] randr,render: link some necessary symbols into

2017-02-08 Thread Mihail Konev
On Thu, Feb 09, 2017 at 10:48:14AM +0500, Mihail Konev wrote:
> this patch looks to be making more sense than per-OS adjustments

(In the sense it does record "A depends on B", whereas reordering does
not, while being a "per-OS-adjustment" too).
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] dmx: fix linking again by brute-forcing

2017-02-08 Thread Mihail Konev
On Ubuntu 17.04 daily, the following error is seen,
(disappears when librender.a is put before libos.a on the resulting
collect2 linker command line (seen by CFLAGS='-v')):

  ../../render/.libs/librender.a(glyph.o): In function `HashGlyph':
  /mnt/xserver/render/glyph.c:168: undefined reference to `x_sha1_init'
  /mnt/xserver/render/glyph.c:174: undefined reference to `x_sha1_update'
  /mnt/xserver/render/glyph.c:177: undefined reference to `x_sha1_update'
  /mnt/xserver/render/glyph.c:180: undefined reference to `x_sha1_final'
  collect2: error: ld returned 1 exit status
  Makefile:763: recipe for target 'Xdmx' failed

Align XDMX_LIBS to be "... RANDR RENDER ... PRESENT ...",
as in all other DDX-es; but this wouldn't help:

  ../../present/.libs/libpresent.a(present.o): In function 
`present_check_output_slaves_active':
  /mnt/xserver/present/present.c:126: undefined reference to 
`RRHasScanoutPixmap'
  collect2: error: ld returned 1 exit status

Then move PRESENT: "... PRESENT RANDR RENDER ...":

  ../../dix/.libs/libdix.a(pixmap.o): In function `PixmapStartDirtyTracking':
  /mnt/xserver/dix/pixmap.c:204: undefined reference to `RRTransformCompute'
  collect2: error: ld returned 1 exit status

Then align them as "... PRESENT ...LIBDIX... RANDR RENDER ...",
which somehow works.

Then moving PRESENT as "...LIBDIX... PRESENT RANDR RENDER ...",
or surrounding the original RANDR with RENDER or also PRESENT as
"...LIBDIX... PRESENT RANDR RENDER ..." would give the original
HashGlyph error.

Regressed-in: 3ef16dfb ("dmx: fix linking")
Suggested-by: Michel Dänzer 
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---
I was probably wrong in the previous message, as why "linking into"
would be different from listing a library multiple times.

On the other hand, looking at the above, it seems that saying
"randr depends on render" is less a guessing-game than finding
out where to put PRESENT. (Since the "nightmare").

That is, this patch, while smaller and more conservative,
might as well be risky, and is at least less explicit.
(I.e. wouldn't it be harder to figure out whether to reorder the libs,
or to list some the second time, then just to add a LIBADD,
should it break on another toolchain?)
(Also maybe it was not Ubuntu, but gcc 6.3.0).

 configure.ac   | 2 +-
 hw/dmx/Makefile.am | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..ddd0a61c9d97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2330,7 +2330,7 @@ if test "x$DMX" = xyes; then
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
-   XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB 
$XKB_LIB $XKB_STUB_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB 
$MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $RANDR_LIB 
$CONFIG_LIB $OS_LIB $FIXES_LIB"
+   XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $PRESENT_LIB $RECORD_LIB $XI_LIB 
$XKB_LIB $XKB_STUB_LIB $DRI3_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB 
$MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB 
$RANDR_LIB $RENDER_LIB $OS_LIB $FIXES_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 38d6ac409e76..eef84cb66a76 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -80,8 +80,7 @@ XDMX_LIBS = \
 
 Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) \
- $(top_builddir)/render/librender.la
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
 
 relink:
$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] randr,render: link some necessary symbols into

2017-02-09 Thread Mihail Konev
On Thu, Feb 09, 2017 at 11:16:20AM +0500, Mihail Konev wrote:
> per-OS-adjustments

Sorry for the screaming; it was not OS/toolchain, but

  ./configure --enable-dmx --with-dtrace=no

With it, there are no custom-built os.O/dix.O, and libtool
does not reorder them in front of everything else
(as "non-libtool libraries"?).

But how does it work in the os.O case that librender.a finds x_sha1_init ...?
Placing libdix.a/libos.a to *.O places does not work, and then also libmain.a
cannot find dix_main.

So from *.O symbols are somehow visible even backwards.
Now the configure-reordering no longer looks risky, althrough there is a
dtrace-library-symbols mystery.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] Move dtrace out of os,dix

2017-02-09 Thread Mihail Konev
Put the dtrace objects into a separate lib.
This avoids needing to "ld -r" the os.O, which was changing linker's
behaviour to be more forgiving for "./configure --with-dtrace" build,
or when /usr/bin/dtrace is present.

Specifically, it was making symbols from os.O and dix.O
(i.e. os/ and dix/) visible from everywhere on the linker command
line, not just from the preceding libraries.
This was making with-dtrace-being-present build-testing unreliable,
e.g. see the commit 3f8c2f94483bf0b96e129c97ef4950170a3f05b4.

Moreover, the os.O was requiring conflicting workarounds that the
libos.a did not, at least, 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056
broke the "./configure --enable-dmx --with-dtrace=no" build.

Xnest,Xdmx,Xwayland ignore the common XSERVER_[SYS_]LIBS;
add the lib to their makefiles directly, the quick-and-dirty way.
For KDrive, do this in configure, not in every makefile.
Tests seemed to work the visibility around by appending libos.la;
do it unconditionally.
For Xdmx, also revert the now-errorneous 3ef16dfb ("dmx: fix linking").

Fixes: 49a26681 ("Add DTrace probe points")
Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---
Makes the both previous "linking into" and "configure reordering" patches 
unnecessary.

Editing makefiles was chosen over configure.ac for faster regeneration
and better diff readability.

Build-tested on top of 058809c43ec578a407cf40d4c3e54a42503e3562,
with "./configure --enable-dmx" on Ubuntu 17.04 daily without the 
systemtap/dtrace.

Also, not on Ubuntu, and with /usr/bin/dtrace from systemtap,
as "./configure --enable-{dmx,kdrive,ephyr,xfake,xfbdev}",
with and without "--with-dtrace=no".

 Makefile.am |  1 +
 configure.ac| 22 +-
 dix/Makefile.am | 12 
 dtrace/Makefile.am  | 33 +
 hw/dmx/Makefile.am  |  4 ++--
 hw/xnest/Makefile.am|  1 +
 hw/xwayland/Makefile.am |  1 +
 os/Makefile.am  | 12 
 test/Makefile.am|  7 ++-
 9 files changed, 53 insertions(+), 40 deletions(-)
 create mode 100644 dtrace/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index f0fa2d839f7e..bb796759f228 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,6 +61,7 @@ SUBDIRS = \
exa \
$(GLAMOR_DIR) \
config \
+   dtrace \
hw \
test
 
diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..efe38883125b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1579,15 +1579,18 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
 AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
+DIX_LIB='$(top_builddir)/dix/libdix.la'
+OS_LIB='$(top_builddir)/os/libos.la'
+
 if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
-  DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
-else
-  DIX_LIB='$(top_builddir)/dix/libdix.la'
-  OS_LIB='$(top_builddir)/os/libos.la'
+  DTRACE_LIB='$(top_builddir)/dtrace/libdtrace.a'
+  DTRACE_SYS_LIBS='$(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
 fi
+
 AC_SUBST([DIX_LIB])
 AC_SUBST([OS_LIB])
+AC_SUBST([DTRACE_LIB])
+AC_SUBST([DTRACE_SYS_LIBS])
 
 MAIN_LIB='$(top_builddir)/dix/libmain.la'
 AC_SUBST([MAIN_LIB])
@@ -1754,8 +1757,8 @@ AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = 
xyes])
 # require.
 #
 XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
-XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
-XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
+XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB $DTRACE_LIB"
+XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${DTRACE_SYS_LIBS}"
 AC_SUBST([XSERVER_LIBS])
 AC_SUBST([XSERVER_SYS_LIBS])
 
@@ -2447,13 +2450,13 @@ if test "$KDRIVE" = yes; then
 
 KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
 
-KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB 
$RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB 
$MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB 
$XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB 
$RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB 
$MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB 
$XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB $DTRACE_LIB"
 KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
 KDRIVE_MAIN_LIB="$MAIN_LIB"
 KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
 KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS 

Re: [PATCH xserver] Move dtrace out of os,dix

2017-02-09 Thread Mihail Konev
Tiny portability addition:

diff --git a/configure.ac b/configure.ac
index efe38883125b..9310160c8b7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,7 @@ dnl version-config.h covers the version numbers so they can 
be bumped without
 dnl forcing an entire recompile.x
 AC_CONFIG_HEADERS(include/version-config.h)
 
+AM_PROG_AR
 AM_PROG_AS
 AC_PROG_LN_S
 LT_PREREQ([2.2])
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] os,dix: rename *.O to *.a

2017-02-09 Thread Mihail Konev
Libtool was moving the *.O libraries in front of all others on
the gcc command line, which was necessiating "ld -r"
(so that symbols from now-moved os.O are visible from the following
libs), which, in turn, was altering the linker behaviour against os/
and dix/ between with-/usr/bin/dtrace and --with-dtrace=no builds.

In particular, commit 3f8c2f94483bf0b96e129c97ef4950170a3f05b4
was necessary for without-dtrace, but not for with-dtrace build.
The 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056 fixed the with-dtrace,
but broke the without-dtrace build (so this commit reverts it).

Fixes: 49a26681 ("Add DTrace probe points")
Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---
Simpler fix that does the same no-*.O, but another way.
(Forgot to mention the libtool's move of .O in the previous patch).
This does assume there is no another source of additional objects like dtrace.

 configure.ac   |  5 +++--
 dix/Makefile.am|  8 
 hw/dmx/Makefile.am |  3 +--
 os/Makefile.am | 10 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..6a362ab96a1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,7 @@ dnl version-config.h covers the version numbers so they can 
be bumped without
 dnl forcing an entire recompile.x
 AC_CONFIG_HEADERS(include/version-config.h)
 
+AM_PROG_AR
 AM_PROG_AS
 AC_PROG_LN_S
 LT_PREREQ([2.2])
@@ -1580,8 +1581,8 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
 if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
-  DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
+  DIX_LIB='$(top_builddir)/dix/libdix_dtraced.a'
+  OS_LIB='$(top_builddir)/os/libos_dtraced.a $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
 else
   DIX_LIB='$(top_builddir)/dix/libdix.la'
   OS_LIB='$(top_builddir)/os/libos.la'
diff --git a/dix/Makefile.am b/dix/Makefile.am
index a4171d7e1f12..707379d86373 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -64,11 +64,11 @@ if SPECIAL_DTRACE_OBJECTS
 dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
$(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
 
-noinst_PROGRAMS = dix.O
+noinst_PROGRAMS = libdix_dtraced.a
 
-dix_O_SOURCES =
-dix.O: dtrace-dix.o libdix.la
-   $(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
+libdix_dtraced_a_SOURCES =
+libdix_dtraced.a: dtrace-dix.o libdix.la
+   $(AM_V_GEN) $(AR) cru $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
 endif
 
 CLEANFILES = Xserver-dtrace.h
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 38d6ac409e76..eef84cb66a76 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -80,8 +80,7 @@ XDMX_LIBS = \
 
 Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) \
- $(top_builddir)/render/librender.la
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
 
 relink:
$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
diff --git a/os/Makefile.am b/os/Makefile.am
index c6e78cb99fd5..b43113ea5d98 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -58,12 +58,12 @@ EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
-dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
+dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la ../dix/libdix.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
.libs/*.o ../dix/.libs/*.o
 
-noinst_PROGRAMS = os.O
+noinst_PROGRAMS = libos_dtraced.a
 
-os_O_SOURCES =
-os.O: dtrace.o libos.la
-   $(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
+libos_dtraced_a_SOURCES =
+libos_dtraced.a: dtrace.o libos.la
+   $(AM_V_GEN) $(AR) cru $@ dtrace.o .libs/*.o
 endif
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2 xserver] os,dix: rename *.O to *.a

2017-02-09 Thread Mihail Konev
Libtool was moving the *.O libraries in front of all others on
the gcc command line, which was necessiating "ld -r"
(so that symbols from now-moved os.O are visible from the following
libs), which, in turn, was altering the linker behaviour against os/
and dix/ between with-/usr/bin/dtrace and --with-dtrace=no builds.

In particular, commit 3f8c2f94483bf0b96e129c97ef4950170a3f05b4
was necessary for without-dtrace, but not for with-dtrace build.
The 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056 fixed the with-dtrace,
but broke the without-dtrace build (so this commit reverts it).

Also remove dtrace lib from dix/, as only the os/ one was used.

Fixes: 49a26681 ("Add DTrace probe points")
Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---
v2:
- remove dtrace lib
- fix the with-dtrace build for tests, as done in dtrace-in-separate-dir patch.
  But this still probably does not work for --disable-xorg.
  Yet the fix shouldn't be attempted right now, as this patch conflicts with 
the pending
   https://patchwork.freedesktop.org/patch/136119/
  which is required to test the "--disable-xorg"-with-dtrace.

The dtrace-in-a-separate-dir is preferrable, IMO:
- allows for another dtrace-like additional-objects-compiler
- cleaner makefile
- simpler diff
(But note it is still not "--disable-xorg"-ready).

 configure.ac   |  6 +++---
 dix/Makefile.am| 12 
 hw/dmx/Makefile.am |  3 +--
 os/Makefile.am | 10 +-
 test/Makefile.am   |  7 ++-
 5 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..3b56c9daa962 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,7 @@ dnl version-config.h covers the version numbers so they can 
be bumped without
 dnl forcing an entire recompile.x
 AC_CONFIG_HEADERS(include/version-config.h)
 
+AM_PROG_AR
 AM_PROG_AS
 AC_PROG_LN_S
 LT_PREREQ([2.2])
@@ -1579,11 +1580,10 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
 AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
+DIX_LIB='$(top_builddir)/dix/libdix.la'
 if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
-  DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
+  OS_LIB='$(top_builddir)/os/libos_dtraced.a $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
 else
-  DIX_LIB='$(top_builddir)/dix/libdix.la'
   OS_LIB='$(top_builddir)/os/libos.la'
 fi
 AC_SUBST([DIX_LIB])
diff --git a/dix/Makefile.am b/dix/Makefile.am
index a4171d7e1f12..476bd35bd566 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -59,16 +59,4 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
 
 endif
 
-if SPECIAL_DTRACE_OBJECTS
-# Generate dtrace object code for probes in libdix
-dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
-   $(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
$(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-
-noinst_PROGRAMS = dix.O
-
-dix_O_SOURCES =
-dix.O: dtrace-dix.o libdix.la
-   $(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-endif
-
 CLEANFILES = Xserver-dtrace.h
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 38d6ac409e76..eef84cb66a76 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -80,8 +80,7 @@ XDMX_LIBS = \
 
 Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) \
- $(top_builddir)/render/librender.la
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
 
 relink:
$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
diff --git a/os/Makefile.am b/os/Makefile.am
index c6e78cb99fd5..b43113ea5d98 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -58,12 +58,12 @@ EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
-dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
+dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la ../dix/libdix.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
.libs/*.o ../dix/.libs/*.o
 
-noinst_PROGRAMS = os.O
+noinst_PROGRAMS = libos_dtraced.a
 
-os_O_SOURCES =
-os.O: dtrace.o libos.la
-   $(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
+libos_dtraced_a_SOURCES =
+libos_dtraced.a: dtrace.o libos.la
+   $(AM_V_GEN) $(AR) cru $@ dtrace.o .libs/*.o
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..fb61d614bf10 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -140,11 +140,8 @@ tests_LDADD += \
 $(top_builddir)/hw/xfree86/i2c/libi2c.la \
 $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
 $(top_builddir)/Xext/libXvidmode.la \
-@XORG_LIBS@
-
-if !SPECIAL_DTRACE_OBJECTS
-

[PATCH v6 libX11] Compose sequences for rouble sign

2017-02-10 Thread Mihail Konev
Cyrillic combinations mirror the Qwerty-Jcuken keyboard layout.
Also add Cyrillic sequences for hryvnia sign.

Submitted-by: Victor V. Kustov 
Reviewed-by: Victor V. Kustov 
Signed-off-by: Mihail Konev 
---
v6:
 Follow Victor's suggestions:

 Change "=" to "-".
 Do not touch peseta (this was font-induced).
 Use the common-layout Cyrillic equvivalent instead of phonetical one.

 Add hryvnia sign.
 As it corresponds to handwritten, but not typeset "Cyr_ge",
 there is nothing to map it to in Qwerty.
 Use "2" as the visually nearest symbol.
 For dead_currency dead key, use "Cyr_ge", as hryvnia is already present
 on "h".

 nls/en_US.UTF-8/Compose.pre | 20 
 1 file changed, 20 insertions(+)

diff --git a/nls/en_US.UTF-8/Compose.pre b/nls/en_US.UTF-8/Compose.pre
index adc24fb5b5c2..ce874141f926 100644
--- a/nls/en_US.UTF-8/Compose.pre
+++ b/nls/en_US.UTF-8/Compose.pre
@@ -190,6 +190,14 @@ XCOMM "₪" U20aa NEW SHEQEL SIGN
 : "€"   EuroSign # EURO SIGN
 : "€"   EuroSign # EURO SIGN
 : "€"   EuroSign # EURO SIGN
+  : "₽"   U20bd # ROUBLE SIGN
+  : "₽"   U20bd # ROUBLE SIGN
+  : "₽"   U20bd # ROUBLE SIGN
+  : "₽"   U20bd # ROUBLE SIGN
+: "₽"   U20bd # ROUBLE SIGN
+: "₽"   U20bd # ROUBLE SIGN
+: "₽"   U20bd # ROUBLE SIGN
+: "₽"   U20bd # ROUBLE SIGN
 XCOMM "₭" U20ad KIP SIGN
 XCOMM "₮" U20ae TUGRIK SIGN
 XCOMM "₯" U20af DRACHMA SIGN
@@ -203,6 +211,8 @@ XCOMM "₵" U20b5 CEDI SIGN
   : "₹" U20b9 # INDIAN RUPEE SIGN
   : "₹" U20b9 # INDIAN RUPEE SIGN
   : "₹" U20b9 # INDIAN RUPEE SIGN
+ <2> : "₴" U20b4 # HRYVNIA SIGN
+  <2>: "₴" U20b4 # HRYVNIA SIGN
 
 : "¢"   cent # CENT SIGN
 : "¢"   cent # CENT SIGN
@@ -5315,6 +5325,16 @@ XCOMM
: "₩"   WonSign # WON SIGN
: "円"   U5186  # YEN
: "¥"   yen # YEN SIGN
+ : "₴"   U20b4   # HRYVNIA SIGN
+ : "₴"   U20b4   # HRYVNIA SIGN
+: "₽"   U20bd   # ROUBLE SIGN
+: "₽"   U20bd   # ROUBLE SIGN
+: "₽"   U20bd   # ROUBLE SIGN
+: "₽"   U20bd   # ROUBLE SIGN
+   : "₽"   U20bd   # ROUBLE SIGN
+   : "₽"   U20bd   # ROUBLE SIGN
+   : "₽"   U20bd   # ROUBLE SIGN
+   : "₽"   U20bd   # ROUBLE SIGN
 : "¤"   currency# CURRENCY 
SIGN
 : "¤"   currency# 
CURRENCY SIGN
: "¤"   currency# CURRENCY 
SIGN
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH v2 xserver] os,dix: rename *.O to *.a

2017-02-10 Thread Mihail Konev
Log of searching for "ld -r" attached, in case it is of any help.

On Fri, Feb 10, 2017 at 10:47:29AM +0500, Mihail Konev wrote:
> 
> The dtrace-in-a-separate-dir is preferrable, IMO:
> - allows for another dtrace-like additional-objects-compiler
> - cleaner makefile
> - simpler diff
> 

Really no difference.
While it would be indeed more straightforward to not have
libos_dtraced.la, this could be as well archieved with

  libos_la_LIBADD=
  if SPECIAL_DTRACE_OBJECTS
libos_la_LIBADD += dtrace.a
  endif
  if ANOTHER_OBJECTS
libos_la_LIBADD += another.a
  fi

So it is just of preference, whether to use some misc/ top-level
subdir for dtrace or just leave it in-line as it is now.

Mihail
Built 058809c43ec578a407cf40d4c3e54a42503e3562 as:
  ./configure --enable-dmx,
  with /usr/bin/dtrace being present (from the systemtap)

It suceeds.

Saved the output of:
  rm hw/dmx/Xdmx
  make -C hw/dmx Xdmx V=1 CFLAGS='-v'

Then built the same as:
  ./configure --enable-dmx --with-dtrace=no

It fails, as on a fresh Ubuntu 17.04, where systemtap
is not installed by default (HashGlyph cannot find x_sha1_init,
e.g. librender.a cannot find libos.a).

Noticed that in the /usr/bin/dtrace case, the librender does find
the os.O's x_sha1_init, even through the latter is put, by libtool,
in front of all other libraries (e.g. right after the dmx*.o files).

Ran the:
  rm os/.libs/libos.a
  make -C os libos.la V=1 CFLAGS='-v'

It shows that libos.a is created with 'ar cru', i.e. there is no linker 
involved.
(There also is 'ranlib', but it is just another form of 'ar' invocation).

Noticed that os.O is built with 'ld':
  ld -r -o $@ dtrace.o .libs/*.o

So there is the linker involved, and it is passed a '--relocatable' flag,
which puts it into under-documented "partial linking" mode.
(Neither 'info ld' nor google describe it).

Then took the collect2 invocation command from the output of the 'make Xdmx' for
successfull /usr/bin/dtrace case, and edited as:
  ../../os/os.O   -> ../../os.O1
  ../../dix/dix.O -> ../../dix.O1

Then created the O1 files:
  ld -r -o os.O1 os/.libs/*.o
  ld -r -o dix.O1 dix/.libs/*.o

Then ran the edited collect2 command line and it worked.

So the "ld -r" must be making symbols visible from an object 
for-the-following-libraries
on the linker command line, not only for-the-preceding-ones, as it is with
"ar cru"-ed foo.a and non-"ld -r"-ed -lbar.

Now, the "-r" was not explained, but could be assumed to be a workaround
for libtool's putting-os.O-in-front-of-all-else
("git log -L 68,68:os/Makefile.am"):

  commit 49a26681b2bdd95ed65c425f1fa1441d2f092a6e
  Author: Alan Coopersmith 
  Date:   Fri Nov 3 12:54:43 2006 -0800

  Add DTrace probe points for X server <-> client communications

  See http://people.freedesktop.org/~alanc/dtrace/ for more details

  diff --git a/os/Makefile.am b/os/Makefile.am
  --- a/os/Makefile.am
  +++ b/os/Makefile.am
  @@ -53,0 +62,1 @@
  +   ld -r -o $@ dtrace.o .libs/*.o

There are two solutions - either use os.O regardless of the dtrace presence and 
do

ld -r -o $@ $(DTRACE_O_OR_NOTHING) .libs/*.o

or do not use "ld -r" at all and "ar cru" the .libs/libdix.a manually.

The latter seems to be less depending on ld capabilities, and thus, more 
portable.

Implementing it, however, reveals that the commit actually leaved dix.O intact, 
instead
putting both dix/dtrace.o and os/dtrace.o into the os.O.
This is required, as otherwise:

  diff --git a/dix/Makefile.am b/dix/Makefile.am
  index a4171d7e1f12..1094f331a722 100644
  --- a/dix/Makefile.am
  +++ b/dix/Makefile.am
  @@ -61,14 +61,14 @@ endif
   if SPECIAL_DTRACE_OBJECTS
   # Generate dtrace object code for probes in libdix
  -dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
  +dix-dtrace.o: $(top_srcdir)/dix/Xserver.d libdix.la
  $(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
$(am_libdix_la_OBJECTS:%.lo=.libs/%.o)

   noinst_PROGRAMS = dix.O

   dix_O_SOURCES =
  -dix.O: dtrace-dix.o libdix.la
  -   $(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
  +dix.O: dix-dtrace.o libdix.la
  +   $(AM_V_GEN)ld -r -o $@ $< $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
   endif

   CLEANFILES = Xserver-dtrace.h
  diff --git a/os/Makefile.am b/os/Makefile.am
  index c6e78cb99fd5..b61a331990a5 100644
  --- a/os/Makefile.am
  +++ b/os/Makefile.am
  @@ -58,12 +58,12 @@ EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)

   if SPECIAL_DTRACE_OBJECTS
   # Generate dtrace object code for probes in libos & libdix
  -dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
  -   $(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
.libs/*.o ../dix/.libs/*.o
  +os-dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
  +   $(AM_V_GEN)$(DTRACE) -G -C -o $@

Re: [PATCH v2 xserver] os,dix: rename *.O to *.a

2017-02-10 Thread Mihail Konev
Changing the To: field unintendedly changed recipients, so resending
this as a notification, even through it becomes quite a flood.

On Sat, Feb 11, 2017 at 04:15:19AM +0500, Mihail Konev wrote:
> Log of searching for "ld -r" attached, in case it is of any help.
> 
> On Fri, Feb 10, 2017 at 10:47:29AM +0500, Mihail Konev wrote:
> > 
> > The dtrace-in-a-separate-dir is preferrable, IMO:
> > - allows for another dtrace-like additional-objects-compiler
> > - cleaner makefile
> > - simpler diff
> > 
> 
> Really no difference.
> While it would be indeed more straightforward to not have
> libos_dtraced.la, this could be as well archieved with
> 
>   libos_la_LIBADD=
>   if SPECIAL_DTRACE_OBJECTS
> libos_la_LIBADD += dtrace.a
>   endif
>   if ANOTHER_OBJECTS
> libos_la_LIBADD += another.a
>   fi
> 
> So it is just of preference, whether to use some misc/ top-level
> subdir for dtrace or just leave it in-line as it is now.
> 
> Mihail

Mihail
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] os,dix: relocate when without dtrace

2017-02-14 Thread Mihail Konev
When building with dtrace compiler, "ld -r" is applied to the
entire os/ and dix/, making their symbols visible from everywhere
on linker command line.
This alters the build from a non-dtrace one:
* 3f8c2f94483bf0b96e129c97ef4950170a3f05b4 was only necessary without dtrace.
* 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056 fixed the with-dtrace, but broke
  the without-dtrace build.
The "-r" is required for Solaris linker
(needs dtrace objects in a Relocatable Object).
To ensure consistency across with- and without- dtrace builds,
use it for the latter too.

Fixes "./configure --enable-dmx --with-dtrace=no" build.

Fixes: 49a26681 ("Add DTrace probe points")
Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim 
Signed-off-by: Mihail Konev 
---
Compatible with Solaris, adds comments about ld.
Not --disable-xorg ready.

 configure.ac|  9 ++---
 dix/Makefile.am | 11 ++-
 os/Makefile.am  | 12 +++-
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..981c10dee7e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1579,13 +1579,8 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
 AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
-if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
-  DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) 
$(LIBUNWIND_LIBS)'
-else
-  DIX_LIB='$(top_builddir)/dix/libdix.la'
-  OS_LIB='$(top_builddir)/os/libos.la'
-fi
+DIX_LIB='$(top_builddir)/dix/dix.O'
+OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
 AC_SUBST([DIX_LIB])
 AC_SUBST([OS_LIB])
 
diff --git a/dix/Makefile.am b/dix/Makefile.am
index a4171d7e1f12..1f7f4df4dc31 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,4 +1,5 @@
 noinst_LTLIBRARIES = libdix.la libmain.la
+noinst_PROGRAMS = dix.O
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_CFLAGS = $(DIX_CFLAGS)
@@ -59,16 +60,16 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
 
 endif
 
+DTRACE_OBJS =
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libdix
 dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
$(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
+DTRACE_OBJS += dtrace-dix.o
+endif
 
-noinst_PROGRAMS = dix.O
-
-dix_O_SOURCES =
-dix.O: dtrace-dix.o libdix.la
+# "ld -r" is required for Solaris
+dix.O: $(DTRACE_OBJS) libdix.la
$(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-endif
 
 CLEANFILES = Xserver-dtrace.h
diff --git a/os/Makefile.am b/os/Makefile.am
index c6e78cb99fd5..ac4299657c0c 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -1,4 +1,5 @@
 noinst_LTLIBRARIES = libos.la
+noinst_PROGRAMS = os.O
 
 AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
 
@@ -56,14 +57,15 @@ endif
 
 EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
+DTRACE_OBJS =
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
 dtrace.o: $(top_srcdir)/dix/Xserver.d libos.la
$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d 
.libs/*.o ../dix/.libs/*.o
-
-noinst_PROGRAMS = os.O
+DTRACE_OBJS += dtrace.o
+endif
 
 os_O_SOURCES =
-os.O: dtrace.o libos.la
-   $(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
-endif
+# "ld -r" is required for Solaris
+os.O: $(DTRACE_OBJS) libos.la
+   $(AM_V_GEN)ld -r -o $@ $(DTRACE_OBJS) .libs/*.o
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] hw/xfree86: remove incomplete sdksyms.c on error

2017-02-16 Thread Mihail Konev
Previously, if sdksyms.sh was failing, the incorrect sdksyms.c
would stay, breaking subsequent build attempts.

Signed-off-by: Mihail Konev 
---
Needed this on Solaris due to missing awk -> gawk symlink.

 hw/xfree86/Makefile.am | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 85bd0bed0e58..96f88cb72f66 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -137,7 +137,14 @@ CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh
 EXTRA_DIST += sdksyms.sh
 
 sdksyms.dep sdksyms.c: sdksyms.sh
-   $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh 
$(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
+   $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' \
+   $(SHELL) $(srcdir)/sdksyms.sh \
+   $(top_srcdir) \
+   $(CFLAGS) \
+   $(AM_CFLAGS) \
+   $(AM_CPPFLAGS) \
+   && exit 0 ; \
+   rm sdksyms.dep sdksyms.c 2>/dev/null ; exit 1
 
 SDKSYMS_DEP = sdksyms.dep
 -include $(SDKSYMS_DEP)
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] configure.ac: use subdir-objects

2017-02-16 Thread Mihail Konev
automake-1.15 says:
  warning: possible forward-incompatibility.
  At least a source file is in a subdirectory, but the 'subdir-objects'
  automake option hasn't been enabled.  For now, the corresponding output
  object file(s) will be placed in the top-level directory.  However,
  this behaviour will change in future Automake versions: they will
  unconditionally cause object files to be placed in the same subdirectory
  of the corresponding sources.
  You are advised to start using 'subdir-objects' option throughout your
  project, to avoid future incompatibilities.

This fixes the "autoreconf -i" warnings.

Automake cannot (re)generate per-object '.Plo' makefile that records
the dependencies, if it is in another dir (now that the .Plo is in a
'subdirectory', i.e. ../xyz dir).
Work this around by symlinking the source files.

Signed-off-by: Mihail Konev 
---
Builds hw/ on Solaris, NetBSD, Linux, Windows, and Mac.

Don't know whether mi/miinitext.c is better #included instead,
sending as-is.

 configure.ac  |  5 +++-
 hw/dmx/.gitignore |  2 ++
 hw/dmx/Makefile.am| 10 +--
 hw/dmx/config/.gitignore  |  2 ++
 hw/dmx/config/Makefile.am | 11 ++--
 hw/kdrive/src/.gitignore  |  1 +
 hw/kdrive/src/Makefile.am |  6 -
 hw/vfb/.gitignore |  1 +
 hw/vfb/Makefile.am|  6 -
 hw/xfree86/dixmods/.gitignore |  1 +
 hw/xfree86/dixmods/Makefile.am|  6 -
 hw/xfree86/glamor_egl/.gitignore  |  2 ++
 hw/xfree86/glamor_egl/Makefile.am | 10 +--
 hw/xfree86/int10/.gitignore   |  2 ++
 hw/xfree86/int10/Makefile.am  | 11 ++--
 hw/xfree86/os-support/bsd/.gitignore  |  7 +
 hw/xfree86/os-support/bsd/Makefile.am | 43 ---
 hw/xfree86/os-support/hurd/.gitignore |  7 +
 hw/xfree86/os-support/hurd/Makefile.am| 30 -
 hw/xfree86/os-support/linux/.gitignore|  4 +++
 hw/xfree86/os-support/linux/Makefile.am   | 18 ++---
 hw/xfree86/os-support/solaris/.gitignore  |  6 +
 hw/xfree86/os-support/solaris/Makefile.am | 26 ++-
 hw/xfree86/os-support/stub/.gitignore |  8 ++
 hw/xfree86/os-support/stub/Makefile.am| 34 ++--
 hw/xfree86/utils/cvt/.gitignore   |  2 ++
 hw/xfree86/utils/cvt/Makefile.am  |  9 +--
 hw/xnest/.gitignore   |  1 +
 hw/xnest/Makefile.am  |  6 -
 hw/xquartz/.gitignore |  1 +
 hw/xquartz/Makefile.am|  6 -
 hw/xquartz/mach-startup/.gitignore|  2 +-
 hw/xquartz/mach-startup/Makefile.am   |  9 +--
 hw/xwayland/.gitignore|  3 +++
 hw/xwayland/Makefile.am   | 17 +---
 hw/xwin/.gitignore|  1 +
 hw/xwin/Makefile.am   |  9 +--
 test/.gitignore   |  1 +
 test/Makefile.am  |  6 -
 39 files changed, 271 insertions(+), 61 deletions(-)
 create mode 100644 hw/kdrive/src/.gitignore
 create mode 100644 hw/xfree86/dixmods/.gitignore
 create mode 100644 hw/xfree86/glamor_egl/.gitignore
 create mode 100644 hw/xfree86/int10/.gitignore
 create mode 100644 hw/xfree86/os-support/bsd/.gitignore
 create mode 100644 hw/xfree86/os-support/hurd/.gitignore
 create mode 100644 hw/xfree86/os-support/linux/.gitignore
 create mode 100644 hw/xfree86/os-support/solaris/.gitignore
 create mode 100644 hw/xfree86/os-support/stub/.gitignore
 create mode 100644 hw/xquartz/.gitignore

diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..481b28d7d239 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ RELEASE_DATE="2016-11-18"
 RELEASE_NAME="Shrimp-and-grits"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2])
 AC_USE_SYSTEM_EXTENSIONS
 
 # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in 
XORG_DEFAULT_OPTIONS
@@ -2550,6 +2550,9 @@ if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = 
xno; then
  ***])
 fi
 
+dnl Helper for subdir-objects workaround
+AC_SUBST([LN_THE_FILE], ['@echo "  LN   "$@; $(LN_S) -f $< $@'])
+
 AC_CONFIG_FILES([
 Makefile
 glx/Makefile
diff --git a/hw/dmx/.gitignore b/hw/dmx/.gitignore
index 4dd9b03580cd..d08772b4da5b 100644
--- a/hw/dmx/.gitignore
+++ b/hw/dmx/.gitignore
@@ -1,2 +1,4 @@
 #  Add & Override for this directory and it's subdirectories
 Xdmx
+panoramiX.c
+miinitext.c
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
ind

Re: [PATCH xserver] configure.ac: use subdir-objects

2017-02-16 Thread Mihail Konev
On Fri, Feb 17, 2017 at 04:08:45AM +0500, Mihail Konev wrote:
> Don't know whether mi/miinitext.c is better #included instead,
> sending as-is.
> 

They are all probably better included instead.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] os,dix: relocate when without dtrace

2017-02-18 Thread Mihail Konev
On Mon, Feb 13, 2017 at 11:01:39PM -0800, Alan Coopersmith wrote:
> > On 02/ 9/17 09:47 PM, Mihail Konev wrote:
> >> Libtool was moving the *.O libraries in front of all others on
> >> the gcc command line, which was necessiating "ld -r"
> >> (so that symbols from now-moved os.O are visible from the following
> >> libs), which, in turn, was altering the linker behaviour against os/
> >> and dix/ between with-/usr/bin/dtrace and --with-dtrace=no builds.
> 
> ld -r was used not because of libtool, but because the dtrace data in the
> ELF files gets properly included in a relocatable object, but not a static
> library.  (This is probably because of a misuse of ELF by dtrace, but that's
> the way it works, and has for over a decade.)
> 

Then rather than "Fixes:", it should be

  Updates: 49a26681 ("Add DTrace probe points")


Mihail
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] os,dix: relocate when without dtrace

2017-02-18 Thread Mihail Konev
On Sat, Feb 18, 2017 at 01:24:19PM +0500, Mihail Konev wrote:
> On Mon, Feb 13, 2017 at 11:01:39PM -0800, Alan Coopersmith wrote:
> > > On 02/ 9/17 09:47 PM, Mihail Konev wrote:
> > >> Libtool was moving the *.O libraries in front of all others on
> > >> the gcc command line, which was necessiating "ld -r"
> > >> (so that symbols from now-moved os.O are visible from the following
> > >> libs), which, in turn, was altering the linker behaviour against os/
> > >> and dix/ between with-/usr/bin/dtrace and --with-dtrace=no builds.
> > 
> > ld -r was used not because of libtool, but because the dtrace data in the
> > ELF files gets properly included in a relocatable object, but not a static
> > library.  (This is probably because of a misuse of ELF by dtrace, but that's
> > the way it works, and has for over a decade.)
> > 
> 
> Then rather than "Fixes:", it should be
> 
>   Updates: 49a26681 ("Add DTrace probe points")
> 

Sorry, the patch had no mistake there.
Instead, looking at the message, but not the build logs, I only recalled
the ar-is-insufficient issue, and not the libos-is-ar-ed one.

> 
> Mihail

Mihail
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: (timeout in ms vs. XSyncValueSubtract) Frozen client, found cause, need advise for fix

2017-02-21 Thread Mihail Konev
On Tue, Feb 21, 2017 at 05:48:19PM +0100, walter harms wrote:
> > 
>   
> XSyncValueSubtract is doing as expected,
> XSyncValue is the simulation of 64bitvalues on 32bit.
> see this in hex:
>  10001
> -2
>  0 = 4294967295 in .lo
> 

Kind of - it errorneously returns

 1  0001
-0  0002
 1  

Test source attached.

I.e.
  XSyncValueSubtract should handle the .lo becoming <0,
  and it checks only for .lo_after_subtract < .lo,
  which would only be aplicable to uint.

E.g. there is a typo in XSyncValue.lo definition - it should be uint
instead.
Also in ServertimeBlockHandler, "timeout" is unsigned,
while it is get from signed .lo and used as signed arg to
AdjustWaitForTimeout.

Perhaps also:
  AdjustWaitForTimeout should not be used if overflow != 0
  Because something is wrong then as (pnext_time < Now) ?

Mihail
#include 
#include 

typedef int Bool;

struct xtime {
	int32_t hi;
	int32_t lo;
};

struct utime {
	int32_t hi;
	uint32_t lo; /* uint vs. int doesn't seem to matter, in XSyncValueSubtract too */
};

void print_xtime(char *comment, struct xtime *x, Bool in_hex) {
	printf("%s: { hi=%d lo=%d }\n", comment, x->hi, x->lo);
	if (in_hex) {
	  printf("%s: { hi=%x lo=%x }\n", comment, x->hi, x->lo);
	}
}

void print_utime(char *comment, struct utime *x, Bool in_hex) {
	printf("%s: { hi=%d lo=%u }\n", comment, x->hi, x->lo);
	if (in_hex) {
	  printf("%s: { hi=%x lo=%x }\n", comment, x->hi, x->lo);
	}
}

void set_xtime(struct xtime *x, int hi, int lo) {
	x->hi = hi;
	x->lo = lo;
}

void set_utime(struct utime *x, int hi, int lo) {
	x->hi = hi;
	x->lo = lo;
}

#define XSyncValueIsNegative(v) (((v).hi & 0x8000) ? 1 : 0)

#define _XSyncValueSubtract(presult,a,b,poverflow) {\
	int t = (a).lo;\
	Bool signa = XSyncValueIsNegative(a);\
	Bool signb = XSyncValueIsNegative(b);\
	((presult)->lo = (a).lo - (b).lo);\
	((presult)->hi = (a).hi - (b).hi);\
	if (t<(presult)->lo) (presult)->hi--;\
	*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
 }

#define FixedXSyncValueSubtract(presult,a,b,poverflow) {\
	uint32_t t = (a).lo;\
	Bool signa = XSyncValueIsNegative(a);\
	Bool signb = XSyncValueIsNegative(b);\
	((presult)->lo = (a).lo - (b).lo);\
	((presult)->hi = (a).hi - (b).hi);\
	if (t<(presult)->lo || (presult)->lo < 0) (presult)->hi--;\
	*poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
 }

void test_subtract(int a_hi, int a_lo, int b_hi, int b_lo) {
	int overflow;
	struct xtime d, a, b;
	struct utime ud, ua, ub;

	set_xtime(&a, a_hi, a_lo);
	set_xtime(&b, b_hi, b_lo);

	print_xtime("a", &a, 0);
	print_xtime("b", &b, 0);
	_XSyncValueSubtract(&d, a, b, &overflow);
	print_xtime("a-b", &d, 1);
	printf("a-b overflow: %c\n", (overflow ? 'y' : 'n'));

	set_utime(&ua, a_hi, a_lo);
	set_utime(&ub, b_hi, b_lo);
	
	FixedXSyncValueSubtract(&ud, ua, ub, &overflow);
	print_utime("fixed a-b", &ud, 1);
	printf("fixed a-b overflow: %c\n", (overflow ? 'y' : 'n'));

	printf("\n");
}

int main(int argc, char **argv) {
	test_subtract(2, 2, 1, 4);
	test_subtract(2, 2, 4, 0);
	test_subtract(1, 1, 0, 2);
	return 0;
}
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: (timeout in ms vs. XSyncValueSubtract) Frozen client, found cause, need advise for fix

2017-02-21 Thread Mihail Konev
On Wed, Feb 22, 2017 at 12:28:19AM +0500, Mihail Konev wrote:
> 
> Kind of - it errorneously returns
> 
>  1  0001
> -0  0002
>  1  
> 

Oh.
This shouldn't matter in this case, as only   is used.

Offtop, sorry.

Mihail
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: (timeout in ms vs. XSyncValueSubtract) Frozen client, found cause, need advise for fix

2017-02-21 Thread Mihail Konev
On Wed, Feb 22, 2017 at 12:28:19AM +0500, Mihail Konev wrote:
> 
> E.g. there is a typo in XSyncValue.lo definition - it should be uint
> instead.

Also wrong, the entire post was wrong, it was typo in my source.

Mihail
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 5/7] hw/xquartz: fix path to pseudoramiX headers

2017-03-31 Thread Mihail Konev
Regressed-in: 39c548da0cf0522ad246630605b96751ab6d39c0
Signed-off-by: Mihail Konev 
---
This fixes out-of-source XQuartz build.

 hw/xquartz/Makefile.am | 2 +-
 hw/xquartz/xpr/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 4da896d76173..5ccbe48917bc 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -8,7 +8,7 @@ AM_CPPFLAGS = \
-DUSE_NEW_CLUT \
-DXFree86Server \
-I$(top_srcdir)/miext/rootless \
-   -I$(top_builddir)/pseudoramiX \
+   -I$(top_srcdir)/pseudoramiX \
-DX11LIBDIR=\"$(libdir)\"
 
 if GLX
diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
index c654ee595cb9..e4b138617805 100644
--- a/hw/xquartz/xpr/Makefile.am
+++ b/hw/xquartz/xpr/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libXquartzXpr.la
 AM_CFLAGS =  $(DIX_CFLAGS)
 AM_CPPFLAGS = \
-I$(srcdir) -I$(srcdir)/.. \
-   -I$(top_builddir)/pseudoramiX \
+   -I$(top_srcdir)/pseudoramiX \
-I$(top_srcdir)/miext \
-I$(top_srcdir)/miext/rootless
 
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 4/7] hw/xquartz: add missing destdir

2017-03-31 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
This allows running "make distcheck" as a non-root.

(Although the resulting DESTDIR includes the path to source tree *twice* ;)

 hw/xquartz/mach-startup/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xquartz/mach-startup/Makefile.am 
b/hw/xquartz/mach-startup/Makefile.am
index 77962b14d19c..17f0b9d4ddc4 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -6,7 +6,7 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
-x11appdir = 
$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS
+x11appdir = 
$(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS
 x11app_PROGRAMS = X11.bin
 
 dist_X11_bin_SOURCES = \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 3/7] hw/xfree86: add suid wrapper to uninstall target

2017-03-31 Thread Mihail Konev
Signed-off-by: Mihail Konev 
---
Not that this matters, but makes the distcheck not to fail.

 hw/xfree86/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 85bd0bed0e58..00f0ee116d68 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -120,6 +120,7 @@ endif
 
 uninstall-hook:
$(AM_V_at)rm -f $(DESTDIR)$(bindir)/X
+   $(AM_V_at)rm -f $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg
 
 # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration
 # Do not include manpages.am as values are not appropriate for rc files
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

  1   2   >