aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-03-25 13:51:08 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-03-25 18:21:19 +0000
commitc7fc73ee459045edabb99816658f14f32d23bf92 (patch)
tree6c0c963982b3afa80752298c38556ebdd6913773 /libphobos/src
parentaac12084fc07319d5c8232c51dafa4e297bd5415 (diff)
downloadgcc-c7fc73ee459045edabb99816658f14f32d23bf92.zip
gcc-c7fc73ee459045edabb99816658f14f32d23bf92.tar.gz
gcc-c7fc73ee459045edabb99816658f14f32d23bf92.tar.bz2
libstdc++: Allow seeding random engines in testsuite
The testsuite utilities that use random numbers use a default-constructed mersenne_twister_engine, meaning the values are reproducable. This adds support for seeding them, controlledby an environment variable. Defining GLIBCXX_SEED_TEST_RNG=val in the environment will cause the engines to be seeded with atoi(val) if that is non-zero, or with a value read from std::random_device otherwise. Running with different seeds revealed some bugs in the tests, where a randomly selected iterator was past-the-end (which can't be erased), or where the randomly populated container was empty, and then we tried to remove elements from it unconditionally. libstdc++-v3/ChangeLog: * testsuite/util/exception/safety.h (setup_base::generate): Support seeding random engine. (erase_point, erase_range): Adjust range of random numbers to ensure dereferenceable iterators are used where required. (generation_prohibited::run): Do not try to erase from empty containers. * testsuite/util/testsuite_containergen.h (test_containers): Support seeding random engine.
Diffstat (limited to 'libphobos/src')
0 files changed, 0 insertions, 0 deletions