mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
tests: make fuzz tests (mostly) deterministic with fixed seed
This commit is contained in:
@@ -102,6 +102,12 @@ void ResetCoverageCounters() {}
|
||||
|
||||
void initialize()
|
||||
{
|
||||
// By default, make the RNG deterministic with a fixed seed. This will affect all
|
||||
// randomness during the fuzz test, except:
|
||||
// - GetStrongRandBytes(), which is used for the creation of private key material.
|
||||
// - Creating a BasicTestingSetup or derived class will switch to a random seed.
|
||||
SeedRandomForTest(SeedRand::ZEROS);
|
||||
|
||||
// Terminate immediately if a fuzzing harness ever tries to create a socket.
|
||||
// Individual tests can override this by pointing CreateSock to a mocked alternative.
|
||||
CreateSock = [](int, int, int) -> std::unique_ptr<Sock> { std::terminate(); };
|
||||
|
||||
Reference in New Issue
Block a user