1if ENABLE_UNIT_TESTS
2SUBDIRS= .
3AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
4AM_CPPFLAGS = $(XORG_INCS)
5
6tests_CPPFLAGS=
7CLEANFILES=
8
9tests_SOURCES = \
10        tests-common.c \
11	tests-common.h \
12        list.c \
13        string.c \
14        tests.c \
15	tests.h
16
17noinst_PROGRAMS = simple-xinit tests
18
19if XVFB
20XVFB_TESTS = scripts/xvfb-piglit.sh
21if XEPHYR
22if GLAMOR
23XEPHYR_GLAMOR_TESTS = scripts/xephyr-glamor-piglit.sh
24endif
25endif
26endif
27
28SCRIPT_TESTS = \
29	$(XVFB_TESTS) \
30	$(XEPHYR_GLAMOR_TESTS) \
31	$(NULL)
32
33TESTS = tests \
34	$(SCRIPT_TESTS) \
35	$(NULL)
36
37TESTS_ENVIRONMENT = \
38	XSERVER_DIR=$(abs_top_srcdir) \
39	XSERVER_BUILDDIR=$(abs_top_builddir) \
40	$(XORG_MALLOC_DEBUG_ENV) \
41	$(NULL)
42
43tests_LDADD =
44
45if XORG
46
47# Tests that require at least some DDX functions in order to fully link
48# For now, requires xf86 ddx, could be adjusted to use another
49
50AM_CPPFLAGS += \
51	-I$(srcdir)/xi1 \
52	-I$(srcdir)/xi2 \
53	-I$(top_srcdir)/hw/xfree86/common \
54	-I$(top_srcdir)/hw/xfree86/parser \
55	-I$(top_srcdir)/hw/xfree86/ddc \
56	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
57	-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
58	-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
59tests_CPPFLAGS += $(AM_CPPFLAGS)
60
61tests_SOURCES += \
62        fixes.c \
63        input.c \
64        misc.c \
65        signal-logging.c \
66        touch.c \
67        xfree86.c \
68        test_xkb.c \
69        xtest.c
70tests_CPPFLAGS += -DXORG_TESTS
71
72if RES
73tests_SOURCES += hashtabletest.c
74tests_CPPFLAGS += -DRES_TESTS
75endif
76
77endif XORG
78
79if HAVE_LD_WRAP
80
81tests_CPPFLAGS += -DLDWRAP_TESTS
82
83if XORG
84tests_SOURCES += \
85	xi1/protocol-xchangedevicecontrol.c \
86	xi2/protocol-common.c \
87	xi2/protocol-xiqueryversion.c \
88	xi2/protocol-xiquerydevice.c \
89	xi2/protocol-xiselectevents.c \
90	xi2/protocol-xigetselectedevents.c \
91	xi2/protocol-xisetclientpointer.c \
92	xi2/protocol-xigetclientpointer.c \
93	xi2/protocol-xiquerypointer.c \
94	xi2/protocol-xipassivegrabdevice.c \
95	xi2/protocol-xiwarppointer.c \
96	xi2/protocol-eventconvert.c \
97	xi2/xi2.c \
98	xi2/protocol-common.h
99
100tests_LDFLAGS = \
101	-Wl,-wrap,dixLookupWindow \
102	-Wl,-wrap,dixLookupClient \
103	-Wl,-wrap,WriteToClient \
104	-Wl,-wrap,dixLookupWindow \
105	-Wl,-wrap,XISetEventMask \
106	-Wl,-wrap,AddResource \
107	-Wl,-wrap,GrabButton \
108	$()
109endif XORG
110
111else !HAVE_LD_WRAP
112
113# Print that xi1-tests were skipped (exit code 77 for automake test harness)
114TESTS += xi1-tests
115CLEANFILES += xi1-tests
116
117xi1-tests:
118	@echo 'echo "ld -wrap support required for xi1 unit tests, skipping"' > $@
119	@echo 'exit 77' >> $@
120	$(AM_V_GEN)chmod +x $@
121
122# Print that xi2-tests were skipped (exit code 77 for automake test harness)
123TESTS += xi2-tests
124CLEANFILES += xi2-tests
125
126xi2-tests:
127	@echo 'echo "ld -wrap support required for xi2 unit tests, skipping"' > $@
128	@echo 'exit 77' >> $@
129	$(AM_V_GEN)chmod +x $@
130
131endif !HAVE_LD_WRAP
132
133if XORG
134
135nodist_tests_SOURCES = sdksyms.c
136
137tests_LDADD += \
138            $(top_builddir)/hw/xfree86/loader/libloader.la \
139            $(top_builddir)/hw/xfree86/common/libcommon.la \
140            $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
141            $(top_builddir)/hw/xfree86/parser/libxf86config.la \
142            $(top_builddir)/hw/xfree86/dixmods/libdixmods.la \
143            $(top_builddir)/hw/xfree86/modes/libxf86modes.la \
144            $(top_builddir)/hw/xfree86/ramdac/libramdac.la \
145            $(top_builddir)/hw/xfree86/ddc/libddc.la \
146            $(top_builddir)/hw/xfree86/i2c/libi2c.la \
147            $(top_builddir)/hw/xfree86/xkb/libxorgxkb.la \
148            $(top_builddir)/Xext/libXvidmode.la \
149            $(XSERVER_LIBS) \
150            $(XORG_LIBS)
151
152if !SPECIAL_DTRACE_OBJECTS
153tests_LDADD += $(top_builddir)/os/libos.la
154endif
155
156if GLX
157tests_LDADD += $(top_builddir)/glx/libglxvnd.la
158endif
159
160BUILT_SOURCES = sdksyms.c
161CLEANFILES += sdksyms.c
162
163sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
164	$(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
165
166if DRI
167tests_LDADD += $(top_builddir)/hw/xfree86/dri/libdri.la
168endif
169
170if DRI2
171tests_LDADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
172endif
173
174if DRI3
175tests_LDADD += $(top_builddir)/dri3/libdri3.la
176endif
177
178endif XORG
179
180# GNU LD scans only in one direction, add the following dependencies at the end
181# so as they get picked up by the previously-linked libraries
182tests_LDADD += $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
183
184endif ENABLE_UNIT_TESTS
185
186EXTRA_DIST = \
187	scripts/xvfb-piglit.sh \
188	scripts/xephyr-glamor-piglit.sh \
189	scripts/xinit-piglit-session.sh \
190	scripts/run-piglit.sh \
191	$(NULL)
192
193