diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-24 11:37:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-25 08:27:19 +0200 |
commit | 64a0f135a08d7d25fc3a796e604336f64bbd3ddb (patch) | |
tree | da94714744c91b908c2424c76b9283f1e887069e /comphelper/source/misc/random.cxx | |
parent | dbb1dbe7a741415acf1132a29aba7cff5dfe638c (diff) |
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>
Diffstat (limited to 'comphelper/source/misc/random.cxx')
-rw-r--r-- | comphelper/source/misc/random.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx index 280e6e20fd00..bfb4de15aee5 100644 --- a/comphelper/source/misc/random.cxx +++ b/comphelper/source/misc/random.cxx @@ -17,6 +17,9 @@ #include <time.h> #include <random> #include <stdexcept> +#if defined HAVE_VALGRIND_HEADERS +#include <valgrind/memcheck.h> +#endif // this is nothing but a simple wrapper around // the std::random generators @@ -40,6 +43,12 @@ struct RandomNumberGenerator RandomNumberGenerator() { 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) { global_rng.seed(42); |