Commit Graph

61 Commits

Author SHA1 Message Date
Søren Sandmann Pedersen
0438435b9c test: Add new thread-test program
This test program allocates an array of 16 * 7 uint32_ts and spawns 16
threads that each use 7 of the allocated uint32_ts as a destination
image for a large number of composite operations. Each thread then
computes and returns a checksum for the image. Finally, the main
thread computes a checksum of the checksums and verifies that it
matches expectations.

The purpose of this test is catch errors where memory outside images
is read and then written back. Such out-of-bounds accesses are broken
when multiple threads are involved, because the threads will race to
read and write the shared memory.

V2:
- Incorporate fixes from Siarhei for endianness and undefined behavior
  regarding argument evaluation
- Make the images 7 pixels wide since the bug only happens when the
  composite width is greater than 4.
- Compute a checksum of the checksums so that you don't have to
  update 16 values if something changes.

V3: Remove stray dollar sign
2013-10-01 23:33:57 +03:00
Søren Sandmann Pedersen
d1434d112c test: Add new check-formats utility
Given an operator and two formats, this program will composite and
check all pixels where the red and blue channels are 0. That is, if
the two formats are a8r8g8b8 and a4r4g4b4, all source pixels matching
the mask

    0xff00ff00

are composited with the given operator against all destination pixels
matching the mask

    0xf0f0

and the result is then verified against the do_composite() function
that was moved to utils.c earlier.

This program reveals that a number of operators and format
combinations are not computed to within the precision currently
accepted by pixel_checker_t. For example:

    check-formats over a8r8g8b8 r5g6b5 | grep failed | wc -l
    30

reveals that there are 30 pixel combinations where OVER produces
insufficiently precise results for the a8r8g8b8 and r5g6b5 formats.
2013-02-13 02:18:01 -05:00
Matt Turner
61dacffaf4 Convert INCLUDES to AM_CPPFLAGS
INCLUDES has been deprecated starting with automake 1.13. Convert all
occurrences with the recommended AM_CPPFLAGS replacement.
2013-01-22 22:08:30 -08:00
Benjamin Otte
01c2dcbe69 build: replace @VAR@ with $(VAR) in makefiles 2011-09-28 01:48:02 +02:00
Jon TURNEY
3432e1a344 Fix build on cygwin after commit efdf65c0c4
libutils depends on pixman and so needs to preceed it in the link order

Found by tinderbox, see [1]

[1] http://tinderbox.freedesktop.org/builds/2011-09-15-0005/logs/pixman/#build

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
2011-09-19 06:17:58 -04:00
Andrea Canciani
efdf65c0c4 build: Reuse test sources
Makefile.am and Makefile.win32 should not duplicate content, as this
leads to breaking the build when they are not kept in sync.

This can be avoided by listing sources, headers and common build
variables/rules in a Makefile.sources file.

In order to further simplify the test makefiles, the utility functions
are now in a static library, which gets linked to all the tests and
benchmarks.
2011-09-14 07:03:34 -07:00
Søren Sandmann Pedersen
9882d832f6 Use pkg-config to determine the flags to use with libpng
Previously we would unconditionally link with -lpng leading to build
failures on systems without libpng.
2011-09-12 22:39:53 -04:00
Søren Sandmann Pedersen
99a53667da test: New function to save a pixman image to .png
When debugging it is often very useful to be able to save an image as
a png file. This commit adds a function "write_png()" that does that.

If libpng is not available, then the function becomes a noop.
2011-09-10 04:07:50 -04:00
Søren Sandmann Pedersen
795ec5af2f New test of pixman_region_contains_{rectangle,point}
This test generates random regions and checks whether random boxes and
points are contained within them. The results are combined and a CRC32
value is computed and compared to a known-correct one.
2011-08-11 03:32:14 -04:00
Siarhei Siamashka
0df43b8ae5 test: check correctness of 'bilinear_pad_repeat_get_scanline_bounds'
Individual correctness check for the new bilinear scaling related
supplementary function. This test program uses a bit wider range
of input arguments, not covered by other tests.
2011-02-28 15:29:23 +02:00
Søren Sandmann Pedersen
4e6dd4928d Add a test program for pixman_composite_trapezoids().
A CRC32 based test program to check that pixman_composite_trapezoids()
actually works.
2011-02-15 09:25:18 -05:00
Søren Sandmann Pedersen
1feaf6bea7 test/Makefile.am: Move all the TEST_LDADD into a new global LDADD.
This gets rid of a bunch of replicated *_LDADD clauses
2011-02-15 09:25:17 -05:00
Søren Sandmann Pedersen
1237fd9bc8 Add @TESTPROGS_EXTRA_LDFLAGS@ to AM_LDFLAGS
Instead of explicitly adding it to each test program.
2011-02-15 09:25:17 -05:00
Søren Sandmann Pedersen
7dfe845786 Move all the GTK+ based test programs to a new subdir, "demos"
This separates the test suite from the random gtk+ using test
programs. "demos" is somewhat misleading because the programs there
are not particularly exciting (with the possible exception of
composite-test which shows off all the compositing operators).
2011-02-15 09:25:17 -05:00
Andrea Canciani
2ac4ae1ae2 Add a test for radial gradients
radial-test is a port of the radial-gradient test from the cairo test
suite. It has been modified so that some pixels have 0 in both the a
and b coefficients of the quadratic equation solved by the rasterizer,
to expose a division by zero in the original implementation.
2011-01-19 13:17:03 +01:00
Siarhei Siamashka
2bbd553bd2 A new configure option --enable-static-testprogs
This option can be used for building fully static binaries of the test
programs so that they can be easily run using qemu-user. With binfmt-misc
configured, 'make check' works fine for crosscompiled pixman builds.
2011-01-16 23:40:34 +02:00
Søren Sandmann Pedersen
3479050216 Add a test compositing with the various PDF operators.
The test has floating point exceptions enabled, and currently fails
with a divide-by-zero.
2010-12-20 19:37:11 -05:00
Cyril Brulebois
45a2d01077 Fix linking issues when HAVE_FEENABLEEXCEPT is set.
All objects using test/util.c fail to link:
|   CCLD   region-test
| /usr/bin/ld: utils.o: in function enable_fp_exceptions:utils.c(.text+0x939): error: undefined reference to 'feenableexcept'

There's indeed no explicit dependency on -lm, and if HAVE_FEENABLEEXCEPT
happens to be set, test/util.c uses feenableexcept(), which is nowhere
to be found while linking.

Fix this by adding -lm to TEST_LDADD, although two alternatives could be
thought of:
 - Only specifying -lm for objects using util.c.
 - Introducing a conditional to add -lm only when configure detects
   have_feenableexcept=yes.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
2010-12-20 09:55:07 -05:00
Søren Sandmann Pedersen
f914cf4486 Add a stress-test program.
This test program tries to use as many rarely-used features as
possible, including alpha maps, accessor functions, oddly-sized
images, strange transformations, conical gradients, etc.

The hope is to provoke crashes or irregular behavior in pixman.
2010-12-17 17:03:29 -05:00
Søren Sandmann Pedersen
2444b2265a Extend gradient-crash-test
Test the gradients with various transformations, and test cases where
the gradients are specified with two identical points.
2010-12-17 16:57:38 -05:00
Søren Sandmann Pedersen
9c19a85b00 Remove workaround for a bug in the 1.6 X server.
There used to be a bug in the X server where it would rely on
out-of-bounds accesses when it was asked to composite with a
window as the source. It would create a pixman image pointing
to some bogus position in memory, but then set a clip region
to the position where the actual bits were.

Due to a bug in old versions of pixman, where it would not clip
against the image bounds when a clip region was set, this would
actually work. So when the pixman bug was fixed, a workaround was
added to allow certain out-of-bound accesses.

However, the 1.6 X server is so old now that we can remove this
workaround. This does mean that if you update pixman to 0.22 or later,
you will need to use a 1.7 X server or later.
2010-11-04 21:03:38 -04:00
Søren Sandmann Pedersen
a10ccc9f30 test: Change composite so that it tests randomly generated images
Previously this test would try to exhaustively test all combinations
of formats and operators, which meant that it would take hours to run.
Instead, generate images randomly and test compositing those.

Cc: chris@chris-wilson.co.uk
2010-10-11 12:06:20 -04:00
Jonathan Morton
7cd4f2fa20 Add a lowlevel blitter benchmark
This test is a modified version of Siarhei's compositor throughput
benchmark.  It's expanded with explicit reporting of memory bandwidth
consumption for the M-test, and with an additional 8x8-random test
intended to determine peak ops/sec capability.  There are also quite a
lot more operations tested for.
2010-09-21 08:50:18 -04:00
Søren Sandmann Pedersen
6d1e10a8b5 test: Add affine-test
This test tests compositing with various affine transformations. It is
almost identical to scaling-test, except that it also applies a random
rotation in addition to the random scaling and translation.
2010-09-21 08:31:09 -04:00
Søren Sandmann Pedersen
ae77548f0d Update and extend the alphamap test
- Test many more combinations of formats

- Test destination alpha maps

- Test various different alpha origins

Also add a transformation to the destination, but comment it out
because it is actually broken at the moment (and pretty difficult to
fix).
2010-09-21 08:28:55 -04:00
Benjamin Otte
4d8fb1bc01 region: Add a new test region-translate
This test exercises a bug in pixman_region32_translate(). The function
clips the region to int16 coordinates SHRT_MIN/SHRT_MAX.
2010-08-24 12:17:18 +02:00
Søren Sandmann Pedersen
9fe7d32c4b Add alpha-loop test program
This tests what happens if you attempt to make an image with an alpha
map that has the image as its alpha map. This results in an infinite
loop in _pixman_image_validate(), so the test sets up a SIGALRM to
exit if it runs for more than five seconds.
2010-08-15 21:57:18 -04:00
Siarhei Siamashka
af3eeaeb13 test: 'scaling-crash-test' added
This test tries to exploit some corner cases and previously known
bugs in nearest neighbor scaling fast path code, attempting to
crash pixman or cause some other nasty effect.
2010-07-27 16:07:07 +03:00
Andrea Canciani
445eb6385f test: verify that gradients do not crash pixman
Test gradients under particular conditions (no stops, all the stops
at the same offset) to check that pixman does not misbehave.
2010-06-09 17:30:41 +02:00
Siarhei Siamashka
cfc4e38852 test: added OpenMP support for better utilization of multiple CPU cores
Some of the tests are quite heavy CPU users and may benefit from
using multiple CPU cores, so the programs from 'test' directory
are now built with OpenMP support. OpenMP is easy to use, portable
and also takes care of making a decision about how many threads
to spawn.
2010-05-13 21:04:55 +03:00
Søren Sandmann Pedersen
526132fa65 Remove alphamap from the GTK+ part of tests/Makefile.am
It doesn't use GTK+ and it was already listed in the non-GTK+ part.
2010-04-22 12:14:23 -04:00
Søren Sandmann Pedersen
16ef3ab230 Add a1-trap-test
When a trapezoid sample point is exactly on a polygon edge, the rule
is that it is considered inside the trapezoid if the edge is a top or
left edge, but outside for bottom and right edges.

This program tests that for a1 trapezoids.
2010-02-24 21:01:24 -05:00
Alexander Larsson
f32d585069 Test pixman_region32_init_from_image in region-test 2010-02-19 11:25:41 +01:00
Søren Sandmann Pedersen
042f978b04 test: Add new alphamap test program.
This program demonstrates three bugs relating to alpha maps:

- When fetching from an alpha map into 32 bit intermediates, we use
  the fetcher from the image, and not the one from the alpha map.

- For 64 bit intermediates we call fetch_pixel_generic_lossy_32()
  which then calls fetch_pixel_raw_64, which is NULL because alpha
  images are never validated.

- The alpha map should be used *in place* of any existing alpha
  channel, but we are actually multiplying it onto the image.
2010-01-17 16:47:15 -05:00
Søren Sandmann Pedersen
b3afacf9c9 Reorder tests so that they fastest ones run first. 2009-12-16 15:27:50 -05:00
Marvin Schmidt
bbc5108bf8 Build tests and run non-GTK+ ones on make check
Setting TESTS will run the tests on `make check`

Bug 25131
2009-12-16 15:24:36 -05:00
Søren Sandmann Pedersen
cc34554652 test: In scaling-test use the crc32 from utils.c 2009-11-17 00:32:03 -05:00
Søren Sandmann Pedersen
b465b8b79d test: Move CRC32 code from blitters-test to new files utils.[ch] 2009-11-17 00:32:03 -05:00
Søren Sandmann Pedersen
56bd913401 test: Rename utils.[ch] to gtk-utils.[ch] 2009-11-17 00:32:03 -05:00
Chris Wilson
8f2daa7ca2 [test] Add composite test from rendercheck
Iterate over all destination formats for dst, src and composite and
compare the result of all oprators with a selection of colours.
2009-09-13 16:33:01 +01:00
Siarhei Siamashka
67769ad5bf Test program for stressing the use of different formats and operators
The code and overall method is mostly based on scaling-test. This one
focuses on trying to stress as many different color formats and types
of composition operations as possible.

This is an initial implementation which may need more tuning. Also
not all color format and operator combinations are actually used.

When cpu specific optimizations are disabled, this test provides
identical deterministic results on x86, PPC and ARM.

Script blitters-test-bisect.rb now works in non-stop mode, until
it finds any problem. This allows to run it for example overnight
in order to test a lot more variants of pixman calls and increase
chances of detecting problems in pixman. Just like with scaling-test,
running blitters-test binary alone with no command line arguments
runs a small predefined number of tests and compares checksum
with a reference value for quick verification.
2009-08-08 18:50:41 -04:00
Søren Sandmann Pedersen
dfdb8509e2 Add test case for bug 22844. 2009-07-21 01:27:46 -04:00
Søren Sandmann Pedersen
bcf01c21d7 Fix a couple of problems with the tests when HAVE_GTK is not defined.
- Make sure the non-gtk+ test programs are added to noinst_PROGRAMS
  when HAVE_GTK is not set.

- Don't include glib.h in oob-test.c
2009-07-09 01:47:19 -04:00
Søren Sandmann Pedersen
bed9c378ff Add test case for out-of-bounds memory access. 2009-06-24 10:37:07 -04:00
Søren Sandmann Pedersen
905856f43d Add convolution-test.c program 2009-06-23 16:37:35 -04:00
Søren Sandmann Pedersen
e3a94e8928 Add screen-test.c test program 2009-06-23 14:42:37 -04:00
Søren Sandmann Pedersen
85b390cadf Fix alpha map computation in pixman_compute_composite_region()
According to the RENDER spec, the origin of the alpha map is
interpreted relative to the origin of the drawable of the image, not
the origin of the drawable of the alpha map.

This commit fixes that and adds an alpha-test.c test program.

The only use of alpha maps I have been able to find is in Qt and they
don't use a non-zero alpha origin.
2009-05-21 18:25:57 -04:00
Søren Sandmann Pedersen
81b94d7258 Add test that shows difference in clipping with transformed vs untransformed 2009-05-13 13:09:45 -04:00
Søren Sandmann Pedersen
f98c800fba Mention utils.h in test/Makefile.am so that make dist will pick it up
Pointed out by Julien Cristau.
2009-05-04 18:54:27 -04:00
Søren Sandmann Pedersen
e047f605e2 Move all the GTK+ test code into its own file, utils.c 2009-05-04 18:34:54 -04:00