diff options
author | Bryce W. Harrington <b.harrington@samsung.com> | 2013-09-08 20:10:03 +0000 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2013-09-09 21:25:12 +0200 |
commit | f9dcd07d22a5269bf799317a36bb2887d8f9af64 (patch) | |
tree | 42bab64d56c64a19469d410d8b83a287a05c83c3 /test/create-for-stream.c | |
parent | be7f1ac98f62669743f381df8845886d29a9f7f4 (diff) | |
download | cairo-f9dcd07d22a5269bf799317a36bb2887d8f9af64.tar.gz |
test: Ensure output dirs exist, falling back to current dir if needed
This change makes several tests behave more like ps-eps.c, et al by
making them attempt to mkdir "output", and in case of trouble use "."
instead. filenames are now allocated at runtime due to this change, so
ensure the corresponding free()'s are in place as well.
This should facilitate running the test suite with a relative path
outside cairo's source tree, such as when employing the CAIRO_REF_DIR
environment variable.
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'test/create-for-stream.c')
-rw-r--r-- | test/create-for-stream.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/create-for-stream.c b/test/create-for-stream.c index e99979590..af1632f14 100644 --- a/test/create-for-stream.c +++ b/test/create-for-stream.c @@ -239,6 +239,8 @@ preamble (cairo_test_context_t *ctx) { cairo_test_status_t status = CAIRO_TEST_UNTESTED; cairo_test_status_t test_status; + char *filename; + const char *path = cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : "."; #if CAIRO_HAS_PS_SURFACE if (cairo_test_is_target_enabled (ctx, "ps2") || @@ -247,7 +249,8 @@ preamble (cairo_test_context_t *ctx) if (status == CAIRO_TEST_UNTESTED) status = CAIRO_TEST_SUCCESS; - test_status = test_surface (ctx, "ps", CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".ps", + xasprintf (&filename, "%s/%s", path, BASENAME ".ps"); + test_status = test_surface (ctx, "ps", filename, cairo_ps_surface_create, cairo_ps_surface_create_for_stream); cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n", @@ -255,6 +258,7 @@ preamble (cairo_test_context_t *ctx) test_status ? "FAIL" : "PASS"); if (status == CAIRO_TEST_SUCCESS) status = test_status; + free (filename); } #endif @@ -263,7 +267,8 @@ preamble (cairo_test_context_t *ctx) if (status == CAIRO_TEST_UNTESTED) status = CAIRO_TEST_SUCCESS; - test_status = test_surface (ctx, "pdf", CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".pdf", + xasprintf (&filename, "%s/%s", path, BASENAME ".pdf"); + test_status = test_surface (ctx, "pdf", filename, cairo_pdf_surface_create, cairo_pdf_surface_create_for_stream); cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n", @@ -271,6 +276,7 @@ preamble (cairo_test_context_t *ctx) test_status ? "FAIL" : "PASS"); if (status == CAIRO_TEST_SUCCESS) status = test_status; + free (filename); } #endif @@ -281,7 +287,8 @@ preamble (cairo_test_context_t *ctx) if (status == CAIRO_TEST_UNTESTED) status = CAIRO_TEST_SUCCESS; - test_status = test_surface (ctx, "svg", CAIRO_TEST_OUTPUT_DIR "/" BASENAME ".svg", + xasprintf (&filename, "%s/%s", path, BASENAME ".svg"); + test_status = test_surface (ctx, "svg", filename, cairo_svg_surface_create, cairo_svg_surface_create_for_stream); cairo_test_log (ctx, "TEST: %s TARGET: %s RESULT: %s\n", @@ -289,6 +296,7 @@ preamble (cairo_test_context_t *ctx) test_status ? "FAIL" : "PASS"); if (status == CAIRO_TEST_SUCCESS) status = test_status; + free (filename); } #endif |