summaryrefslogtreecommitdiff
path: root/test/cairo-test.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2022-05-18 10:37:37 +0930
committerAdrian Johnson <ajohnson@redneon.com>2022-05-19 06:44:58 +0930
commit29acc5584915be294b2d7ed926d9ac48346474e3 (patch)
treec9d037cf671c58de5eb048233c645f7c42c59e35 /test/cairo-test.c
parente562ff757bb7d88b708e07a9759c046413c52f94 (diff)
downloadcairo-29acc5584915be294b2d7ed926d9ac48346474e3.tar.gz
Make it easier for cairo-test-suite to find the source dir
Diffstat (limited to 'test/cairo-test.c')
-rw-r--r--test/cairo-test.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c
index df230e523..cbd4fb1ab 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -196,9 +196,14 @@ _cairo_test_init (cairo_test_context_t *ctx,
ctx->own_targets = TRUE;
ctx->srcdir = getenv ("srcdir");
- if (ctx->srcdir == NULL)
- ctx->srcdir = ".";
-
+ if (ctx->srcdir == NULL) {
+ ctx->srcdir = ".";
+#if HAVE_SYS_STAT_H
+ struct stat st;
+ if (stat ("srcdir", &st) == 0 && (st.st_mode & S_IFDIR))
+ ctx->srcdir = "srcdir";
+#endif
+ }
ctx->refdir = getenv ("CAIRO_REF_DIR");
}