[cairo-commit] test/cairo-test.c test/.gitignore test/Makefile.am

Chris Wilson ickle at kemper.freedesktop.org
Thu Aug 21 00:46:41 PDT 2008


 test/.gitignore   |    2 +-
 test/Makefile.am  |    4 ++--
 test/cairo-test.c |   22 +++++++++++-----------
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 17a6d541f88bb5627da436c5e516049c3317098a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 21 08:20:31 2008 +0100

    [test] Explicity save a fail image.
    
    Be explicit about handling cached FAIL images, instead of relying on the
    sequences of failed matches as the files are an external resource and we
    can not guarantee their individual accessibility.
    
    Note this also changes the filename, so you may want to run:
    $ find -name '*-last.*' -print | xargs rm
    after this checkout.

diff --git a/test/.gitignore b/test/.gitignore
index 2834165..3011930 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -224,7 +224,7 @@ zero-alpha
 valgrind-log
 *-out.*
 *-pass.*
-*-last.*
+*-fail.*
 *-diff.png
 *.manifest
 *.gcda
diff --git a/test/Makefile.am b/test/Makefile.am
index 8ee55c0..002f578 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -927,8 +927,8 @@ clean-local: clean-caches
 	-${FIND} . -name '*.log'      -print | ${XARGS} ${RM}
 	-${FIND} . -name '*.[is]'     -print | ${XARGS} ${RM}
 clean-caches:
-	-${FIND} . -name '*-pass.*' -print | ${XARGS} ${RM}
-	-${FIND} . -name '*-last.*' -print | ${XARGS} ${RM}
+	-${FIND} . -name '*-pass.*'   -print | ${XARGS} ${RM}
+	-${FIND} . -name '*-fail.*'   -print | ${XARGS} ${RM}
 
 # The following definitions both should work.
 #FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:$(EXEEXT)=.log) 2>/dev/null | sed -e 's/[.]log$$//' | xargs echo`
diff --git a/test/cairo-test.c b/test/cairo-test.c
index c02c44f..2108eb7 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -504,7 +504,7 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
     const char *empty_str = "";
     char *offset_str, *thread_str;
     char *base_name, *png_name, *ref_name, *diff_name;
-    char *test_filename = NULL, *pass_filename = NULL, *last_filename = NULL;
+    char *test_filename = NULL, *pass_filename = NULL, *fail_filename = NULL;
     cairo_test_status_t ret;
     cairo_content_t expected_content;
     cairo_font_options_t *font_options;
@@ -691,7 +691,7 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 		       base_name, target->file_extension);
 	    xasprintf (&pass_filename, "%s-pass%s",
 		       base_name, target->file_extension);
-	    xasprintf (&last_filename, "%s-last%s",
+	    xasprintf (&fail_filename, "%s-fail%s",
 		       base_name, target->file_extension);
 	    if (cairo_test_files_equal (test_filename, pass_filename)) {
 		/* identical output as last known PASS */
@@ -699,8 +699,8 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 		ret = CAIRO_TEST_SUCCESS;
 		goto UNWIND_CAIRO;
 	    }
-	    if (cairo_test_files_equal (test_filename, last_filename)) {
-		/* identical output as last time, fail */
+	    if (cairo_test_files_equal (test_filename, fail_filename)) {
+		/* identical output as last known FAIL, fail */
 		cairo_test_log (ctx, "Vector surface matches last fail.\n");
 		have_result = TRUE; /* presume these were kept around as well */
 		ret = CAIRO_TEST_FAILURE;
@@ -734,7 +734,7 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 	if (target->file_extension == NULL) {
 	    xasprintf (&test_filename, "%s", png_name);
 	    xasprintf (&pass_filename, "%s-pass.png", base_name);
-	    xasprintf (&last_filename, "%s-last.png", base_name);
+	    xasprintf (&fail_filename, "%s-fail.png", base_name);
 
 	    if (cairo_test_files_equal (test_filename, pass_filename)) {
 		/* identical output as last known PASS, pass */
@@ -751,9 +751,9 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 		goto UNWIND_CAIRO;
 	    }
 
-	    if (cairo_test_files_equal (test_filename, last_filename)) {
+	    if (cairo_test_files_equal (test_filename, fail_filename)) {
 		cairo_test_log (ctx, "PNG file exactly matches last fail.\n");
-		/* identical output as last known time, fail */
+		/* identical output as last known FAIL, fail */
 		have_result = TRUE; /* presume these were kept around as well */
 		cairo_surface_destroy (test_image);
 		ret = CAIRO_TEST_FAILURE;
@@ -805,12 +805,12 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 				cairo_status_to_string (diff_status));
 	    } else
 		have_result = TRUE;
+
+	    cairo_test_copy_file (test_filename, fail_filename);
 	} else { /* success */
 	    cairo_test_copy_file (test_filename, pass_filename);
 	}
 
-	cairo_test_copy_file (test_filename, last_filename);
-
 	cairo_surface_destroy (test_image);
 	cairo_surface_destroy (diff_image);
     }
@@ -837,8 +837,8 @@ UNWIND_SURFACE:
 UNWIND_STRINGS:
     if (test_filename != NULL)
 	free (test_filename);
-    if (last_filename != NULL)
-	free (last_filename);
+    if (fail_filename != NULL)
+	free (fail_filename);
     if (pass_filename != NULL)
 	free (pass_filename);
     if (png_name)


More information about the cairo-commit mailing list