Merge branch 'srcdir' into 'master'

Make it easier for cairo-test-suite to find the source dir

See merge request cairo/cairo!328
This commit is contained in:
Uli Schlachter 2022-05-20 13:07:41 +00:00
commit 5dafd74116
3 changed files with 29 additions and 3 deletions

View file

@ -17,6 +17,11 @@ file, which, when viewed in a web browser makes it quite easy to
visually see any failed renderings alongside the corresponding
reference image, (and a diff image as well).
As some browsers do not permit Javascript to read from the local
filesystem, the view-test-results.py script can used to view the
results. It starts a http server serving the current directory before
displaying the test results in a browser.
The test suite needs to be run before any code is committed and before
any release. See below for hints and rules governing the use of the suite.
@ -36,6 +41,15 @@ CAIRO_TEST_TARGET environment variable, so for instance:
This binary should be backwards-compatible with all library versions,
allowing you to compare current versus past behaviour for any test.
The test suite needs to find the "test" directory in the source
tree. The srcdir environment variable can be used to specify
the location of this directory. If this environment variable is not
set, the binary looks for the directory "srcdir" in the current
directory. The meson build system symlinks "srcdir" in the
$builddir/test directory to the "test" directory in the source
tree. If this is not found the binary defaults to the current
directory.
Tailoring tests running
-----------------------
There are some mechanisms to limit the tests run during "make test".

View file

@ -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");
}

View file

@ -634,6 +634,13 @@ foreach file : html_files
configure_file(input: file, output : file, copy: true)
endforeach
if build_machine.system() != 'windows'
run_command('ln', '-sf',
meson.current_source_dir(),
join_paths(meson.current_build_dir(), 'srcdir'),
check: true)
endif
env = environment()
env.set('srcdir', meson.current_source_dir())