diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-29 19:48:00 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-31 09:39:38 +0100 |
commit | 229887e980f03d90248add8af9cd0a9be6cb0f9a (patch) | |
tree | 384fabeb53e5e0f534b5ccfb3c54dcd086fa4c6d | |
parent | 8c6ecfe6488dff93090d5d0a2d814466804bc7de (diff) |
[perf] Check output
Add a CAIRO_PERF_OUTPUT environment variable to cause cairo-perf to first
generate an output image in order to manually check that the test is
functioning correctly. This needs to be automated, so that we have
absolute confidence that the performance tests are not broken - but isn't
that the role of the test suite? If we were ever to publish cairo-perf
results, I would want some means of verification that the test-suite had
first been passed.
-rw-r--r-- | perf/cairo-perf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index f3b5f660..792120b9 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -200,6 +200,25 @@ cairo_perf_run (cairo_perf_t *perf, times = perf->times; + if (getenv ("CAIRO_PERF_OUTPUT") != NULL) { /* check output */ + char *filename; + cairo_status_t status; + + xasprintf (&filename, "%s.%s.%s.%d.out.png", + name, perf->target->name, + _content_to_string (perf->target->content, 0), + perf->size); + perf_func (perf->cr, perf->size, perf->size); + status = cairo_surface_write_to_png (cairo_get_target (perf->cr), filename); + if (status) { + fprintf (stderr, "Failed to generate output check '%s': %s\n", + filename, cairo_status_to_string (status)); + return; + } + + free (filename); + } + has_similar = cairo_perf_has_similar (perf); for (similar = 0; similar <= has_similar; similar++) { if (perf->summary) { |