mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-21 15:38:12 +02:00
[test] support using a previous build as a reference
Allow using a previous test output directory as a source of reference images. To make use of this, set the environment variable 'CAIRO_REF_DIR' to point at an old test directory, relative to the current test directory. This is useful for testing backends when reference images haven't been created yet, or which the current reference image structure can't accomodate, like multiple font backends.
This commit is contained in:
parent
f8ee0cdf18
commit
77e9b05b2b
2 changed files with 24 additions and 1 deletions
|
|
@ -69,6 +69,14 @@ The work involved is similar the work described above for new bugs.
|
|||
The only distinction is that the test is expected to pass so it
|
||||
should not be added to the XFAIL_TESTS list.
|
||||
|
||||
While working on a test
|
||||
-----------------------
|
||||
Before a bugfix or feature is ready, it may be useful to compare
|
||||
output from different builds. For convenience, you can set
|
||||
CAIRO_REF_DIR to point at a previous test directory, relative
|
||||
to the current test directory, and any previous output will be
|
||||
used by preference as reference images.
|
||||
|
||||
|
||||
When a bug is fixed
|
||||
-------------------
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ static const char *vector_ignored_tests[] = {
|
|||
* context object there, (though not a whole lot). */
|
||||
FILE *cairo_test_log_file = NULL;
|
||||
const char *srcdir;
|
||||
const char *refdir;
|
||||
|
||||
/* Used to catch crashes in a test, such that we report it as such and
|
||||
* continue testing, although one crasher may already have corrupted memory in
|
||||
|
|
@ -158,7 +159,20 @@ cairo_ref_name_for_test_target_format (const char *test_name,
|
|||
{
|
||||
char *ref_name = NULL;
|
||||
|
||||
/* First look for a target/format-specific reference image. */
|
||||
/* First look for a previous build for comparison. */
|
||||
if (refdir) {
|
||||
xasprintf (&ref_name, "%s/%s-%s-%s%s", refdir,
|
||||
test_name,
|
||||
target_name,
|
||||
format,
|
||||
CAIRO_TEST_PNG_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0)
|
||||
free (ref_name);
|
||||
else
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Next look for a target/format-specific reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir,
|
||||
test_name,
|
||||
target_name,
|
||||
|
|
@ -477,6 +491,7 @@ cairo_test_expecting (cairo_test_t *test,
|
|||
srcdir = getenv ("srcdir");
|
||||
if (!srcdir)
|
||||
srcdir = ".";
|
||||
refdir = getenv ("CAIRO_REF_DIR");
|
||||
|
||||
cairo_test_init (test->name);
|
||||
printf ("%s\n", test->description);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue