[cairo-commit] 5 commits - boilerplate/Makefile.am test/cairo-test.c test/cairo-test-runner.c test/Makefile.am util/cairo.modules
Chris Wilson
ickle at kemper.freedesktop.org
Mon Jul 20 10:56:40 PDT 2009
boilerplate/Makefile.am | 2
test/Makefile.am | 2
test/cairo-test-runner.c | 109 +++++++++++++++++----
test/cairo-test.c | 233 +++++++++++++++++++++++++++++++++--------------
util/cairo.modules | 19 +++
5 files changed, 270 insertions(+), 95 deletions(-)
New commits:
commit 809f77a5cb7c17582a0ed90285a3c48c0696ed3e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jul 20 13:44:48 2009 +0100
[test] Summarise tests that fail during the preamble.
Some tests only run and check during the preamble phase, and those
failures were being ignored during the summary.
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index ff90f71..cf1c006 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -71,6 +71,9 @@ typedef struct _cairo_test_runner {
int num_xfailed;
int num_crashed;
+ cairo_test_list_t *crashes_preamble;
+ cairo_test_list_t *fails_preamble;
+
cairo_test_list_t **crashes_per_target;
cairo_test_list_t **fails_per_target;
@@ -339,6 +342,9 @@ _runner_init (cairo_test_runner_t *runner)
runner->passed = TRUE;
+ runner->fails_preamble = NULL;
+ runner->crashes_preamble = NULL;
+
runner->fails_per_target = xcalloc (sizeof (cairo_test_list_t *),
runner->base.num_targets);
runner->crashes_per_target = xcalloc (sizeof (cairo_test_list_t *),
@@ -379,11 +385,42 @@ _runner_print_summary (cairo_test_runner_t *runner)
static void
_runner_print_details (cairo_test_runner_t *runner)
{
+ cairo_test_list_t *list;
unsigned int n;
+ if (runner->crashes_preamble) {
+ int count = 0;
+
+ for (list = runner->crashes_preamble; list != NULL; list = list->next)
+ count++;
+
+ _log (&runner->base, "Preamble: %d crashed! -", count);
+
+ for (list = runner->crashes_preamble; list != NULL; list = list->next) {
+ char *name = cairo_test_get_name (list->test);
+ _log (&runner->base, " %s", name);
+ free (name);
+ }
+ _log (&runner->base, "\n");
+ }
+ if (runner->fails_preamble) {
+ int count = 0;
+
+ for (list = runner->fails_preamble; list != NULL; list = list->next)
+ count++;
+
+ _log (&runner->base, "Preamble: %d failed -", count);
+
+ for (list = runner->fails_preamble; list != NULL; list = list->next) {
+ char *name = cairo_test_get_name (list->test);
+ _log (&runner->base, " %s", name);
+ free (name);
+ }
+ _log (&runner->base, "\n");
+ }
+
for (n = 0; n < runner->base.num_targets; n++) {
const cairo_boilerplate_target_t *target;
- cairo_test_list_t *list;
target = runner->base.targets_to_test[n];
if (runner->num_crashed_per_target[n]) {
@@ -441,6 +478,9 @@ _runner_fini (cairo_test_runner_t *runner)
{
unsigned int n;
+ _list_free (runner->crashes_preamble);
+ _list_free (runner->fails_preamble);
+
for (n = 0; n < runner->base.num_targets; n++) {
_list_free (runner->crashes_per_target[n]);
_list_free (runner->fails_per_target[n]);
@@ -606,6 +646,7 @@ main (int argc, char **argv)
cairo_test_context_t ctx;
cairo_test_status_t status;
cairo_bool_t failed = FALSE, xfailed = FALSE, crashed = FALSE, skipped = TRUE;
+ cairo_bool_t in_preamble = FALSE;
char *name = cairo_test_get_name (list->test);
int i;
@@ -694,19 +735,31 @@ main (int argc, char **argv)
status = _cairo_test_runner_preamble (&runner, &ctx);
switch (status) {
case CAIRO_TEST_SUCCESS:
+ in_preamble = TRUE;
skipped = FALSE;
break;
+
case CAIRO_TEST_XFAILURE:
+ in_preamble = TRUE;
xfailed = TRUE;
goto TEST_DONE;
+
case CAIRO_TEST_NEW:
case CAIRO_TEST_FAILURE:
+ runner.fails_preamble = _list_prepend (runner.fails_preamble,
+ list->test);
+ in_preamble = TRUE;
failed = TRUE;
goto TEST_DONE;
+
case CAIRO_TEST_NO_MEMORY:
case CAIRO_TEST_CRASHED:
+ runner.crashes_preamble = _list_prepend (runner.crashes_preamble,
+ list->test);
+ in_preamble = TRUE;
failed = TRUE;
goto TEST_DONE;
+
case CAIRO_TEST_UNTESTED:
goto TEST_DONE;
}
@@ -785,38 +838,46 @@ main (int argc, char **argv)
TEST_SKIPPED:
targets[0] = '\0';
if (crashed) {
- len = 0;
- for (n = 0 ; n < runner.base.num_targets; n++) {
- if (target_status[n] == CAIRO_TEST_CRASHED) {
- if (strstr (targets,
- runner.base.targets_to_test[n]->name) == NULL)
- {
- len += snprintf (targets + len, sizeof (targets) - len,
- "%s, ",
- runner.base.targets_to_test[n]->name);
+ if (! in_preamble) {
+ len = 0;
+ for (n = 0 ; n < runner.base.num_targets; n++) {
+ if (target_status[n] == CAIRO_TEST_CRASHED) {
+ if (strstr (targets,
+ runner.base.targets_to_test[n]->name) == NULL)
+ {
+ len += snprintf (targets + len, sizeof (targets) - len,
+ "%s, ",
+ runner.base.targets_to_test[n]->name);
+ }
}
}
+ targets[len-2] = '\0';
+ _log (&runner.base, "\n%s: CRASH! (%s)\n", name, targets);
+ } else {
+ _log (&runner.base, "\n%s: CRASH!\n", name);
}
- targets[len-2] = '\0';
- _log (&runner.base, "\n%s: CRASH! (%s)\n", name, targets);
runner.num_crashed++;
runner.passed = FALSE;
} else if (failed) {
- len = 0;
- for (n = 0 ; n < runner.base.num_targets; n++) {
- if (target_status[n] == CAIRO_TEST_FAILURE) {
- if (strstr (targets,
- runner.base.targets_to_test[n]->name) == NULL)
- {
- len += snprintf (targets + len,
- sizeof (targets) - len,
- "%s, ",
- runner.base.targets_to_test[n]->name);
+ if (! in_preamble) {
+ len = 0;
+ for (n = 0 ; n < runner.base.num_targets; n++) {
+ if (target_status[n] == CAIRO_TEST_FAILURE) {
+ if (strstr (targets,
+ runner.base.targets_to_test[n]->name) == NULL)
+ {
+ len += snprintf (targets + len,
+ sizeof (targets) - len,
+ "%s, ",
+ runner.base.targets_to_test[n]->name);
+ }
}
}
+ targets[len-2] = '\0';
+ _log (&runner.base, "%s: FAIL (%s)\n", name, targets);
+ } else {
+ _log (&runner.base, "%s: FAIL\n", name);
}
- targets[len-2] = '\0';
- _log (&runner.base, "%s: FAIL (%s)\n", name, targets);
runner.num_failed++;
runner.passed = FALSE;
} else if (xfailed) {
commit dbaa08e80b6d53f905974f3d2012f9425d9b8603
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jul 20 11:53:17 2009 +0100
[test] Fallback to comparing the base image references
After looking at backend specific images, check against the base image
reference. This is useful to fallback surfaces like xlib-fallback, which
should look closer to the image backend than the xlib backend.
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 80a8200..ad74d13 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -349,55 +349,59 @@ cairo_test_reference_filename (const cairo_test_context_t *ctx,
goto done;
}
- /* Next look for a target/format-specific reference image. */
- xasprintf (&ref_name, "%s/%s.%s.%s%s%s",
- ctx->srcdir,
- test_name,
- target_name,
- format,
- suffix,
- extension);
- if (access (ref_name, F_OK) != 0)
- free (ref_name);
- else
- goto done;
+ if (target_name != NULL) {
+ /* Next look for a target/format-specific reference image. */
+ xasprintf (&ref_name, "%s/%s.%s.%s%s%s",
+ ctx->srcdir,
+ test_name,
+ target_name,
+ format,
+ suffix,
+ extension);
+ if (access (ref_name, F_OK) != 0)
+ free (ref_name);
+ else
+ goto done;
- /* Next, look for target-specific reference image. */
- xasprintf (&ref_name, "%s/%s.%s%s%s",
- ctx->srcdir,
- test_name,
- target_name,
- suffix,
- extension);
- if (access (ref_name, F_OK) != 0)
- free (ref_name);
- else
- goto done;
+ /* Next, look for target-specific reference image. */
+ xasprintf (&ref_name, "%s/%s.%s%s%s",
+ ctx->srcdir,
+ test_name,
+ target_name,
+ suffix,
+ extension);
+ if (access (ref_name, F_OK) != 0)
+ free (ref_name);
+ else
+ goto done;
+ }
- /* Next look for a base/format-specific reference image. */
- xasprintf (&ref_name, "%s/%s.%s.%s%s%s",
- ctx->srcdir,
- test_name,
- base_target_name,
- format,
- suffix,
- extension);
- if (access (ref_name, F_OK) != 0)
- free (ref_name);
- else
- goto done;
+ if (base_target_name != NULL) {
+ /* Next look for a base/format-specific reference image. */
+ xasprintf (&ref_name, "%s/%s.%s.%s%s%s",
+ ctx->srcdir,
+ test_name,
+ base_target_name,
+ format,
+ suffix,
+ extension);
+ if (access (ref_name, F_OK) != 0)
+ free (ref_name);
+ else
+ goto done;
- /* Next, look for base-specific reference image. */
- xasprintf (&ref_name, "%s/%s.%s%s%s",
- ctx->srcdir,
- test_name,
- base_target_name,
- suffix,
- extension);
- if (access (ref_name, F_OK) != 0)
- free (ref_name);
- else
- goto done;
+ /* Next, look for base-specific reference image. */
+ xasprintf (&ref_name, "%s/%s.%s%s%s",
+ ctx->srcdir,
+ test_name,
+ base_target_name,
+ suffix,
+ extension);
+ if (access (ref_name, F_OK) != 0)
+ free (ref_name);
+ else
+ goto done;
+ }
/* Next, look for format-specific reference image. */
xasprintf (&ref_name, "%s/%s.%s%s%s",
@@ -677,9 +681,12 @@ cairo_test_for_target (cairo_test_context_t *ctx,
char *offset_str, *thread_str;
char *base_name, *base_path;
char *out_png_path;
- char *ref_path = NULL, *ref_png_path;
+ char *ref_path = NULL, *ref_png_path, *cmp_png_path = NULL;
char *new_path = NULL, *new_png_path;
char *xfail_path = NULL, *xfail_png_path;
+ char *base_ref_png_path;
+ char *base_new_png_path;
+ char *base_xfail_png_path;
char *diff_png_path;
char *test_filename = NULL, *pass_filename = NULL, *fail_filename = NULL;
cairo_test_status_t ret;
@@ -746,6 +753,28 @@ cairo_test_for_target (cairo_test_context_t *ctx,
CAIRO_TEST_XFAIL_SUFFIX,
CAIRO_TEST_PNG_EXTENSION);
+ base_ref_png_path = cairo_test_reference_filename (ctx,
+ base_name,
+ ctx->test_name,
+ NULL, NULL,
+ format,
+ CAIRO_TEST_REF_SUFFIX,
+ CAIRO_TEST_PNG_EXTENSION);
+ base_new_png_path = cairo_test_reference_filename (ctx,
+ base_name,
+ ctx->test_name,
+ NULL, NULL,
+ format,
+ CAIRO_TEST_NEW_SUFFIX,
+ CAIRO_TEST_PNG_EXTENSION);
+ base_xfail_png_path = cairo_test_reference_filename (ctx,
+ base_name,
+ ctx->test_name,
+ NULL, NULL,
+ format,
+ CAIRO_TEST_XFAIL_SUFFIX,
+ CAIRO_TEST_PNG_EXTENSION);
+
if (target->file_extension != NULL) {
ref_path = cairo_test_reference_filename (ctx,
base_name,
@@ -1071,6 +1100,9 @@ REPEAT:
new_path,
xfail_png_path,
xfail_path,
+ base_ref_png_path,
+ base_new_png_path,
+ base_xfail_png_path,
};
xasprintf (&test_filename, "%s.out%s",
@@ -1157,6 +1189,9 @@ REPEAT:
ref_png_path,
new_png_path,
xfail_png_path,
+ base_ref_png_path,
+ base_new_png_path,
+ base_xfail_png_path,
};
xasprintf (&test_filename, "%s", out_png_path);
@@ -1228,13 +1263,32 @@ REPEAT:
}
}
- ref_image = cairo_test_get_reference_image (ctx, ref_png_path,
+ if (cairo_test_files_equal (out_png_path, base_ref_png_path)) {
+ cairo_test_log (ctx, "PNG file exactly reference image.\n");
+ cairo_surface_destroy (test_image);
+ ret = CAIRO_TEST_SUCCESS;
+ goto UNWIND_CAIRO;
+ }
+ if (cairo_test_files_equal (out_png_path, base_new_png_path)) {
+ cairo_test_log (ctx, "PNG file exactly current failure image.\n");
+ cairo_surface_destroy (test_image);
+ ret = CAIRO_TEST_NEW;
+ goto UNWIND_CAIRO;
+ }
+ if (cairo_test_files_equal (out_png_path, base_xfail_png_path)) {
+ cairo_test_log (ctx, "PNG file exactly known failure image.\n");
+ cairo_surface_destroy (test_image);
+ ret = CAIRO_TEST_XFAILURE;
+ goto UNWIND_CAIRO;
+ }
+
+ /* first compare against the ideal reference */
+ ref_image = cairo_test_get_reference_image (ctx, base_ref_png_path,
target->content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED);
if (cairo_surface_status (ref_image)) {
cairo_test_log (ctx, "Error: Cannot open reference image for %s: %s\n",
- ref_png_path,
+ base_ref_png_path,
cairo_status_to_string (cairo_surface_status (ref_image)));
- cairo_surface_destroy (ref_image);
cairo_surface_destroy (test_image);
ret = CAIRO_TEST_FAILURE;
goto UNWIND_CAIRO;
@@ -1244,30 +1298,61 @@ REPEAT:
ctx->test->width,
ctx->test->height);
+ cmp_png_path = base_ref_png_path;
diff_status = image_diff (ctx,
- test_image, ref_image,
- diff_image,
+ test_image, ref_image, diff_image,
&result);
_xunlink (ctx, diff_png_path);
- if (diff_status) {
- cairo_test_log (ctx, "Error: Failed to compare images: %s\n",
- cairo_status_to_string (diff_status));
- ret = CAIRO_TEST_FAILURE;
- }
- else if (result.pixels_changed &&
- result.max_diff > target->error_tolerance)
+ if (diff_status ||
+ (result.pixels_changed &&
+ result.max_diff > target->error_tolerance))
{
- ret = CAIRO_TEST_FAILURE;
+ /* that failed, so check against the specific backend */
+ ref_image = cairo_test_get_reference_image (ctx, ref_png_path,
+ target->content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED);
+ if (cairo_surface_status (ref_image)) {
+ cairo_test_log (ctx, "Error: Cannot open reference image for %s: %s\n",
+ ref_png_path,
+ cairo_status_to_string (cairo_surface_status (ref_image)));
+ cairo_surface_destroy (test_image);
+ ret = CAIRO_TEST_FAILURE;
+ goto UNWIND_CAIRO;
+ }
- diff_status = cairo_surface_write_to_png (diff_image, diff_png_path);
- if (diff_status) {
- cairo_test_log (ctx, "Error: Failed to write differences image: %s\n",
+ cmp_png_path = ref_png_path;
+ diff_status = image_diff (ctx,
+ test_image, ref_image,
+ diff_image,
+ &result);
+ if (diff_status)
+ {
+ cairo_test_log (ctx, "Error: Failed to compare images: %s\n",
cairo_status_to_string (diff_status));
- } else
- have_result = TRUE;
+ ret = CAIRO_TEST_FAILURE;
+ }
+ else if (result.pixels_changed &&
+ result.max_diff > target->error_tolerance)
+ {
+ ret = CAIRO_TEST_FAILURE;
- cairo_test_copy_file (test_filename, fail_filename);
- } else { /* success */
+ diff_status = cairo_surface_write_to_png (diff_image,
+ diff_png_path);
+ if (diff_status) {
+ cairo_test_log (ctx, "Error: Failed to write differences image: %s\n",
+ 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);
+ }
+ }
+ else
+ { /* success */
cairo_test_copy_file (test_filename, pass_filename);
}
@@ -1324,9 +1409,13 @@ UNWIND_SURFACE:
cairo_test_log (ctx, "OUTPUT: %s\n", out_png_path);
if (have_result) {
+ if (cmp_png_path == NULL) {
+ /* XXX presume we matched the normal ref last time */
+ cmp_png_path = ref_png_path;
+ }
cairo_test_log (ctx,
"REFERENCE: %s\nDIFFERENCE: %s\n",
- ref_png_path, diff_png_path);
+ cmp_png_path, diff_png_path);
}
}
@@ -1335,14 +1424,20 @@ UNWIND_STRINGS:
free (out_png_path);
if (ref_png_path)
free (ref_png_path);
+ if (base_ref_png_path)
+ free (base_ref_png_path);
if (ref_path)
free (ref_path);
if (new_png_path)
free (new_png_path);
+ if (base_new_png_path)
+ free (base_new_png_path);
if (new_path)
free (new_path);
if (xfail_png_path)
free (xfail_png_path);
+ if (base_xfail_png_path)
+ free (base_xfail_png_path);
if (xfail_path)
free (xfail_path);
if (diff_png_path)
commit 164e0d2ea38baacd5888bffa5bebb5d64bfee01b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jul 20 11:02:04 2009 +0100
[test] Misidentification of XFAIL as NEW
cut'n'paste error compared the image against the known failure instead of
any recorded new failure, when checking for NEW fails.
diff --git a/test/cairo-test.c b/test/cairo-test.c
index b5d098d..80a8200 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1214,7 +1214,7 @@ REPEAT:
ret = CAIRO_TEST_SUCCESS;
goto UNWIND_CAIRO;
}
- if (cairo_test_files_equal (out_png_path, xfail_png_path)) {
+ if (cairo_test_files_equal (out_png_path, new_png_path)) {
cairo_test_log (ctx, "PNG file exactly matches current failure image.\n");
cairo_surface_destroy (test_image);
ret = CAIRO_TEST_NEW;
commit e2883177487ba294a0c97bafb00e2f56e5fe84d9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jul 20 18:55:04 2009 +0100
Add a jhbuild moduleset.
diff --git a/util/cairo.modules b/util/cairo.modules
new file mode 100644
index 0000000..797b25e
--- /dev/null
+++ b/util/cairo.modules
@@ -0,0 +1,19 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*-->
+<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
+<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
+<moduleset>
+ <include href="http://cgit.freedesktop.org/xorg/util/modular/plain/xorg.modules" />
+
+ <repository type="git" name="fd.o" href="git://anongit.freedesktop.org/git/"/>
+
+ <autotools id="cairo">
+ <branch repo="fd.o" module="cairo"/>
+ <dependencies>
+ <dep package="pixman"/>
+ <dep package="fontconfig"/>
+ </dependencies>
+ <after>
+ <dep package="libXrender"/>
+ </after>
+ </autotools>
+</moduleset>
commit 0c1e86d661e145981050129b163eae0fb8f4a963
Author: Pierre Tardy <tardyp at gmail.com>
Date: Sat Jul 18 19:16:20 2009 +0100
Cross-compilation fix for boilerplate/test
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 763f9a6..3d8339f 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -49,7 +49,7 @@ endif
libcairoboilerplate_la_LIBADD += $(CAIROBOILERPLATE_LIBS)
make-cairo-boilerplate-constructors$(EXEEXT): make-cairo-boilerplate-constructors.c
- $(CC) $^ -o $@
+ $(CC_FOR_BUILD) $^ -o $@
cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors$(EXEEXT)
echo '(cd $(srcdir) && $(top_builddir)/boilerplate/make-cairo-boilerplate-constructors$(EXEEXT) $(enabled_cairo_boilerplate_sources)) > $@'
diff --git a/test/Makefile.am b/test/Makefile.am
index 85aaae3..6cb3dd2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -70,7 +70,7 @@ test_sources += $(test)
TESTS += cairo-test-suite$(EXEEXT)
make-cairo-test-constructors$(EXEEXT): make-cairo-test-constructors.c
- $(CC) $^ -o $@
+ $(CC_FOR_BUILD) $^ -o $@
cairo-test-constructors.c: Makefile $(test_sources) make-cairo-test-constructors$(EXEEXT)
./make-cairo-test-constructors$(EXEEXT) $(srcdir) $(test_sources) > $@
More information about the cairo-commit
mailing list