mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
fuzz: use ConnmanTestMsg
in connman
Using `ConnmanTestMsg` we can add nodes and be more effective fuzzing functions like `DisconnectNode`, `FindNode`, `GetNodeStats` and other ones.
This commit is contained in:
parent
c123e1d215
commit
ecfe507e07
1 changed files with 9 additions and 1 deletions
|
@ -32,7 +32,7 @@ FUZZ_TARGET(connman, .init = initialize_connman)
|
|||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
ConnmanTestMsg connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
*g_setup->m_node.addrman,
|
||||
*g_setup->m_node.netgroupman,
|
||||
|
@ -41,6 +41,12 @@ FUZZ_TARGET(connman, .init = initialize_connman)
|
|||
CNode random_node = ConsumeNode(fuzzed_data_provider);
|
||||
CSubNet random_subnet;
|
||||
std::string random_string;
|
||||
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
|
||||
CNode& p2p_node{*ConsumeNodeAsUniquePtr(fuzzed_data_provider).release()};
|
||||
connman.AddTestNode(p2p_node);
|
||||
}
|
||||
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
|
@ -128,4 +134,6 @@ FUZZ_TARGET(connman, .init = initialize_connman)
|
|||
(void)connman.GetTotalBytesSent();
|
||||
(void)connman.GetTryNewOutboundPeer();
|
||||
(void)connman.GetUseAddrmanOutgoing();
|
||||
|
||||
connman.ClearTestNodes();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue