aboutsummaryrefslogtreecommitdiff
path: root/src/test/util
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2024-03-15 14:32:20 -0400
committerPieter Wuille <pieter@wuille.net>2024-07-01 12:39:57 -0400
commit97e16f57042cab07e5e73f6bed19feec2006e4f7 (patch)
treeb44f87a8715574b430292373969db7545d3bc82a /src/test/util
parent2c91330dd68064e402e8eceea3df9474bb7afd48 (diff)
tests: make fuzz tests (mostly) deterministic with fixed seed
Diffstat (limited to 'src/test/util')
-rw-r--r--src/test/util/setup_common.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index 283e19971c..52981bd2dc 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -145,6 +145,10 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vecto
}
}
+ // 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::SEED);
+
if (!m_node.args->IsArgSet("-testdatadir")) {
// By default, the data directory has a random name
const auto rand_str{g_insecure_rand_ctx_temp_path.rand256().ToString()};
@@ -178,7 +182,6 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vecto
gArgs.ForceSetArg("-datadir", fs::PathToString(m_path_root));
SelectParams(chainType);
- SeedRandomForTest();
if (G_TEST_LOG_FUN) LogInstance().PushBackCallback(G_TEST_LOG_FUN);
InitLogging(*m_node.args);
AppInitParameterInteraction(*m_node.args);