1 include $(top_srcdir)/build/Makefile.am.common
3 include $(top_srcdir)/test/Makefile.sources
7 # Then we have a collection of tests that are only run if certain
8 # features are compiled into cairo
10 test_sources += $(pthread_test_sources)
15 test_sources += $(ft_font_test_sources)
19 if CAIRO_HAS_EGL_FUNCTIONS
20 test_sources += $(egl_surface_test_sources)
23 # Need to add quartz-surface-source
24 if CAIRO_HAS_QUARTZ_SURFACE
25 test_sources += $(quartz_surface_test_sources)
28 if CAIRO_HAS_PDF_SURFACE
29 test_sources += $(pdf_surface_test_sources)
32 if CAIRO_HAS_PS_SURFACE
33 test_sources += $(ps_surface_test_sources)
36 if CAIRO_HAS_SVG_SURFACE
37 test_sources += $(svg_surface_test_sources)
40 if CAIRO_HAS_TEST_SURFACES
41 test_sources += $(test_fallback16_surface_test_sources)
44 if CAIRO_HAS_XCB_SURFACE
45 test_sources += $(xcb_surface_test_sources)
48 if CAIRO_HAS_XLIB_SURFACE
49 test_sources += $(xlib_surface_test_sources)
52 if CAIRO_HAS_XLIB_XRENDER_SURFACE
53 test_sources += $(xlib_xrender_surface_test_sources)
56 if CAIRO_HAS_MULTI_PAGE_SURFACES
57 test_sources += $(multi_page_surface_test_sources)
60 # Include fallback-resolution (once!) if we have any of the vector surfaces
62 if CAIRO_HAS_SVG_SURFACE
63 test = $(fallback_resolution_test_sources)
65 if CAIRO_HAS_PDF_SURFACE
66 test = $(fallback_resolution_test_sources)
68 if CAIRO_HAS_PS_SURFACE
69 test = $(fallback_resolution_test_sources)
72 test_sources += $(test)
74 noinst_PROGRAMS = cairo-test-suite$(EXEEXT) # always build
75 noinst_SCRIPTS = check-refs.sh
77 TESTS += cairo-test-suite$(EXEEXT)
79 cairo-test-constructors.c: Makefile $(test_sources) make-cairo-test-constructors.sh
80 (cd $(srcdir) && sh ./make-cairo-test-constructors.sh $(test_sources)) > $@
82 cairo_test_suite_SOURCES = \
83 $(cairo_test_suite_sources) \
84 $(cairo_test_suite_headers) \
86 cairo-test-constructors.c
87 cairo_test_suite_CFLAGS = $(AM_CFLAGS) $(real_pthread_CFLAGS)
88 cairo_test_suite_LDADD = \
89 $(real_pthread_LIBS) \
90 $(top_builddir)/test/pdiff/libpdiff.la \
91 $(top_builddir)/boilerplate/libcairoboilerplate.la \
92 $(top_builddir)/src/libcairo.la \
94 cairo_test_suite_DEPENDENCIES = \
95 $(top_builddir)/test/pdiff/libpdiff.la \
96 $(top_builddir)/boilerplate/libcairoboilerplate.la \
97 $(top_builddir)/src/libcairo.la
99 cairo_test_suite_DEPENDENCIES += \
104 EXTRA_PROGRAMS += cairo-test-trace
105 cairo_test_trace_SOURCES = \
109 cairo_test_trace_CFLAGS = $(AM_CFLAGS) $(real_pthread_CFLAGS)
110 cairo_test_trace_LDADD = \
111 $(real_pthread_LIBS) \
112 $(top_builddir)/test/pdiff/libpdiff.la \
113 $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
114 $(top_builddir)/boilerplate/libcairoboilerplate.la \
115 $(top_builddir)/src/libcairo.la \
116 $(top_builddir)/util/cairo-missing/libcairo-missing.la \
119 cairo_test_trace_DEPENDENCIES = \
120 $(top_builddir)/test/pdiff/libpdiff.la \
121 $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
122 $(top_builddir)/boilerplate/libcairoboilerplate.la \
123 $(top_builddir)/src/libcairo.la \
124 $(top_builddir)/util/cairo-missing/libcairo-missing.la \
128 BUILT_SOURCES += cairo-test-constructors.c
129 EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING make-cairo-test-constructors.sh run-cairo-test-suite.sh generate_refs.sh tiger.inc
130 CLEANFILES += $(BUILT_SOURCES)
145 # Any test that doesn't generate a log file goes here
147 fallback-resolution \
159 # A target to summarise the failures
162 for t in output/*.log; do \
163 if grep -e '\<FAIL\>' $$t >/dev/null 2>&1; then \
164 FAILED_TESTS="$$FAILED_TESTS $$t"; \
167 if test -n "$$FAILED_TESTS"; then \
168 echo "Failed tests:"; \
170 for t in $$FAILED_TESTS; do \
171 name="$${t##output/}"; name="$${name%.log}"; \
172 echo -n " $$name: "; \
173 grep -e '\<FAIL\>' $$t | sed -e 's/.*TARGET: \([^ ]*\).*/\1/' | sort | uniq | tr '\n' ' '; \
175 for s in `grep -e '\<FAIL\>' $$t | sed -e 's/.*TARGET: \([^ ]*\).*/\1/' | sort | uniq`; do \
176 ss=`echo $$s | tr '-' '_'`; \
177 tt=`echo $$name | tr '-' '_'`; \
178 eval $$ss=\""$${!ss} $$tt"\"; \
179 echo $$surfaces | grep $$ss >/dev/null || surfaces="$$surfaces $$ss"; \
182 echo -n "Failures per surface - "; \
184 for s in $$surfaces; do \
185 ss=`echo $$s | tr '_' '-'`; \
186 test -n "$$first" && echo -n ", "; \
187 cnt=`echo $${!s} | wc -w`; \
188 echo -n "$$ss: $$cnt"; \
192 for s in $$surfaces; do \
193 ss=`echo $$s | tr '_' '-'`; \
194 cnt=`echo $${!s} | wc -w`; \
195 echo -n " $$ss [$$cnt]: "; \
196 echo $${!s} | tr '_' '-'; \
203 -I$(top_srcdir)/boilerplate \
204 -I$(top_srcdir)/util/cairo-missing \
205 -I$(top_srcdir)/util/cairo-script \
206 -I$(top_srcdir)/src \
207 -I$(top_builddir)/src \
209 AM_LDFLAGS = $(CAIRO_LDFLAGS)
211 $(top_builddir)/boilerplate/libcairoboilerplate.la: $(top_builddir)/src/libcairo.la
212 cd $(top_builddir)/boilerplate && $(MAKE) $(AM_MAKEFLAGS) libcairoboilerplate.la
214 $(top_builddir)/src/libcairo.la:
215 cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libcairo.la
217 $(top_builddir)/test/pdiff/libpdiff.la:
218 cd $(top_builddir)/test/pdiff && $(MAKE) $(AM_MAKEFLAGS) libpdiff.la
220 $(top_builddir)/test/pdiff/perceptualdiff:
221 cd $(top_builddir)/test/pdiff && $(MAKE) $(AM_MAKEFLAGS) perceptualdiff
223 $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la: $(top_builddir)/src/libcairo.la
224 cd $(top_builddir)/util/cairo-script && $(MAKE) $(AM_MAKEFLAGS) libcairo-script-interpreter.la
226 EXTRA_PROGRAMS += imagediff png-flatten
228 imagediff_SOURCES = \
233 $(top_builddir)/test/pdiff/libpdiff.la \
234 $(top_builddir)/src/libcairo.la
236 png_flatten_SOURCES = png-flatten.c
237 png_flatten_LDADD = $(top_builddir)/src/libcairo.la \
241 check_PROGRAMS += any2ppm
242 any2ppm_CFLAGS = $(AM_CFLAGS) $(POPPLER_CFLAGS) $(LIBRSVG_CFLAGS) $(LIBSPECTRE_CFLAGS)
243 # add LDADD, so poppler/librsvg uses "our" cairo
244 any2ppm_LDFLAGS = $(AM_LDFLAGS) $(CAIRO_TEST_UNDEFINED_LDFLAGS)
246 $(top_builddir)/util/cairo-script/libcairo-script-interpreter.la \
247 $(top_builddir)/src/libcairo.la \
249 $(CAIROBOILERPLATE_LIBS) \
255 if CAIRO_CAN_TEST_PDF_SURFACE
256 check_PROGRAMS += pdf2png
257 pdf2png_CFLAGS = $(AM_CFLAGS) $(POPPLER_CFLAGS)
258 # add LDADD, so poppler uses "our" cairo
259 pdf2png_LDFLAGS = $(AM_LDFLAGS) $(CAIRO_TEST_UNDEFINED_LDFLAGS)
260 pdf2png_LDADD = $(top_builddir)/src/libcairo.la \
265 if CAIRO_CAN_TEST_SVG_SURFACE
266 check_PROGRAMS += svg2png
267 svg2png_CFLAGS = $(AM_CFLAGS) $(LIBRSVG_CFLAGS)
268 # add LDADD, so librsvg uses "our" cairo
269 svg2png_LDFLAGS = $(AM_LDFLAGS) $(CAIRO_TEST_UNDEFINED_LDFLAGS)
270 svg2png_LDADD = $(top_builddir)/src/libcairo.la \
276 check_PROGRAMS += ps2png
277 ps2png_CFLAGS = $(AM_CFLAGS) $(LIBSPECTRE_CFLAGS)
278 # add LDADD, so ps2png uses "our" cairo
279 ps2png_LDFLAGS = $(AM_LDFLAGS) $(CAIRO_TEST_UNDEFINED_LDFLAGS)
280 ps2png_LDADD = $(top_builddir)/src/libcairo.la \
285 EXTRA_PROGRAMS += $(TESTS)
287 # Do a funny transition of CAIRO_TEST_TARGET through TARGETS such that
288 # one can limit tested targets both through CAIRO_TEST_TARGET env var
289 # and TARGETS make var on the command line. Same for the rest.
290 TARGETS = $(CAIRO_TEST_TARGET)
291 TARGETS_EXCLUDE = $(CAIRO_TEST_TARGET_EXCLUDE)
292 FORMAT = $(CAIRO_TEST_TARGET_FORMAT)
293 NUM_THREADS = $(CAIRO_TEST_NUM_THREADS)
294 MODE = $(CAIRO_TEST_MODE)
296 # Same about ENV vs CAIRO_TEST_ENV. ENV is used with "make run" only
297 ENV = $(CAIRO_TEST_ENV)
299 TESTS_ENVIRONMENT = CAIRO_TEST_MODE="$(MODE)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_FORMAT="$(FORMAT)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)" CAIRO_TEST_NUM_THREADS="$(NUM_THREADS)" $(ENV)
301 EXTRA_VALGRIND_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
303 --tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \
304 --track-origins=yes \
305 --leak-check=yes --show-reachable=yes \
306 $(EXTRA_VALGRIND_FLAGS)
314 create-for-stream.pdf \
315 create-for-stream.ps \
316 create-for-stream.svg \
317 svg-surface-source.out.svg \
318 pdf-surface-source.out.pdf \
319 ps-surface-source.out.ps \
329 # This used to be a simple 'echo ${RM} *.ps *.pdf *.svg *.etc', but
330 # most systems cannot handle all of our clean files together.
331 # Then it became a fancy find using many GNU extensions, but then the ugly
332 # reality of portability was raised and it became....
335 -${FIND} . -name '*.log' -print | ${XARGS} ${RM}
336 -${FIND} . -name '*.[is]' -print | ${XARGS} ${RM}
338 -${FIND} output -name '*.fail.*' -print | ${XARGS} ${RM}
339 -${FIND} output -name '*.pass.*' -print | ${XARGS} ${RM}
341 # The following definitions both should work.
342 #FAILED_TESTS = `grep -l '\<FAIL\>' $(test_sources:.c=.log) 2>/dev/null | sed -e 's/[.]log$$//' | xargs echo`
343 FAILED_TESTS = `grep -l '\<FAIL\>' $(test_sources:.c=.log) 2>/dev/null | tr '\n' ' ' | sed -e 's/[.]log */ /g; s/^ //; s/ $$//'`
345 recheck = check CAIRO_TESTS="$(FAILED_TESTS)"
347 # Re-checks all failed tests, i.e. tests with a log file that has a failure
349 @echo Re-checking failed tests
350 @$(MAKE) $(AM_MAKEFLAGS) $(recheck)
353 # Target doesn't fail if tests fail.
355 @$(MAKE) $(AM_MAKEFLAGS) check
358 # Target doesn't fail if tests fail.
360 @CAIRO_TESTS="$(FAILED_TESTS)"; \
361 $(MAKE) $(AM_MAKEFLAGS) check
363 # Run tests under a tool specified by TOOL. For example, make run TOOL=gdb
365 $(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute env $(TOOL)'
367 # Check tests under valgrind. Saves log to valgrind-log
369 $(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) CAIRO_TEST_MODE="$(MODE),foreground CAIRO_TEST_TIMEOUT=0" $(top_builddir)/libtool --mode=execute valgrind $(VALGRIND_FLAGS)' 2>&1 | tee valgrind-log
371 #%.log: %.c cairo-test-suite
372 #-./cairo-test-suite $(<:.c=)
374 NOLOG_TESTS_LOG = $(NOLOG_TESTS:=.log)
379 # Identify identical reference images
380 check-ref-dups: check-refs.sh $(top_builddir)/test/pdiff/perceptualdiff
381 sh $(srcdir)/check-refs.sh $(top_builddir)/test/pdiff/perceptualdiff
383 # Remove identical reference images (DANGEROUS)
384 clean-ref-dups: check-refs.sh $(top_builddir)/test/pdiff/perceptualdiff
385 sh $(srcdir)/check-refs.sh | cut -d' ' -f2 | while read f; do git rm "reference/$$f"; done
388 @tar cf $@ index.html testtable.js *.log output/*.log; \
389 for i in output/*.fail.png ; do \
390 testname=$${i#output/} ; \
391 testname=$${testname%%.*} ; \
392 echo tar uf $@ reference/$${testname}*.ref.png $${i%fail.png}out.png $${i%fail.png}diff.png ; \
393 tar uf $@ reference/$${testname}*.ref.png $${i%fail.png}out.png $${i%fail.png}diff.png ; \
396 results.tar.gz: results.tar
399 release-verify-sane-tests:
401 .PHONY: check-valgrind test recheck retest check-ref-dups release-verify-sane-tests
403 EXTRA_DIST += Makefile.win32