diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-10 16:37:03 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-21 10:09:56 +0200 |
commit | fa3669f72f69662049b55ad1a482b4a0f9f7ae40 (patch) | |
tree | d27bb746d07e98ee1afd165323c10a4e898695ac /src/test | |
parent | fa7a883f5a219d5f3c2f992b090db4e6c279db12 (diff) | |
download | bitcoin-fa3669f72f69662049b55ad1a482b4a0f9f7ae40.tar.xz |
fuzz: Move all addrman fuzz targets to one file
Can be reviewed with --color-moved=dimmed-zebra
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/addrman.cpp | 11 | ||||
-rw-r--r-- | src/test/fuzz/data_stream.cpp | 30 |
2 files changed, 11 insertions, 30 deletions
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp index 95c5a99c1b..45ee778b87 100644 --- a/src/test/fuzz/addrman.cpp +++ b/src/test/fuzz/addrman.cpp @@ -23,6 +23,17 @@ void initialize_addrman() SelectParams(CBaseChainParams::REGTEST); } +FUZZ_TARGET_INIT(data_stream_addr_man, initialize_addrman) +{ + FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; + CDataStream data_stream = ConsumeDataStream(fuzzed_data_provider); + CAddrMan addr_man(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0); + try { + ReadFromStream(addr_man, data_stream); + } catch (const std::exception&) { + } +} + class CAddrManDeterministic : public CAddrMan { public: diff --git a/src/test/fuzz/data_stream.cpp b/src/test/fuzz/data_stream.cpp deleted file mode 100644 index 323090e041..0000000000 --- a/src/test/fuzz/data_stream.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2020-2021 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include <addrdb.h> -#include <addrman.h> -#include <net.h> -#include <test/fuzz/FuzzedDataProvider.h> -#include <test/fuzz/fuzz.h> -#include <test/fuzz/util.h> -#include <test/util/setup_common.h> - -#include <cstdint> -#include <vector> - -void initialize_data_stream_addr_man() -{ - static const auto testing_setup = MakeNoLogFileContext<>(); -} - -FUZZ_TARGET_INIT(data_stream_addr_man, initialize_data_stream_addr_man) -{ - FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; - CDataStream data_stream = ConsumeDataStream(fuzzed_data_provider); - CAddrMan addr_man(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0); - try { - ReadFromStream(addr_man, data_stream); - } catch (const std::exception&) { - } -} |