summaryrefslogtreecommitdiff
path: root/test/fallback-resolution.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-13 10:22:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-13 10:25:49 +0100
commit0693af2328606a4c7e4c888d2a1cd346e6bef405 (patch)
tree11fb81e417b5f667f1cd46b0ff5e6560c0c9290e /test/fallback-resolution.c
parentffc3a39c95e918fa2fcd14c1b1063b9a9acceebf (diff)
downloadcairo-0693af2328606a4c7e4c888d2a1cd346e6bef405.tar.gz
test: Move all output below test/output/
make distcheck complains of remanents being left under test/ after a clean, notably the files used to check the capabilities of a similar surface and the fallback-resolution output.
Diffstat (limited to 'test/fallback-resolution.c')
-rw-r--r--test/fallback-resolution.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 5b18a7efb..8ae952ae9 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -37,6 +37,9 @@
#include <unistd.h>
#include <errno.h>
#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#include "cairo-test.h"
#include "buffer-diff.h"
@@ -299,6 +302,24 @@ generate_reference (double ppi_x, double ppi_y, const char *filename)
}
#endif
+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 cairo_test_status_t
preamble (cairo_test_context_t *ctx)
{
@@ -331,6 +352,7 @@ preamble (cairo_test_context_t *ctx)
};
unsigned int i;
int n, num_ppi;
+ const char *path = _cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : ".";
num_ppi = sizeof (ppi) / sizeof (ppi[0]);
@@ -359,8 +381,8 @@ preamble (cairo_test_context_t *ctx)
continue;
format = cairo_boilerplate_content_name (target->content);
- xasprintf (&base_name, "fallback-resolution.%s.%s",
- target->name,
+ xasprintf (&base_name, "%s/fallback-resolution.%s.%s",
+ path, target->name,
format);
surface = (target->create_surface) (base_name,
@@ -393,8 +415,8 @@ preamble (cairo_test_context_t *ctx)
xasprintf (&test_name, "fallback-resolution.ppi%gx%g",
ppi[n].x, ppi[n].y);
- xasprintf (&base_name, "%s.%s.%s",
- test_name,
+ xasprintf (&base_name, "%s/%s.%s.%s",
+ path, test_name,
target->name,
format);