test: Add new thread-test program
authorSøren Sandmann Pedersen <ssp@redhat.com>
Sat, 28 Sep 2013 05:10:24 +0000 (01:10 -0400)
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>
Tue, 1 Oct 2013 20:33:57 +0000 (23:33 +0300)
commit0438435b9c915b61af21446b2cb2f77a2b98a3b9
tree1550bb2f7192ac34257147e46f79d636d3dc599a
parent65829504073425362fc56995a1dcc8cc464b751a
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
test/Makefile.am
test/Makefile.sources
test/thread-test.c [new file with mode: 0644]