mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
test: Make g_rng_temp_path rand, not dependent on SeedRandomForTest
This commit is contained in:
parent
fa80b08fef
commit
faaaf59f71
1 changed files with 5 additions and 2 deletions
|
@ -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.
|
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 */
|
/** 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 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
|
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);
|
SeedRandomForTest(SeedRand::FIXED_SEED);
|
||||||
|
|
||||||
const std::string test_name{G_TEST_GET_FULL_NAME ? G_TEST_GET_FULL_NAME() : ""};
|
const std::string test_name{G_TEST_GET_FULL_NAME ? G_TEST_GET_FULL_NAME() : ""};
|
||||||
|
|
Loading…
Add table
Reference in a new issue