mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-01 22:20:14 +01:00
test: Do not open files in non-existing dirs
The output directory should be made before trying to open log files in it. Fixes the bug causing cairo-test-suite to log to stderr on the first run (i.e. when test/output does not exist).
This commit is contained in:
parent
603ea229b5
commit
1501c86536
1 changed files with 20 additions and 18 deletions
|
|
@ -102,6 +102,24 @@ static int cairo_test_timeout = 60;
|
|||
|
||||
#define NUM_DEVICE_OFFSETS 2
|
||||
|
||||
static cairo_bool_t
|
||||
_cairo_test_mkdir (const char *path)
|
||||
{
|
||||
#if ! HAVE_MKDIR
|
||||
return FALSE;
|
||||
#elif HAVE_MKDIR == 1
|
||||
if (mkdir (path) == 0)
|
||||
return TRUE;
|
||||
#elif HAVE_MKDIR == 2
|
||||
if (mkdir (path, 0770) == 0)
|
||||
return TRUE;
|
||||
#else
|
||||
#error Bad value for HAVE_MKDIR
|
||||
#endif
|
||||
|
||||
return errno == EEXIST;
|
||||
}
|
||||
|
||||
static char *
|
||||
_cairo_test_fixup_name (const char *original)
|
||||
{
|
||||
|
|
@ -139,6 +157,8 @@ _cairo_test_init (cairo_test_context_t *ctx,
|
|||
ctx->test_name = _cairo_test_fixup_name (test_name);
|
||||
ctx->output = output;
|
||||
|
||||
_cairo_test_mkdir (ctx->output);
|
||||
|
||||
ctx->malloc_failure = 0;
|
||||
#if HAVE_MEMFAULT
|
||||
if (getenv ("CAIRO_TEST_MALLOC_FAILURE"))
|
||||
|
|
@ -381,24 +401,6 @@ done:
|
|||
return ref_name;
|
||||
}
|
||||
|
||||
static cairo_bool_t
|
||||
_cairo_test_mkdir (const char *path)
|
||||
{
|
||||
#if ! HAVE_MKDIR
|
||||
return FALSE;
|
||||
#elif HAVE_MKDIR == 1
|
||||
if (mkdir (path) == 0)
|
||||
return TRUE;
|
||||
#elif HAVE_MKDIR == 2
|
||||
if (mkdir (path, 0770) == 0)
|
||||
return TRUE;
|
||||
#else
|
||||
#error Bad value for HAVE_MKDIR
|
||||
#endif
|
||||
|
||||
return errno == EEXIST;
|
||||
}
|
||||
|
||||
cairo_test_similar_t
|
||||
cairo_test_target_has_similar (const cairo_test_context_t *ctx,
|
||||
const cairo_boilerplate_target_t *target)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue