mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
fuzz: non-addrman fuzz tests: override-able check ratio
Make it possible to override from the command line (without recompiling) the addrman check ratio in non-addrman fuzz tests (connman and deserialize) instead of hardcoding it to 0: ``` FUZZ=connman ./src/test/fuzz/fuzz --checkaddrman=5 ```
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
#include <pubkey.h>
|
||||
#include <script/keyorigin.h>
|
||||
#include <streams.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <undo.h>
|
||||
#include <util/system.h>
|
||||
#include <version.h>
|
||||
|
||||
#include <exception>
|
||||
@@ -35,8 +37,15 @@
|
||||
|
||||
using node::SnapshotMetadata;
|
||||
|
||||
namespace {
|
||||
const BasicTestingSetup* g_setup;
|
||||
} // namespace
|
||||
|
||||
void initialize_deserialize()
|
||||
{
|
||||
static const auto testing_setup = MakeNoLogFileContext<>();
|
||||
g_setup = testing_setup.get();
|
||||
|
||||
// Fuzzers using pubkey must hold an ECCVerifyHandle.
|
||||
static const ECCVerifyHandle verify_handle;
|
||||
}
|
||||
@@ -191,7 +200,9 @@ FUZZ_TARGET_DESERIALIZE(blockmerkleroot, {
|
||||
BlockMerkleRoot(block, &mutated);
|
||||
})
|
||||
FUZZ_TARGET_DESERIALIZE(addrman_deserialize, {
|
||||
AddrMan am(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0);
|
||||
AddrMan am(/*asmap=*/std::vector<bool>(),
|
||||
/*deterministic=*/false,
|
||||
g_setup->m_node.args->GetIntArg("-checkaddrman", 0));
|
||||
DeserializeFromFuzzingInput(buffer, am);
|
||||
})
|
||||
FUZZ_TARGET_DESERIALIZE(blockheader_deserialize, {
|
||||
|
||||
Reference in New Issue
Block a user