summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2006-07-11 17:27:08 -0400
committerBehdad Esfahbod <behdad@behdad.org>2006-07-11 17:27:08 -0400
commit94bdbc15f79308269f1bcd74b3d8899f8458babc (patch)
tree93b35b6dd720c320e3e01aefad5311cb2b884efa /test
parentc45a9321759e5cc0fcf6eda85f91d09ebb4db0d2 (diff)
Improve test suite build infrastructure
- Add new target recheck, that checks only failed tests - Add targets test and retest, and make html after (re)checking - Make targets html and index.html lazy, only update if any tests changed - Improve build system such that checking one test (using TESTS=...) doesn't build all tests - Remove pixman-rotate from XFAIL
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am69
-rw-r--r--test/cairo-test.c7
-rw-r--r--test/pixman-rotate.c3
3 files changed, 63 insertions, 16 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 4cdabcfd..75ab81c8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -364,11 +364,21 @@ a8-mask \
extend-reflect \
filter-nearest-offset \
leaky-dash \
-pixman-rotate \
self-intersecting \
text-rotate
-check_PROGRAMS = $(TESTS)
+# Any test that doesn't generate a log file goes here
+NOLOG_TESTS = \
+create-for-stream \
+user-data \
+svg-surface \
+svg-clip \
+pdf-features \
+ps-features \
+multi-page \
+fallback-resolution
+
+SUPPORT_PROGS =
# We're using _GNU_SOURCE to get the prototype for asprintf. This may
# not be the most portable approach, but it is pragmatic and I'm
@@ -382,7 +392,7 @@ INCLUDES = \
-I$(top_srcdir)/src \
$(CAIRO_CFLAGS)
-check_LTLIBRARIES = libcairotest.la
+EXTRA_LTLIBRARIES = libcairotest.la
libcairotest_la_SOURCES =\
buffer-diff.c \
@@ -425,20 +435,22 @@ if HAVE_PTHREAD
LDADD += -lpthread
endif
-check_PROGRAMS += imagediff png-flatten
+SUPPORT_PROGS += imagediff png-flatten
if CAIRO_CAN_TEST_PDF_SURFACE
-check_PROGRAMS += pdf2png
+SUPPORT_PROGS += pdf2png
pdf2png_CFLAGS = $(POPPLER_CFLAGS)
pdf2png_LDADD = $(LDADD) $(POPPLER_LIBS)
endif
if CAIRO_CAN_TEST_SVG_SURFACE
-check_PROGRAMS += svg2png
+SUPPORT_PROGS += svg2png
svg2png_CFLAGS = $(LIBRSVG_CFLAGS)
svg2png_LDADD = $(LIBRSVG_LIBS)
endif
+EXTRA_PROGRAMS = $(TESTS) $(SUPPORT_PROGS)
+
CLEANFILES = \
*.ps \
*.pdf \
@@ -446,20 +458,55 @@ CLEANFILES = \
*-out.png \
*-diff.png \
*.log \
+ valgrind-log \
multi-page.ps \
multi-page.pdf \
pdf-features.pdf \
ps-features.ps \
svg-surface.svg \
svg-clip.svg \
- index.html
+ index.html \
+ $(EXTRA_LTLIBRARIES) \
+ $(EXTRA_PROGRAMS)
+# Check tests under valgrind
+# Saves log to valgrind-log
check-valgrind:
- TESTS_ENVIRONMENT="$(top_srcdir)/libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes" $(MAKE) check 2>&1 | tee valgrind.log
+ TESTS_ENVIRONMENT="$(top_srcdir)/libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes" $(MAKE) check 2>&1 | tee valgrind-log
+
+# Re-checks all failed tests, i.e. tests with a log file that has a failure
+recheck:
+ @echo Re-checking failed tests
+ @$(MAKE) check TESTS="`grep -l '\<FAIL\>' *.log | sed 's/[.]log$$//' | tr '\n' ' '`"
+
+# Checks tests and creates index.html.
+# Target doesn't fail if tests fail.
+test:
+ @-$(MAKE) check
+ @$(MAKE) html
+# Re-checks tests and creates index.html.
+# Target doesn't fail if tests fail.
+retest:
+ @-$(MAKE) recheck
+ @$(MAKE) html
+
+# Make index.html
html: index.html
-index.html:
- perl $(srcdir)/make-html.pl > index.html
-.PHONY: check-valgrind html index.html
+$(TESTS): $(SUPPORT_PROGS)
+
+%.log: %
+ -./$<
+
+NOLOG_TESTS_LOG = $(NOLOG_TESTS:=.log)
+
+$(NOLOG_TESTS_LOG):
+ echo dummy > $@
+
+index.html: $(TESTS:=.log)
+ @echo Creating index.html
+ @perl $(srcdir)/make-html.pl > index.html
+
+.PHONY: check-valgrind test recheck retest html
diff --git a/test/cairo-test.c b/test/cairo-test.c
index d750e952..bea87f49 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1780,13 +1780,13 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
srcdir = ".";
if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL) {
- const char *tname = getenv ("CAIRO_TEST_TARGET");
+ char *tname = getenv ("CAIRO_TEST_TARGET");
num_targets = 0;
targets_to_test = NULL;
while (*tname) {
int found = 0;
- const char *end = strpbrk (tname, " \t;:,");
+ char *end = strpbrk (tname, " \t;:,");
if (!end)
end = tname + strlen (tname);
@@ -1801,7 +1801,8 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
}
if (!found) {
- fprintf (stderr, "CAIRO_TEST_TARGET '%s' not found in targets list!\n", tname);
+ *end = '\n';
+ fprintf (stderr, "Cannot test target '%s'\n", tname);
exit(-1);
}
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c
index a0a321ab..9c3a0fb2 100644
--- a/test/pixman-rotate.c
+++ b/test/pixman-rotate.c
@@ -70,6 +70,5 @@ draw (cairo_t *cr, int width, int height)
int
main (void)
{
- return cairo_test_expect_failure (&test, draw,
- "known off-by-one bug when rotating a pixman image");
+ return cairo_test (&test, draw);
}