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 ..

  [xserver]$ grep '\[XORG\]' configure.ac
  AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
  [xserver]$

Which is 'yes' unless it is --disable-xorg, Windows, or Mac.

  [xserver]$ grep '\bXORG\b.*=' configure.ac -C0
  AC_ARG_ENABLE(xorg,   AS_HELP_STRING([--enable-xorg], [Build Xorg 
server (default: auto)]), [XORG=$enableval], [XORG=auto])
  --
  if test "x$XORG" = xauto; then
  

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 

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

2017-01-16 Thread Adam Jackson
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
___
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-16 Thread Jon Turney

On 14/01/2017 10:19, 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.


Can we see these 3 things as separate patches, please?

Something is definitely needed to fix static linkage, but I can't really 
see what you've done when it's jumbled in with other stuff.

(and hidden under a title of 'fix --disable-xorg build'.

___
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