[cairo-commit] 2 commits - NEWS test/cairo-test.c test/fallback-resolution.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Jun 13 02:25:57 PDT 2010


 NEWS                       |   46 +++++++++++++++++++--------------------
 test/cairo-test.c          |   53 +++++++++++++++++++++++++--------------------
 test/fallback-resolution.c |   30 ++++++++++++++++++++++---
 3 files changed, 79 insertions(+), 50 deletions(-)

New commits:
commit 0693af2328606a4c7e4c888d2a1cd346e6bef405
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 13 10:22:37 2010 +0100

    test: Move all output below test/output/
    
    make distcheck complains of remanents being left under test/ after a
    clean, notably the files used to check the capabilities of a similar
    surface and the fallback-resolution output.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index af4487a..5b80ba1 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -436,6 +436,24 @@ done:
     return ref_name;
 }
 
+static cairo_bool_t
+_cairo_test_mkdir (const char *path)
+{
+#if ! HAVE_MKDIR
+    return FALSE;
+#elif HAVE_MKDIR == 1
+    if (mkdir (path) == 0)
+	return TRUE;
+#elif HAVE_MKDIR == 2
+    if (mkdir (path, 0770) == 0)
+	return TRUE;
+#else
+#error Bad value for HAVE_MKDIR
+#endif
+
+    return errno == EEXIST;
+}
+
 cairo_bool_t
 cairo_test_target_has_similar (const cairo_test_context_t *ctx,
 			       const cairo_boilerplate_target_t *target)
@@ -446,6 +464,7 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
     cairo_surface_t *similar;
     cairo_status_t status;
     void *closure;
+    char *path;
 
     /* ignore image intermediate targets */
     if (target->expected_type == CAIRO_SURFACE_TYPE_IMAGE)
@@ -454,9 +473,14 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
     if (getenv ("CAIRO_TEST_IGNORE_SIMILAR"))
 	return FALSE;
 
+    xasprintf (&path, "%s/%s",
+	       _cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : ".",
+	       ctx->test_name);
+
+    has_similar = FALSE;
     do {
 	do {
-	    surface = (target->create_surface) (ctx->test->name,
+	    surface = (target->create_surface) (path,
 						target->content,
 						ctx->test->width,
 						ctx->test->height,
@@ -466,12 +490,11 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
 						0,
 						&closure);
 	    if (surface == NULL)
-		return FALSE;
+		goto out;
 	} while (cairo_test_malloc_failure (ctx, cairo_surface_status (surface)));
 
 	if (cairo_surface_status (surface))
-	    return FALSE;
-
+	    goto out;
 
 	cr = cairo_create (surface);
 	cairo_push_group_with_content (cr,
@@ -486,7 +509,9 @@ cairo_test_target_has_similar (const cairo_test_context_t *ctx,
 
 	if (target->cleanup)
 	    target->cleanup (closure);
-    } while (cairo_test_malloc_failure (ctx, status));
+    } while (! has_similar && cairo_test_malloc_failure (ctx, status));
+out:
+    free (path);
 
     return has_similar;
 }
@@ -655,24 +680,6 @@ cairo_test_copy_file (const char *src_filename,
     return TRUE;
 }
 
-static cairo_bool_t
-_cairo_test_mkdir (const char *path)
-{
-#if ! HAVE_MKDIR
-    return FALSE;
-#elif HAVE_MKDIR == 1
-    if (mkdir (path) == 0)
-	return TRUE;
-#elif HAVE_MKDIR == 2
-    if (mkdir (path, 0770) == 0)
-	return TRUE;
-#else
-#error Bad value for HAVE_MKDIR
-#endif
-
-    return errno == EEXIST;
-}
-
 static cairo_test_status_t
 cairo_test_for_target (cairo_test_context_t		 *ctx,
 		       const cairo_boilerplate_target_t	 *target,
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 5b18a7e..8ae952a 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -37,6 +37,9 @@
 #include <unistd.h>
 #include <errno.h>
 #endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
 
 #include "cairo-test.h"
 #include "buffer-diff.h"
@@ -299,6 +302,24 @@ generate_reference (double ppi_x, double ppi_y, const char *filename)
 }
 #endif
 
+static cairo_bool_t
+_cairo_test_mkdir (const char *path)
+{
+#if ! HAVE_MKDIR
+    return FALSE;
+#elif HAVE_MKDIR == 1
+    if (mkdir (path) == 0)
+	return TRUE;
+#elif HAVE_MKDIR == 2
+    if (mkdir (path, 0770) == 0)
+	return TRUE;
+#else
+#error Bad value for HAVE_MKDIR
+#endif
+
+    return errno == EEXIST;
+}
+
 static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
@@ -331,6 +352,7 @@ preamble (cairo_test_context_t *ctx)
     };
     unsigned int i;
     int n, num_ppi;
+    const char *path = _cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : ".";
 
     num_ppi = sizeof (ppi) / sizeof (ppi[0]);
 
@@ -359,8 +381,8 @@ preamble (cairo_test_context_t *ctx)
 	    continue;
 
 	format = cairo_boilerplate_content_name (target->content);
-	xasprintf (&base_name, "fallback-resolution.%s.%s",
-		   target->name,
+	xasprintf (&base_name, "%s/fallback-resolution.%s.%s",
+		   path, target->name,
 		   format);
 
 	surface = (target->create_surface) (base_name,
@@ -393,8 +415,8 @@ preamble (cairo_test_context_t *ctx)
 
 	    xasprintf (&test_name, "fallback-resolution.ppi%gx%g",
 		       ppi[n].x, ppi[n].y);
-	    xasprintf (&base_name, "%s.%s.%s",
-		       test_name,
+	    xasprintf (&base_name, "%s/%s.%s.%s",
+		       path, test_name,
 		       target->name,
 		       format);
 
commit ffc3a39c95e918fa2fcd14c1b1063b9a9acceebf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 12 20:04:36 2010 +0100

    NEWS: Minor tweaks.

diff --git a/NEWS b/NEWS
index a210731..c442c66 100644
--- a/NEWS
+++ b/NEWS
@@ -9,10 +9,10 @@ Snapshot 1.9.8 (2010-06-12)
    well fixing them. And last but not least we must all thank Adrian Johnson for
    continuing to eliminate bugs and improving the PostScript and PDF backends.
 
-   This snapshot represents almost 4 months of bug fixing, bring Cairo to a
-   point where we consider it almost ready to be a candidate for release.
+   This snapshot represents almost 4 months of bug fixing, bringing Cairo to
+   a point where we consider it almost ready to be a candidate for release.
    There are a few known bugs left to be fixed, being tracked in
-   https://bugs.freedesktop.org/show_bug.cgi?id=24384, please give Cairo a
+   https://bugs.freedesktop.org/show_bug.cgi?id=24384, so please give Cairo a
    whirl and report any regressions. The plan is to release a new snapshot
    every other week leading to a 1.10 release with a target date of
    2010-08-16.
@@ -34,26 +34,26 @@ API additions
     target.
 
   cairo_region_create()
-  cairo_region_create_rectangle ()
-  cairo_region_create_rectangles ()
-  cairo_region_copy ()
-  cairo_region_reference ()
-  cairo_region_destroy ()
-  cairo_region_equal ()
-  cairo_region_status ()
-  cairo_region_get_extents ()
-  cairo_region_num_rectangles ()
-  cairo_region_get_rectangle ()
-  cairo_region_is_empty ()
-  cairo_region_contains_rectangle ()
-  cairo_region_contains_point ()
-  cairo_region_translate ()
-  cairo_region_subtract ()
-  cairo_region_subtract_rectangle ()
-  cairo_region_intersect ()
-  cairo_region_intersect_rectangle ()
-  cairo_region_union ()
-  cairo_region_union_rectangle ()
+  cairo_region_create_rectangle()
+  cairo_region_create_rectangles()
+  cairo_region_copy()
+  cairo_region_reference()
+  cairo_region_destroy()
+  cairo_region_equal()
+  cairo_region_status()
+  cairo_region_get_extents()
+  cairo_region_num_rectangles()
+  cairo_region_get_rectangle()
+  cairo_region_is_empty()
+  cairo_region_contains_rectangle()
+  cairo_region_contains_point()
+  cairo_region_translate()
+  cairo_region_subtract()
+  cairo_region_subtract_rectangle()
+  cairo_region_intersect()
+  cairo_region_intersect_rectangle()
+  cairo_region_union()
+  cairo_region_union_rectangle()
 
     The Cairo region API was actually added a couple of snapshots ago, but we
     forgot to mention it at the time. A simple API for the handling of


More information about the cairo-commit mailing list