aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/stress-test.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-24 07:37:29 +0000
committermarha <marha@users.sourceforge.net>2011-03-24 07:37:29 +0000
commitb39f063f74bf0163eaf34db03134f226d18142ec (patch)
treebf7f3736a65e74d20d63cc9f9938d9006dc2a1fe /pixman/test/stress-test.c
parenteca5dee9e7a8dea1edba4d10b60444ac0e884139 (diff)
downloadvcxsrv-b39f063f74bf0163eaf34db03134f226d18142ec.tar.gz
vcxsrv-b39f063f74bf0163eaf34db03134f226d18142ec.tar.bz2
vcxsrv-b39f063f74bf0163eaf34db03134f226d18142ec.zip
xserver xkeyboard-config libX11 pixman mesa git update 24 Mar 2011
Diffstat (limited to 'pixman/test/stress-test.c')
-rw-r--r--pixman/test/stress-test.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c
index 166dc6d2c..d496f93e2 100644
--- a/pixman/test/stress-test.c
+++ b/pixman/test/stress-test.c
@@ -1,4 +1,6 @@
+#include <stdio.h>
#include "utils.h"
+#include <sys/types.h>
#if 0
#define fence_malloc malloc
@@ -730,11 +732,17 @@ static const pixman_op_t op_list[] =
};
static void
-run_test (uint32_t seed)
+run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod)
{
pixman_image_t *source, *mask, *dest;
pixman_op_t op;
+ if (verbose)
+ {
+ if (mod == 0 || (seed % mod) == 0)
+ printf ("Seed 0x%08x\n", seed);
+ }
+
lcg_srand (seed);
source = create_random_image ();
@@ -787,6 +795,7 @@ main (int argc, char **argv)
uint32_t seed = 1;
uint32_t n_tests = 0xffffffff;
uint32_t mod = 0;
+ pixman_bool_t use_threads = TRUE;
uint32_t i;
pixman_disable_out_of_bounds_workaround ();
@@ -811,6 +820,7 @@ main (int argc, char **argv)
else if (strcmp (argv[i], "-s") == 0 && i + 1 < argc)
{
get_int (argv[i + 1], &seed);
+ use_threads = FALSE;
i++;
}
else if (strcmp (argv[i], "-n") == 0 && i + 1 < argc)
@@ -825,7 +835,7 @@ main (int argc, char **argv)
printf ("Options:\n\n"
"-n <number> Number of tests to run\n"
- "-s <seed> Seed of first test\n"
+ "-s <seed> Seed of first test (ignored if PIXMAN_RANDOMIZE_TESTS is set)\n"
"-v Print out seeds\n"
"-v <n> Print out every n'th seed\n\n");
@@ -836,19 +846,24 @@ main (int argc, char **argv)
if (n_tests == 0xffffffff)
n_tests = 8000;
- /* FIXME: seed 2005763 fails in set_lum() with divide by zero */
+ if (getenv ("PIXMAN_RANDOMIZE_TESTS"))
+ {
+ seed = get_random_seed();
+ printf ("First seed: 0x%08x\n", seed);
+ }
+
+ if (use_threads)
+ {
#ifdef USE_OPENMP
# pragma omp parallel for default(none) shared(verbose, n_tests, mod, seed)
#endif
- for (i = seed; i < seed + n_tests; ++i)
+ for (i = seed; i < seed + n_tests; ++i)
+ run_test (i, verbose, mod);
+ }
+ else
{
- if (verbose)
- {
- if (mod == 0 || (i % mod) == 0)
- printf ("Seed %d\n", i);
- }
-
- run_test (i);
+ for (i = seed; i < seed + n_tests; ++i)
+ run_test (i, verbose, mod);
}
return 0;