From 229887e980f03d90248add8af9cd0a9be6cb0f9a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 29 Jul 2009 19:48:00 +0100 Subject: [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. --- perf/cairo-perf.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'perf') 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) { -- cgit v1.2.3