[cairo-commit] 2 commits - Makefile.am test/cairo-test.c test/ft-text-vertical-layout.c test/ft-text-vertical-layout-ps-argb32-ref.png test/ft-text-vertical-layout-ref.png test/ft-text-vertical-layout-svg-argb32-ref.png test/ft-text-vertical-layout-svg-rgb24-ref.png test/Makefile.am test/pixman-rotate.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Jul 11 14:27:16 PDT 2006


 Makefile.am                                     |    4 +
 test/Makefile.am                                |   69 ++++++++++++++++++++----
 test/cairo-test.c                               |    7 +-
 test/ft-text-vertical-layout-ps-argb32-ref.png  |binary
 test/ft-text-vertical-layout-ref.png            |binary
 test/ft-text-vertical-layout-svg-argb32-ref.png |binary
 test/ft-text-vertical-layout-svg-rgb24-ref.png  |binary
 test/ft-text-vertical-layout.c                  |    4 -
 test/pixman-rotate.c                            |    3 -
 9 files changed, 68 insertions(+), 19 deletions(-)

New commits:
diff-tree 94bdbc15f79308269f1bcd74b3d8899f8458babc (from c45a9321759e5cc0fcf6eda85f91d09ebb4db0d2)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Jul 11 17:27:08 2006 -0400

    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

diff --git a/Makefile.am b/Makefile.am
index 131af9c..7855fd6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,11 @@
 DIST_SUBDIRS = pixman src test doc
 SUBDIRS = pixman src doc
 
-.PHONY: doc
+.PHONY: doc test
 doc:
 	-$(MAKE) -C doc doc
+test:
+	-$(MAKE) -C test test
 
 # libpng is required for our test programs
 if CAIRO_HAS_PNG_FUNCTIONS
diff --git a/test/Makefile.am b/test/Makefile.am
index 4cdabcf..75ab81c 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 d750e95..bea87f4 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1780,13 +1780,13 @@ cairo_test_expecting (cairo_test_t *test
 	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
 	    }
 
 	    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 a0a321a..9c3a0fb 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);
 }
diff-tree c45a9321759e5cc0fcf6eda85f91d09ebb4db0d2 (from fe647ca42b24ff844dd0d94642adaf46ea7a28dd)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Jul 11 16:07:13 2006 -0400

    Use Bitstream Vera Sans and Latin text in ft-text-vertical.
    We don't really rely on the Japanese text and font, as FreeType
    synthesizes vertical metrics for all fonts.

diff --git a/test/ft-text-vertical-layout-ps-argb32-ref.png b/test/ft-text-vertical-layout-ps-argb32-ref.png
index ba51c30..b832e23 100644
Binary files a/test/ft-text-vertical-layout-ps-argb32-ref.png and b/test/ft-text-vertical-layout-ps-argb32-ref.png differ
diff --git a/test/ft-text-vertical-layout-ref.png b/test/ft-text-vertical-layout-ref.png
index 2aa82e4..a7a0590 100644
Binary files a/test/ft-text-vertical-layout-ref.png and b/test/ft-text-vertical-layout-ref.png differ
diff --git a/test/ft-text-vertical-layout-svg-argb32-ref.png b/test/ft-text-vertical-layout-svg-argb32-ref.png
index 7b82d9a..bf4db9b 100644
Binary files a/test/ft-text-vertical-layout-svg-argb32-ref.png and b/test/ft-text-vertical-layout-svg-argb32-ref.png differ
diff --git a/test/ft-text-vertical-layout-svg-rgb24-ref.png b/test/ft-text-vertical-layout-svg-rgb24-ref.png
index a1c8a83..d36f5e5 100644
Binary files a/test/ft-text-vertical-layout-svg-rgb24-ref.png and b/test/ft-text-vertical-layout-svg-rgb24-ref.png differ
diff --git a/test/ft-text-vertical-layout.c b/test/ft-text-vertical-layout.c
index 9aa776d..5a28778 100644
--- a/test/ft-text-vertical-layout.c
+++ b/test/ft-text-vertical-layout.c
@@ -59,7 +59,7 @@ create_scaled_font (cairo_t * cr)
 
     pattern = FcPatternCreate ();
 
-    FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *)"AR PL KaitiM GB");
+    FcPatternAddString (pattern, FC_FAMILY, (FcChar8 *)"Bitstream Vera Sans");
     FcPatternAddDouble (pattern, FC_PIXEL_SIZE, TEXT_SIZE);
     FcConfigSubstitute (NULL, pattern, FcMatchPattern);
 
@@ -99,7 +99,7 @@ draw (cairo_t *cr, int width, int height
 {
     cairo_text_extents_t extents;
     cairo_scaled_font_t * scaled_font;
-    static char black[] = "黑色", blue[] = "蓝色";
+    static char black[] = "AB", blue[] = "cd";
 
     /* We draw in the default black, so paint white first. */
     cairo_save (cr);


More information about the cairo-commit mailing list