[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.
This commit is contained in:
Chris Wilson 2009-07-29 19:48:00 +01:00
parent 8c6ecfe648
commit 229887e980

View file

@ -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) {