turn off randomness when running under valgrind
Change-Id: Ic9853c967cdc36b1bf919a4914b04bf6752f0834 Reviewed-on: https://gerrit.libreoffice.org/53374 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -17,6 +17,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#if defined HAVE_VALGRIND_HEADERS
|
||||||
|
#include <valgrind/memcheck.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// this is nothing but a simple wrapper around
|
// this is nothing but a simple wrapper around
|
||||||
// the std::random generators
|
// the std::random generators
|
||||||
@@ -40,6 +43,12 @@ struct RandomNumberGenerator
|
|||||||
RandomNumberGenerator()
|
RandomNumberGenerator()
|
||||||
{
|
{
|
||||||
bool bRepeatable = (getenv("SAL_RAND_REPEATABLE") != nullptr);
|
bool bRepeatable = (getenv("SAL_RAND_REPEATABLE") != nullptr);
|
||||||
|
// valgrind on some platforms (e.g.Ubuntu16.04) does not support the new Intel RDRAND instructions,
|
||||||
|
// which leads to "Illegal Opcode" errors, so just turn off randomness.
|
||||||
|
#if defined HAVE_VALGRIND_HEADERS
|
||||||
|
if (RUNNING_ON_VALGRIND)
|
||||||
|
bRepeatable = true;
|
||||||
|
#endif
|
||||||
if (bRepeatable)
|
if (bRepeatable)
|
||||||
{
|
{
|
||||||
global_rng.seed(42);
|
global_rng.seed(42);
|
||||||
|
Reference in New Issue
Block a user