Commit graph

20 commits

Author SHA1 Message Date
M Joonas Pihlaja
742b1ad4b0 [test] Fix checking of the fenv.h include.
This adds a configure check for fenv.h and makes
invalid-matrix.c check for it with HAVE_FENV_H instead
of HAVE_FEDISABLEEXCEPT -- turns out Solaris doesn't
have fedisableexcept(), but it does have feclearexcept().

The same issue appears on OSX and was fixed in
ab86662ab4. This patch
adds some configure magic.
2009-06-18 16:07:56 +01:00
M Joonas Pihlaja
75f1d11d93 [test] Fallback to HUGE_VAL in place of INFINITY in invalid-matrix.c.
GCC 3.4.3 on OpenSolaris does not recognise INFINITY.  Use HUGE_VAL
instead for every compiler instead of just MSVC.
2009-06-18 16:07:56 +01:00
Andrew Lavin
ab86662ab4 [test] Compile fix for invalid-matrix
Fixed test compile error on OS X that caused fenv.h not to be included.
2009-06-03 09:19:26 +01:00
Chris Wilson
477df1f550 [test] Clear expected floating point exceptions
test/invalid-matrix deliberately feeds garbage into the API to test our
error detection. This causes FPE to be raised during the course of the
test - so they are deliberately disable for the duration. However, the
exceptions were not being cleared and so the FPE could be triggered on
the next floating point operation. This was being masked during make check,
by the fact that each test is run in its own forked process and was only
observed when multiple tests were run in foreground mode.
2009-05-15 21:31:03 +01:00
Jeff Muizelaar
41cbd935f9 [test] Add cairo_test_NaN and use it in place of strtod
strtod("NaN") returns 0.0 with the MSVC runtime so we
need to generate NaN some other way.
2009-02-11 15:24:24 -05:00
Jeff Muizelaar
3d2fcec948 [test] Define INFINITY on MSVC
1./0. produces a compiler error on MSVC so we'll use HUGEVAL instead.
2009-02-09 15:12:41 -05:00
Jeff Muizelaar
af5ca7249f [test] Fix the definition of INFINITY
In my defence, even with INFINITY as 0, I was seeing new asserts on win32.
Caught by Jeremy Lea.
2009-02-05 16:46:50 -05:00
Jeff Muizelaar
2676b3bdd6 [test] Define INFINITY if it hasn't been defined.
This lets us use more of invalid-matrix on win32
2009-02-03 14:18:44 -05:00
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