Commit graph

12 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
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
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
fed9d9060e [test/invalid-matrix] Disable floating point exception.
test/invalid-matrix purposely feeds invalid numbers into cairo, in
order to check its detection of garbage values. In doing so, cairo
raises an Invalid exception, but as this is a direct result of an abuse
of the API we can treat it as expected behaviour and ignore the
exception.
2008-05-06 14:30:49 +01:00
Shailendra Jain
536e1963b7 Compile fix for AIX.
Minor correction for a build failure on AIX:
"mozilla/gfx/cairo/cairo/src/cairo-gstate.c", line 45.43: 1506-294 (S)
Syntax error in expression on #if directive.

(Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=415867.)
2008-02-15 13:50:43 +00:00
Chris Wilson
92970ec836 [test/invalid-matrix] Test detection of infinities.
Feed infinities into the API and check that we correctly return
INVALID_MATRIX.
2008-02-15 13:50:43 +00:00
Chris Wilson
012f68e043 [test/invalid-matrix] Check scale(0,0)
Test that INVALID_MATRIX is returned if the user calls cairo_scale(0,0)
or a variant thereof.
2008-02-15 13:50:43 +00:00
Chris Wilson
eb7488e1e6 [test/invalid-matrix] Promote incorrect status warning to an error.
As the last warning for an incorrect status has been resolved, throw an
error if we regress and no longer report an INVALID_MATRIX under testing.
2008-02-15 13:50:43 +00:00
Chris Wilson
f40f24e272 [test/invalid] Test cairo_translate() and friends for NaN safety.
Pass NaNs to cairo_translate() and friends and check that they raise
an INVALID_MATRIX error.
2008-02-15 13:50:41 +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
35ef8419a9 [cairo-matrix] Check determinant for invalid numbers.
By checking matrices for invalid determinants, we can prevent the
setting and application of invalid matrices.

The trick used here is that NaNs, as specified by IEE754, always
return FALSE in comparisons. Since we know that the square of the
determinant must be positive definite, then if the comparison is
FALSE the computation must have resulted in a NaN.
2007-07-05 19:15:07 +01:00
Carl Worth
bd0b328f7e test/invalid-matrix: Add new test to exercise CAIRO_STATUS_INVALID_MATRIX paths
This new test exercises every path where the user might possibly
pass in an invalid matrix. Currently the test fails if no error
is reported. Also, if an incorrect error is reported, (such as
CAIRO_STATUS_NO_MEMORY instead of CAIRO_STATUS_INVALID_MATRIX),
this is logged as a warning in invalid-matrix.log, but the test
still passes.

It would still be worthwhile to follow up quickly and fix those
cases to propagate the correct error value.
2007-04-11 01:21:10 -07:00