[cairo] [PATCH] test: Fix CAIRO_REF_DIR

Uli Schlachter psychon at znc.in
Fri Mar 15 09:08:16 PDT 2013


Ever since the test output was moved from test/ to test/output/, using
CAIRO_REF_DIR to make the test suite succeed no longer works. The test suite was
looking for the wrong file names.

This patch makes this work again. However, I am not sure that this really is the
correct fix. It just seems to work. :-)

Reported-by: Darxus <darxus at chaosreigns.com>
Signed-off-by: Uli Schlachter <psychon at znc.in>
---
 test/README       |    2 +-
 test/cairo-test.c |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/README b/test/README
index b8effea..fef240d 100644
--- a/test/README
+++ b/test/README
@@ -156,7 +156,7 @@ your changes. The process looks like this:

         # Let's save those output images
         mkdir /some/directory/
-        cp test/*-out.png /some/directory/
+        cp -r test/output /some/directory/

         # hack, hack, hack

diff --git a/test/cairo-test.c b/test/cairo-test.c
index 076b014..a3a587a 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -307,11 +307,10 @@ cairo_test_reference_filename (const cairo_test_context_t
*ctx,
     char *ref_name = NULL;

     /* First look for a previous build for comparison. */
-    if (ctx->refdir != NULL) {
-	xasprintf (&ref_name, "%s/%s%s%s",
+    if (ctx->refdir != NULL && strcmp(suffix, CAIRO_TEST_REF_SUFFIX) == 0) {
+	xasprintf (&ref_name, "%s/%s" CAIRO_TEST_OUT_SUFFIX "%s",
 		   ctx->refdir,
 		   base_name,
-		   suffix,
 		   extension);
 	if (access (ref_name, F_OK) != 0)
 	    free (ref_name);
-- 
1.7.10.4


More information about the cairo mailing list