build: Add test wrappers to the main ignore file
[profile/ivi/clutter.git] / tests / conform / Makefile.am
1 include $(top_srcdir)/build/autotools/Makefile.am.silent
2
3 NULL =
4
5 noinst_PROGRAMS = test-conformance
6
7 # the common sources
8 common_sources = \
9         test-conform-common.h   \
10         test-conform-common.c   \
11         test-conform-main.c     \
12         $(NULL)
13
14 # the unit-specific sources; please: keep all sections in alphabetical order!
15 units_sources =
16
17 # animation tests
18 units_sources += \
19         test-animator.c                 \
20         test-behaviours.c               \
21         test-score.c                    \
22         test-state.c                    \
23         test-timeline.c                 \
24         test-timeline-interpolate.c     \
25         test-timeline-rewind.c          \
26         $(NULL)
27
28 # cogl tests
29 units_sources += \
30         test-cogl-backface-culling.c            \
31         test-cogl-blend-strings.c               \
32         test-cogl-depth-test.c                  \
33         test-cogl-fixed.c                       \
34         test-cogl-materials.c                   \
35         test-cogl-viewport.c                    \
36         test-cogl-multitexture.c                \
37         test-cogl-npot-texture.c                \
38         test-cogl-object.c                      \
39         test-cogl-offscreen.c                   \
40         test-cogl-path.c                        \
41         test-cogl-pixel-buffer.c                \
42         test-cogl-premult.c                     \
43         test-cogl-readpixels.c                  \
44         test-cogl-sub-texture.c                 \
45         test-cogl-texture-3d.c                  \
46         test-cogl-texture-get-set-data.c        \
47         test-cogl-texture-mipmaps.c             \
48         test-cogl-texture-pixmap-x11.c          \
49         test-cogl-texture-rectangle.c           \
50         test-cogl-vertex-buffer-contiguous.c    \
51         test-cogl-vertex-buffer-interleved.c    \
52         test-cogl-vertex-buffer-mutability.c    \
53         test-cogl-wrap-modes.c                  \
54         $(NULL)
55
56 # actors tests
57 units_sources += \
58         test-actor-destroy.c            \
59         test-actor-size.c               \
60         test-actor-invariants.c         \
61         test-anchors.c                  \
62         test-binding-pool.c             \
63         test-clutter-cairo-texture.c    \
64         test-clutter-rectangle.c        \
65         test-clutter-text.c             \
66         test-clutter-texture.c          \
67         test-group.c                    \
68         test-path.c                     \
69         test-paint-opacity.c            \
70         test-pick.c                     \
71         test-texture-fbo.c              \
72         test-text-cache.c               \
73         $(NULL)
74
75 # objects tests
76 units_sources += \
77         test-clutter-units.c            \
78         test-color.c                    \
79         test-model.c                    \
80         test-script-parser.c            \
81         $(NULL)
82
83 test_conformance_SOURCES = $(common_sources) $(units_sources)
84
85 # For convenience, this provides a way to easily run individual unit tests:
86 .PHONY: wrappers clean-wrappers
87
88 #UNIT_TESTS = `./test-conformance -l -m thorough | $(GREP) '^/'`
89
90 wrappers: stamp-test-conformance
91         @true
92 stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c
93         @mkdir -p wrappers
94         @sed -n \
95                 -e 's/^ \{1,\}TEST_CONFORM_SIMPLE *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
96                 -e 's/^ \{1,\}TEST_CONFORM_SKIP *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
97                 -e 's/^ \{1,\}TEST_CONFORM_TODO *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
98         $(srcdir)/test-conform-main.c > unit-tests
99         @chmod +x test-launcher.sh
100         @( echo "/stamp-test-conformance" ; \
101            echo "/test-conformance" ; \
102            echo "*.o" ; \
103            echo "*.xml" ; \
104            echo "*.html" ; \
105            echo ".gitignore" ; \
106            echo "unit-tests" ; \
107            echo "/wrappers/" ) > .gitignore
108         @for i in `cat unit-tests`; \
109         do \
110                 unit=`basename $$i | sed -e s/_/-/g`; \
111                 echo "  GEN    $$unit"; \
112                 ( echo "#!/bin/sh" ; echo "$(abs_builddir)/test-launcher.sh '$$i' \"\$$@\"" ) > $$unit$(EXEEXT) ; \
113                 ( echo "#!/bin/sh" ; echo "exec $(abs_builddir)/test-conformance$(EXEEXT) -p $$i \"\$$@\"" ) > wrappers/$$unit$(EXEEXT) ; \
114                 chmod +x $$unit$(EXEEXT); \
115                 chmod +x wrappers/$$unit$(EXEEXT); \
116                 echo "/$$unit$(EXEEXT)" >> .gitignore; \
117         done \
118         && echo timestamp > $(@F)
119
120 clean-wrappers:
121         @for i in `cat unit-tests`; \
122         do \
123                 unit=`basename $$i | sed -e s/_/-/g`; \
124                 echo "  RM     $$unit"; \
125                 rm -f $$unit$(EXEEXT) ; \
126                 rm -f wrappers/$$unit$(EXEEXT) ; \
127         done \
128         && rm -f unit-tests \
129         && rm -f stamp-test-conformance
130
131 # NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting
132 # a phony rule that will generate symlink scripts for running individual tests
133 BUILT_SOURCES = wrappers
134
135 INCLUDES = \
136         -I$(top_srcdir)/ \
137         -I$(top_srcdir)/clutter \
138         -I$(top_srcdir)/clutter/cogl \
139         -I$(top_builddir)/clutter \
140         -I$(top_builddir)/clutter/cogl
141
142 test_conformance_CPPFLAGS = \
143         -DG_DISABLE_SINGLE_INCLUDES \
144         -DCOGL_ENABLE_EXPERIMENTAL_API \
145         -DCOGL_DISABLE_DEPRECATED \
146         -DCLUTTER_DISABLE_DEPRECATED \
147         -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\"
148
149 test_conformance_CFLAGS = -g $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
150
151 test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
152
153 test_conformance_LDFLAGS = -export-dynamic
154
155 test: wrappers
156         @$(top_srcdir)/tests/conform/run-tests.sh \
157           ./test-conformance$(EXEEXT) -o test-report.xml
158
159 test-verbose: wrappers
160         @$(top_srcdir)/tests/conform/run-tests.sh \
161           ./test-conformance$(EXEEXT) -o test-report.xml --verbose
162
163 GTESTER = gtester
164 GTESTER_REPORT = gtester-report
165
166 # XXX: we could prevent the conformance test suite from running
167 #      by simply defining this variable conditionally
168 TEST_PROGS = test-conformance
169
170 .PHONY: test
171 .PHONY: test-report perf-report full-report
172 .PHONY: test-report-npot perf-report-npot full-report-npot
173
174 # test-report: run tests and generate report
175 # perf-report: run tests with -m perf and generate report
176 # full-report: like test-report: with -m perf and -m slow
177 test-report perf-report full-report:    ${TEST_PROGS}
178         @test -z "${TEST_PROGS}" || { \
179           export GTESTER_LOGDIR=`mktemp -d "$(srcdir)/.testlogs-XXXXXX"` ; \
180           if test -d "$(top_srcdir)/.git"; then \
181             export REVISION="`git describe`" ;  \
182           else \
183             export REVISION="$(VERSION) $(CLUTTER_RELEASE_STATUS)" ; \
184           fi ; \
185           export TIMESTAMP=`date +%Y-%m-%dT%H:%M:%S%z` ; \
186           case $@ in \
187           test-report) test_options="-k";; \
188           perf-report) test_options="-k -m=perf";; \
189           full-report) test_options="-k -m=perf -m=slow";; \
190           esac ; \
191           $(top_srcdir)/tests/conform/run-tests.sh \
192             ./test-conformance$(EXEEXT) \
193             --verbose \
194             $$test_options \
195             -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ; \
196           echo '<?xml version="1.0"?>'              > $@.xml ; \
197           echo '<report-collection>'               >> $@.xml ; \
198           echo '<info>'                            >> $@.xml ; \
199           echo '  <package>$(PACKAGE)</package>'   >> $@.xml ; \
200           echo '  <version>$(VERSION)</version>'   >> $@.xml ; \
201           echo "  <revision>$$REVISION</revision>" >> $@.xml ; \
202           echo "  <date>$$TIMESTAMP</date>"        >> $@.xml ; \
203           echo '</info>'                           >> $@.xml ; \
204           for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
205             sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
206           done ; \
207           echo >> $@.xml ; \
208           echo '</report-collection>' >> $@.xml ; \
209           ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
210           rm -rf "$$GTESTER_LOGDIR" ; \
211         }
212
213 # same as above, but with a wrapper that forcibly disables non-power of
214 # two textures
215 test-report-npot perf-report-npot full-report-npot:     ${TEST_PROGS}
216         @test -z "${TEST_PROGS}" || { \
217           $(top_srcdir)/tests/tools/disable-npots.sh ; \
218           export GTESTER_LOGDIR=`mktemp -d "$(srcdir)/.testlogs-XXXXXX"` ; \
219           if test -d "$(top_srcdir)/.git"; then \
220             export REVISION="`git describe`" ;  \
221           else \
222             export REVISION="$(VERSION) $(CLUTTER_RELEASE_STATUS)" ; \
223           fi ; \
224           export TIMESTAMP=`date +%Y-%m-%dT%H:%M:%S%z` ; \
225           case $@ in \
226           test-report-npot) test_options="-k";; \
227           perf-report-npot) test_options="-k -m=perf";; \
228           full-report-npot) test_options="-k -m=perf -m=slow";; \
229           esac ; \
230           $(top_srcdir)/tests/conform/run-tests.sh \
231             ./test-conformance$(EXEEXT) \
232             --verbose \
233             $$test_options \
234             -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ; \
235           echo '<?xml version="1.0"?>'              > $@.xml ; \
236           echo '<report-collection>'               >> $@.xml ; \
237           echo '<info>'                            >> $@.xml ; \
238           echo '  <package>$(PACKAGE)</package>'   >> $@.xml ; \
239           echo '  <version>$(VERSION)</version>'   >> $@.xml ; \
240           echo "  <revision>$$REVISION</revision>" >> $@.xml ; \
241           echo "  <date>$$TIMESTAMP</date>"        >> $@.xml ; \
242           echo '</info>'                           >> $@.xml ; \
243           for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
244             sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
245           done ; \
246           echo >> $@.xml ; \
247           echo '</report-collection>' >> $@.xml ; \
248           ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
249           rm -rf "$$GTESTER_LOGDIR" ; \
250         }
251
252 XML_REPORTS = \
253         test-report.xml         \
254         perf-report.xml         \
255         full-report.xml         \
256         test-report-npot.xml    \
257         perf-report-npot.xml    \
258         full-report-npot.xml
259
260 HTML_REPORTS = \
261         test-report.html        \
262         perf-report.html        \
263         full-report.html        \
264         test-report-npot.html   \
265         perf-report-npot.html   \
266         full-report-npot.html
267
268 EXTRA_DIST = ADDING_NEW_TESTS test-launcher.sh.in run-tests.sh
269 DISTCLEANFILES = test-launcher.sh .gitignore
270
271 # we override the clean-generic target to clean up the wrappers so
272 # we cannot use CLEANFILES
273 clean-generic: clean-wrappers
274         $(QUIET_RM)rm -f $(XML_REPORTS) $(HTML_REPORTS)