[cairo] [PATCH v3 5/7] test: Make cairo_test_mkdir() usable throughout tests
Bryce W. Harrington
b.harrington at samsung.com
Thu Aug 15 11:08:37 PDT 2013
Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
test/cairo-test.c | 18 ++++++++++++++++++
test/cairo-test.h | 4 ++++
2 files changed, 22 insertions(+)
diff --git a/test/cairo-test.c b/test/cairo-test.c
index a3a587a..4f0610b 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1791,3 +1791,21 @@ cairo_test_status_from_status (const cairo_test_context_t *ctx,
return CAIRO_TEST_FAILURE;
}
+
+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;
+}
diff --git a/test/cairo-test.h b/test/cairo-test.h
index 87ba7df..1dcd59b 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -318,6 +318,10 @@ cairo_test_get_reference_image (cairo_test_context_t *ctx,
const char *filename,
cairo_bool_t flatten);
+
+cairo_bool_t
+cairo_test_mkdir (const char *path);
+
CAIRO_END_DECLS
#endif
--
1.7.9.5
More information about the cairo
mailing list