Merge #21264: fuzz: Two scripted diff renames

fae216a73d scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContext (MarcoFalke)
fa4fbec03e scripted-diff: Rename PROVIDE_MAIN_FUNCTION -> PROVIDE_FUZZ_MAIN_FUNCTION (MarcoFalke)

Pull request description:

  Split out two renames from #21003:

  * `PROVIDE_FUZZ_MAIN_FUNCTION`. *Reason*: This in only used by fuzzing, so the name should indicate that.
  * `MakeNoLogFileContext`. *Reason*: Better reflects what the helper does. Also, prepares it to be used in non-fuzz tests in the future.

ACKs for top commit:
  practicalswift:
    cr ACK fae216a73d: scripted-diff looks correct

Tree-SHA512: e5d347746f5da72b0c86fd4f07ac2e4b3016e88e8c97a830c73bd79d0af6d0245fe7712487fc20344d6cc25958941716c1678124a123930407e3a437265b71df
This commit is contained in:
MarcoFalke 2021-02-25 14:42:26 +01:00
commit cac10e66d2
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
36 changed files with 51 additions and 51 deletions

View file

@ -1269,7 +1269,7 @@ if test "x$enable_fuzz" = "xyes"; then
[[-fsanitize=$use_sanitizers]],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"],
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
[],
[AC_LANG_PROGRAM([[
#include <cstdint>
@ -1293,7 +1293,7 @@ else
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
fi
if test x$enable_wallet != xno; then

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -26,7 +26,7 @@ int64_t ConsumeBanTimeOffset(FuzzedDataProvider& fuzzed_data_provider) noexcept
void initialize_banman()
{
static const auto testing_setup = MakeFuzzingContext<>();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET_INIT(banman, initialize_banman)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -36,7 +36,7 @@ bool operator==(const Coin& a, const Coin& b)
void initialize_coins_view()
{
static const auto testing_setup = MakeFuzzingContext<const TestingSetup>();
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
}
FUZZ_TARGET_INIT(coins_view, initialize_coins_view)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -17,7 +17,7 @@
void initialize_connman()
{
static const auto testing_setup = MakeFuzzingContext<>();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET_INIT(connman, initialize_connman)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -13,7 +13,7 @@
void initialize_data_stream_addr_man()
{
static const auto testing_setup = MakeFuzzingContext<>();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET_INIT(data_stream_addr_man, initialize_data_stream_addr_man)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Copyright (c) 2009-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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Copyright (c) 2009-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.
@ -44,7 +44,7 @@ void initialize()
std::get<1>(it->second)();
}
#if defined(PROVIDE_MAIN_FUNCTION)
#if defined(PROVIDE_FUZZ_MAIN_FUNCTION)
static bool read_stdin(std::vector<uint8_t>& data)
{
uint8_t buffer[1024];
@ -71,7 +71,7 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
return 0;
}
#if defined(PROVIDE_MAIN_FUNCTION)
#if defined(PROVIDE_FUZZ_MAIN_FUNCTION)
int main(int argc, char** argv)
{
initialize();

View file

@ -1,4 +1,4 @@
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Copyright (c) 2009-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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -15,7 +15,7 @@
void initialize_load_external_block_file()
{
static const auto testing_setup = MakeFuzzingContext<const TestingSetup>();
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
}
FUZZ_TARGET_INIT(load_external_block_file, initialize_load_external_block_file)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -22,7 +22,7 @@
void initialize_net()
{
static const auto testing_setup = MakeFuzzingContext<>(CBaseChainParams::MAIN);
static const auto testing_setup = MakeNoLogFileContext<>(CBaseChainParams::MAIN);
}
FUZZ_TARGET_INIT(net, initialize_net)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -16,7 +16,7 @@
void initialize_policy_estimator()
{
static const auto testing_setup = MakeFuzzingContext<>();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET_INIT(policy_estimator, initialize_policy_estimator)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -12,7 +12,7 @@
void initialize_policy_estimator_io()
{
static const auto testing_setup = MakeFuzzingContext<>();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET_INIT(policy_estimator_io, initialize_policy_estimator_io)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -56,7 +56,7 @@ void initialize_process_message()
{
Assert(GetNumMsgTypes() == getAllNetMessageTypes().size()); // If this fails, add or remove the message type below
static const auto testing_setup = MakeFuzzingContext<const TestingSetup>();
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
g_setup = testing_setup.get();
for (int i = 0; i < 2 * COINBASE_MATURITY; i++) {
MineBlock(g_setup->m_node, CScript() << OP_TRUE);

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -23,7 +23,7 @@ const TestingSetup* g_setup;
void initialize_process_messages()
{
static const auto testing_setup = MakeFuzzingContext<const TestingSetup>();
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
g_setup = testing_setup.get();
for (int i = 0; i < 2 * COINBASE_MATURITY; i++) {
MineBlock(g_setup->m_node, CScript() << OP_TRUE);

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2019-2020 The Bitcoin Core developers
// Copyright (c) 2019-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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.
@ -17,7 +17,7 @@
void initialize_signet()
{
static const auto testing_setup = MakeFuzzingContext<>(CBaseChainParams::SIGNET);
static const auto testing_setup = MakeNoLogFileContext<>(CBaseChainParams::SIGNET);
}
FUZZ_TARGET_INIT(signet, initialize_signet)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020 The Bitcoin Core developers
// 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.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Copyright (c) 2009-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.
@ -325,7 +325,7 @@ inline std::unique_ptr<CNode> ConsumeNodeAsUniquePtr(FuzzedDataProvider& fdp, co
void FillNode(FuzzedDataProvider& fuzzed_data_provider, CNode& node, bool init_version) noexcept;
template <class T = const BasicTestingSetup>
std::unique_ptr<T> MakeFuzzingContext(const std::string& chain_name = CBaseChainParams::REGTEST, const std::vector<const char*>& extra_args = {})
std::unique_ptr<T> MakeNoLogFileContext(const std::string& chain_name = CBaseChainParams::REGTEST, const std::vector<const char*>& extra_args = {})
{
// Prepend default arguments for fuzzing
const std::vector<const char*> arguments = Cat(