summaryrefslogtreecommitdiff
path: root/test/create-for-stream.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-04-16 16:57:24 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-04-16 16:57:24 +0100
commitcab4d41cae4463841bca297a7e16c970633c8c21 (patch)
tree4dc8b77cdf854d3f4cf33f66393d25bb31295eef /test/create-for-stream.c
parent9d435d5fbfae0f64053f6596f73410bc352cd2de (diff)
downloadcairo-cab4d41cae4463841bca297a7e16c970633c8c21.tar.gz
create-for-stream - free resources after test failure.
create-for-stream often fails whilst running under valgrind due to the postscript output containing a CreationDate with seconds resolution, hence the visibility of the resource leaks during failure.
Diffstat (limited to 'test/create-for-stream.c')
-rw-r--r--test/create-for-stream.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/create-for-stream.c b/test/create-for-stream.c
index 937eaf5b2..9068be807 100644
--- a/test/create-for-stream.c
+++ b/test/create-for-stream.c
@@ -177,12 +177,14 @@ test_surface (const char *filename,
if (fread (file_contents, 1, wc.index, fp) != wc.index) {
cairo_test_log ("Failed to read %s: %s\n",
filename, strerror (errno));
+ fclose (fp);
return CAIRO_TEST_FAILURE;
}
if (memcmp (file_contents, wc.buffer, wc.index) != 0) {
cairo_test_log ("Stream based output differ from file output for %s\n",
filename);
+ fclose (fp);
return CAIRO_TEST_FAILURE;
}
@@ -195,35 +197,36 @@ test_surface (const char *filename,
int
main (void)
{
- cairo_test_status_t status;
+ cairo_test_status_t status = CAIRO_TEST_SUCCESS;
+ cairo_test_status_t test_status;
cairo_test_init ("create-for-stream");
#if CAIRO_HAS_PS_SURFACE
- status = test_surface ("create-for-stream.ps",
- cairo_ps_surface_create,
- cairo_ps_surface_create_for_stream);
- if (status != CAIRO_TEST_SUCCESS)
- return status;
+ test_status = test_surface ("create-for-stream.ps",
+ cairo_ps_surface_create,
+ cairo_ps_surface_create_for_stream);
+ if (status == CAIRO_TEST_SUCCESS)
+ status = test_status;
#endif
#if CAIRO_HAS_PDF_SURFACE
- status = test_surface ("create-for-stream.pdf",
- cairo_pdf_surface_create,
- cairo_pdf_surface_create_for_stream);
- if (status != CAIRO_TEST_SUCCESS)
- return status;
+ test_status = test_surface ("create-for-stream.pdf",
+ cairo_pdf_surface_create,
+ cairo_pdf_surface_create_for_stream);
+ if (status == CAIRO_TEST_SUCCESS)
+ status = test_status;
#endif
#if CAIRO_HAS_SVG_SURFACE
- status = test_surface ("create-for-stream.svg",
- cairo_svg_surface_create,
- cairo_svg_surface_create_for_stream);
- if (status != CAIRO_TEST_SUCCESS)
- return status;
+ test_status = test_surface ("create-for-stream.svg",
+ cairo_svg_surface_create,
+ cairo_svg_surface_create_for_stream);
+ if (status == CAIRO_TEST_SUCCESS)
+ status = test_status;
#endif
cairo_test_fini ();
- return CAIRO_TEST_SUCCESS;
+ return status;
}