File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,12 +32,17 @@ using testing::GTEST_FLAG(random_seed);
3232
3333namespace Envoy {
3434
35- static const int32_t SEED = std::chrono::duration_cast<std::chrono::nanoseconds>(
36- std::chrono::system_clock::now ().time_since_epoch())
37- .count();
35+ // The purpose of using the static seed here is to use --test_arg=--gtest_random_seed=[seed]
36+ // to specify the seed of the problem to replay.
37+ int32_t getSeed () {
38+ static const int32_t seed = std::chrono::duration_cast<std::chrono::nanoseconds>(
39+ std::chrono::system_clock::now ().time_since_epoch ())
40+ .count ();
41+ return seed;
42+ }
3843
3944TestRandomGenerator::TestRandomGenerator ()
40- : seed_(GTEST_FLAG(random_seed) == 0 ? SEED : GTEST_FLAG(random_seed)), generator_(seed_) {
45+ : seed_(GTEST_FLAG(random_seed) == 0 ? getSeed() : GTEST_FLAG(random_seed)), generator_(seed_) {
4146 std::cerr << " TestRandomGenerator running with seed " << seed_ << " \n " ;
4247}
4348
You can’t perform that action at this time.
0 commit comments