Commit graph

251 commits

Author SHA1 Message Date
Chris Wilson
e90073f7dd [test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one
binary from all the sources.

This binary is then given the task of choosing tests to run (based on user
selection and individual test requirement), forking each test into its own
process and accumulating the results.
2008-10-31 12:30:11 +00:00
Chris Wilson
ef98eb26f7 [test] Reenable device offset testing.
Restore device offset testing that was temporarily disable in the run up
to the 1.8 release.
2008-10-30 19:23:17 +00:00
Chris Wilson
336eddfdbb [test/get-clip] Check the status on the secondary context.
As we solely use a secondary context, we must manually report NO_MEMORY
errors whilst running under memfault.
2008-10-18 09:55:06 +01:00
Chris Wilson
bccfdf7d93 [test] Add support for memfault.
Add the core support to cairo-test for running the test-suite under a
malloc fault injector. This commit contains the adjustments to
cairo_test_run() to repeat the test if it detects a failure due to fault
injection and complains if it detects unreported faults or memory leaks.
2008-10-17 22:52:47 +01:00
Chris Wilson
7707027081 [test] Use _POSIX_C_SOURCE for flockfile.
From bug 18010 (https://bugs.freedesktop.org/show_bug.cgi?id=18010),
in order to make flockfile() available we need to set _POSIX_C_SOURCE and
according to the man page, the appropriate feature check is
_POSIX_THREAD_SAFE_FUNCTIONS.
2008-10-11 18:12:28 +01:00
Chris Wilson
9841d9d58e Automate error checking for fallback-resolution.
For this we extend the boilerplate get_image() routines to extract a
single page out of a paginated document and then proceed to manually
check each page of the fallback-resolution test.

(Well that's the theory, in practice SVG doesn't support multiple pages
and so we just generate a new surface for each resolution. But the
infrastructure is in place so that we can automate other tests,
e.g. test/multi-pages.)
2008-09-28 14:57:12 +01:00
Chris Wilson
260362e572 [cairo-test] Fix cairo_test_file_is_older().
It did not even compile, so no longer it wasn't deleting cached results
if you updated the reference images.
2008-09-27 19:16:34 +01:00
Chris Wilson
453443d77a [test] Write the OUTPUT filename to the log if we match the vector surface.
If the vector surface matches the output from last time, then the
rasterisation is skipped - but we need to write the expected OUTPUT
filename to the log so that the image is referenced from index.html.
2008-09-25 01:11:50 +01:00
Carl Worth
c3750cf218 Remove the device-offset testing (-25 cases) for the release.
The reasoning behind the -25 testing is that we want to ensure
that cairo provides translation invariance. However, for
many vector backends we use external rasterizers that don't
necessarily provide that translation invariance.

So this testing makes a bunch of failures appear that we don't
really care about, (and we don't even have a mechanism to turn
them off with custom reference images). For the release, I'm
just turning this off.

After the release, I plan to turn this back on, and then we could
fix this by ensuring that the vector output itself is unaffected
by a device offset, or by moving away from external rasterizers,
(see Chris's micro-gs work to test PostScript with cairo-based
rasterization).
2008-09-24 16:32:58 -07:00
Chris Wilson
77b43da99f [test] Fixup potential use of uninitialized test_image.
In the churn of reordering the tests, some of the error paths were left
unaltered - causing potential invalid dereferences.
2008-09-15 16:48:22 +01:00
Chris Wilson
e9e439a7a8 [test] Check for updated reference images.
Delete the results of previous runs if the reference images are more
recent.

There's still potential error if the conversion utility or its required
libraries are modified...
2008-09-11 12:58:48 +01:00
Chris Wilson
140ffa6e27 [test] Fix order of deleting images vs checks.
The early-checks assume that the images are still available - so it helps
not to unlink them before comparing results to the previous run.
2008-09-11 10:00:57 +01:00
Behdad Esfahbod
965b0e51ec [test] Do not include "xmalloc.h" directly
Not needed, it's renamed and included by boilerplate directly.
2008-09-04 23:25:27 -04:00
Behdad Esfahbod
a7951081f1 Move _GNU_SOURCE declarations to where it's used
Such that we don't rely on more GNU extensions accidentally.
2008-09-02 21:54:09 -04:00
Chris Wilson
7b2e8035f2 [cairo-test] Fixup a few memleaks on failure.
Free the test image before jumping to UNWIND_CAIRO.
2008-09-02 10:54:13 +01:00
Chris Wilson
bd21b2f630 [test] Ensure that the output is always saved.
Do the saving of the output first before checking for various failures
with respect to the reference images.
2008-08-26 23:03:08 +01:00
Chris Wilson
17a6d541f8 [test] Explicity save a fail image.
Be explicit about handling cached FAIL images, instead of relying on the
sequences of failed matches as the files are an external resource and we
can not guarantee their individual accessibility.

Note this also changes the filename, so you may want to run:
$ find -name '*-last.*' -print | xargs rm
after this checkout.
2008-08-21 08:45:06 +01:00
Chris Wilson
b9287e6669 [test] Cache last output and compare next time.
Compare the current output against a previous run to determine if there
has been any change since last time, and only run through imagediff if
there has been. For the vector surfaces, we can check the vector output
first and potentially skip the rasterisation. On my machine this reduces
the time for a second run from 6 minutes to 2m30s. As most of the time,
most test output will remain unchanged, so this seems to be a big win. On
unix systems, hard linking is used to reduce the amount of storage space
required - others will see about a three-fold increase in the amount of
disk used.  The directory continues to be a stress test for file selectors.

In order to reduce the changes between runs, the current time is no longer
written to the PNG files (justified by that it only exists as a debugging
aid) and the boilerplate tweaks the PS surface so that the creation date
is fixed. To fully realise the benefits here, we need to strip the
creation time from all the reference images...

The biggest problem with using the caches is that different runs of the
test suite can go through different code paths, introducing potential
Heisenbergs. If you suspect that caching is interfering with the test
results, use 'make -C test clean-caches check'.
2008-08-20 23:56:56 +01:00
Chris Wilson
5712a2c619 [test] Destroy test ouput image on failure.
Add the missing cairo_surface_destroy(). Sigh, less haste more speed.
2008-08-19 15:17:45 +01:00
Chris Wilson
0354457bed [test] Always write the test output to a png.
Always write the test output to a png so that it can be copied and used as
a reference image with CAIRO_REF_DIR.
2008-08-19 15:10:51 +01:00
Chris Wilson
86d221521b [test] Pass extended output name to ref_name_for_test().
Having included some extra details in the test output PNG filename, we
need to pass the extra information to
cairo_ref_name_for_test_target_format() in order to find the match.
2008-08-19 14:58:48 +01:00
Chris Wilson
17fbb652b1 [test] Avoid redundant writes/reads of test surfaces via png.
As Behdad suggested, we can dramatically speed up the test suite by
short-circuiting the write to a png file, only to then immediately read it
back in. So for the raster based surfaces, we avoid the round-trip through
libpng by implementing a new boilerplate method to directly extract the image
buffer from the test result. A secondary speedup is achieved by caching the
most recent reference image.
2008-08-18 16:18:52 +01:00
Chris Wilson
93af67d7fd [test] Pass a 'complete' name to create_surface().
Construct the test name to pass to the boilerplate creation routines such
that it uniquely identifies the test in terms of test, target, content and
pass (similar, offset, thread). This allows the vector targets to create
output different output files for each test, whereas before, later tests
would overwrite existing files making debugging more difficult.
2008-08-13 22:01:51 +01:00
Chris Wilson
d56ea9cc87 [test] Set CAIRO_TEST_UNTESTED to 77
77 is the magic exit code used by automake to indicate a skipped test, so
by using it we can get a slightly more informative test log.
2008-08-13 21:55:19 +01:00
Chris Wilson
f85a4aec1f [test] Export a function to check whether a target is enabled.
Allow individuals tests to check whether a test target is enabled -
useful for those tests that circumvent cairo_test() and perform
feature testing.
2008-08-13 21:55:09 +01:00
Chris Wilson
436c0c8be2 [test] Preparatory work for running under memfault.
In order to run under memfault, the framework is first extended to handle
running concurrent tests - i.e. multi-threading. (Not that this is a
requirement for memfault, instead it shares a common goal of storing
per-test data).  To that end all the global data is moved into a per-test
context and the targets are adjusted to avoid overlap on shared, global
resources (such as output files and frame buffers). In order to preserve
the simplicity of the standard draw routines, the context is not passed
explicitly as a parameter to the routines, but is instead attached to the
cairo_t via the user_data.

For the masochist, to enable the tests to be run across multiple threads
simply set the environment variable CAIRO_TEST_NUM_THREADS to the desired
number.

In the long run, we can hope the need for memfault (runtime testing of
error paths) will be mitigated by static analysis. A promising candidate
for this task would appear to be http://hal.cs.berkeley.edu/cil/.
2008-08-13 21:54:59 +01:00
Chris Wilson
5ace0cb17a [cairo-test] Exclude lcd-filter tests for vector targets.
Add text-lcd-filter-* to vector_ignored_tests.
2008-08-11 20:43:14 +01:00
Behdad Esfahbod
1246ff8aec [cairo-test] Implement cairo_test_log_path() to dump a cairo_path_t to logs
Dumping paths is so hard in C.  Shouldn't be.  At least not when debugging...
2008-05-09 23:21:14 +02:00
Chris Wilson
1755a2d27d [test] Enable floating point exceptions.
Some platforms and applications enable floating point exceptions, so it
seems sensible to run the test-suite with the most serious exceptions
enabled - divide by zero, invalid result and overflow.
2008-05-06 14:30:35 +01:00
Chris Wilson
fa5e87ad23 [cairo-test] Spelling fixes in comments.
Skim through the comments fixing trivial smelling pistakes.
2008-04-15 13:28:57 +01:00
Chris Wilson
f57100acd4 [test] Handle TEST_CONTENT_COLOR_ALPHA_FLATTENED similar surfaces.
Convert the boilerplate specific flattened content value to the ordinary
CAIRO_CONTENT_COLOR_ALPHA for use with cairo_push_group_with_content() -
otherwise cairo rightfully flags an error and the test harness decides
that the similar surface is not available.
2008-04-11 15:39:11 +01:00
Carl Worth
c19133eb9a Revert "[test] Repeat tests using cairo_push_group()."
This reverts commit 07122e64fa.

The extra testing did find a pdf bug, and that should be fixed,
but the extra maintenance burden of running another iteration
of all tests does not seem justfied at all---particularly since
it looks like dozens of new reference images would be needed
for the svg backend.

Also, the new "failures" of the image backend with this new
testing look like a misunderstanding of exactly what the new
testing is actually drawing.
2008-04-08 01:34:37 -07:00
Chris Wilson
07122e64fa [test] Repeat tests using cairo_push_group().
Test surfaces using similar surfaces with both CONTENT_COLOR and
CONTENT_COLOR_ALPHA, if applicable. This seems justified by the apparent
bugs in the pdf backend when going from an ARGB32 similar surface to
a destination RGB24 surface as well as isolated bugs in the image
backend.

The original goal was to try and trick the test suite into producing
a xlib surface with mismatching Visual/XRenderPictFormat. This succeeds,
although with a little bit of brute force in the xlib backend, but the
search to reproduce a BadMatch error fruitless.
2008-04-08 07:52:46 +01:00
Carl Worth
50d0767c8b Add a1-image-sample and a1-traps-sample tests
Both of these currently fail due to bugs in the way pixman does
its sampling.
2008-01-18 12:41:57 -08:00
Chris Wilson
630536f176 [test/extend-*] Add various cairo_pattern_set_extend() test cases.
Add various test cases to exercise
_cairo_pattern_acquire_surface_for_surface(), most notably using similar
source surfaces to provide coverage of the non-image surface branch.
2008-01-17 17:45:17 +00:00
Chris Wilson
3bf06c3366 [test/*] Create new surfaces using the group target.
cairo_get_target() returns the original surface passed to
cairo_create(), and not the current destination as required when
testing drawing to the same surface using multiple contexts.

For completeness we also use the group target when creating similar
surfaces within the tests (to check that similar surfaces of similar
surfaces also work).
2007-12-20 21:21:32 +00:00
Chris Wilson
14454e12d8 [cairo-test] Wrap test function with cairo_save/restore().
Restore the context to the original state before blitting the
group surface in order to remove any residual state such as a clip path.
2007-12-20 17:51:56 +00:00
Chris Wilson
281b11aef1 [cairo-test] Use CAIRO_OPERATOR_SOURCE when painting the group surface.
To correctly copy a surface onto the destination irrespective of its
content requires the SOURCE operator. Forgetting to do so here causes
uninitialized pixels to be mixed into the result and the failure of
many tests for the similar surface. Oops...
2007-12-20 17:12:08 +00:00
Brian Ewins
77e9b05b2b [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.
2007-11-10 01:34:03 +00:00
Brian Ewins
15fc1bbefb [test] log tested paths so that they can be parsed.
The test logs currently do not record the paths of
image output, the reference images tested against, and
the diffs created. This means that make-html.pl has to
duplicate the policy in cairo-test.c. Fix this by teaching
cairo-test.c to log the paths.
2007-11-10 01:33:47 +00:00
Chris Wilson
483ebe866d [cairo-test] Remove executable flag from source files.
chmod a-x test/cairo-test.[ch]
2007-10-24 19:33:22 +01:00
Chris Wilson
081507a09e [cairo-test] Repeat tests for similar surfaces.
Having noticed strange discrepancies creeping into similar surfaces
whilst working on the xlib backend, I thought it wise to also run
the test harness against similar targets. For consistency, only
targets whose similar surface use the same backend are included.

This can be disabled by exporting CAIRO_TEST_IGNORE_SIMILAR=1.
2007-10-20 00:15:34 +01:00
Behdad Esfahbod
409f973429 [test] If a test target fails, end the test
otherwise cairo is left in a dirty state and further tests are
unreliable.
2007-05-08 14:18:42 -04:00
Chris Wilson
b85920684f [cairo-test] Destroy the check image on failure
If drawing the checker pattern should fail, we need to free the
resources allocated locally.
2007-05-08 16:47:40 +01:00
Behdad Esfahbod
d5535c993b [boilerplate/test] Move vector_ignored_tests from boilerplate/ to test/ 2007-04-20 00:52:02 -04:00
Behdad Esfahbod
157074c794 [boilerplate] Add cairo_boilerplate_get/free_targets
This means, test and perf suites now share the same target handling
code, including parsing CAIRO_TEST_TARGET.
2007-04-18 19:46:30 -04:00
Behdad Esfahbod
47c02a6bd6 [boilerplate] s/_cairo_test_content_name/cairo_boilerplate_content_name/g 2007-04-18 19:15:16 -04:00
Behdad Esfahbod
9f3e0694e6 [test] Allow bypassing all test targets by setting CAIRO_TEST_TARGET=" " 2007-04-18 19:08:54 -04:00
Behdad Esfahbod
f3c8d82d6d [test] If backends are limited and all untested, pass the test
This is necessary to ensure that limiting backends using
CAIRO_TEST_TARGET does not increase the number of tests failing,
which is a desirable invariant.
2007-03-13 16:51:34 -04:00
Carl Worth
8c579ef835 More tightening of test cleanup to avoid valgrind complaints. 2007-03-02 12:30:14 -08:00