OSDN Git Service

test: use C random library for random numbers
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 26 Oct 2016 20:24:16 +0000 (13:24 -0700)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 31 Oct 2016 02:00:08 +0000 (10:00 +0800)
commit1062d29f4fa4a3543eeb7b2203b0b80d223113e0
treec0c7eac1cf770fc78057c6d9c8dda338640908c5
parentbf17b32b7b008451cbbc3f3e139611f41b450a0b
test: use C random library for random numbers

The speed of random number generation can have a
significant impact on test execution time when
initializing large arrays of random values. The C++
random number engines and generators are much slower
than std::rand.

Thus, use C's rand() to generate pseudo-random values
within a given [min,max] range.  For testing purposes,
deterministic sequences would be preferable anyway.
That is, if a particular sequence exposes a test failure,
then we can reproduce it later.  Also, we seed the
pseudo-random number generator with the current time
so that the sequence is not always the same across
executions.  The seed is then recorded in the test
results so that the sequence can be reproduced if
needed.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
(cherry picked from commit 9edf73284039f31720eb03f4c2196bb7c4dd033f)
test/i965_test_environment.cpp
test/object_heap_test.cpp
test/test_utils.h