diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-11-19 17:30:40 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-11-19 17:31:59 +0100 |
commit | faaaf59f71ede057b2c1d369ef8db973c2f2dbc2 (patch) | |
tree | 5447350e1008673868c9f849433dd164f0f358ca /src/test | |
parent | fa80b08fef0eaa600339caa678fdf80a8aec3ce3 (diff) |
test: Make g_rng_temp_path rand, not dependent on SeedRandomForTest
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/util/setup_common.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index ee2ef51f96..2cd739d7e3 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -77,6 +77,11 @@ const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr; constexpr inline auto TEST_DIR_PATH_ELEMENT{"test_common bitcoin"}; // Includes a space to catch possible path escape issues. /** Random context to get unique temp data dirs. Separate from m_rng, which can be seeded from a const env var */ static FastRandomContext g_rng_temp_path; +static const bool g_rng_temp_path_init{[] { + // Must be initialized before any SeedRandomForTest + (void)g_rng_temp_path.rand64(); + return true; +}()}; struct NetworkSetup { @@ -134,8 +139,6 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, TestOpts opts) } } - // Use randomly chosen seed for deterministic PRNG, so that (by default) test - // data directories use a random name that doesn't overlap with other tests. SeedRandomForTest(SeedRand::FIXED_SEED); const std::string test_name{G_TEST_GET_FULL_NAME ? G_TEST_GET_FULL_NAME() : ""}; |