Merge bitcoin/bitcoin#30399: test: Add arguments for creating a slimmer TestingSetup

f46b220256 fuzz: Use BasicTestingSetup for coins_view target (TheCharlatan)
9e2a723d5d test: Add arguments for creating a slimmer setup (TheCharlatan)

Pull request description:

  This adds arguments to some of the testing setup constructors for creating an environment without networking and a validation interface. This is useful for improving the performance of the utxo snapshot fuzz test,  which constructs a new TestingSetup on each iteration.

  Using this slimmed down `TestingSetup` in future might also make the tests a bit faster when run in aggregate.

ACKs for top commit:
  maflcko:
    review ACK f46b220256
  dergoegge:
    utACK f46b220256

Tree-SHA512: 9dc62512b127b781fc9e2d8ef2b5a9b06ebb927a8294b6d872001c553984a7eb1f348e0257b32435b34b5505b5d0323f73bdd572a673da272d3e1e8538ab49d6
This commit is contained in:
merge-script
2024-07-25 13:53:50 +01:00
4 changed files with 18 additions and 8 deletions

View File

@@ -27,7 +27,6 @@
#include <vector>
namespace {
const TestingSetup* g_setup;
const Coin EMPTY_COIN{};
bool operator==(const Coin& a, const Coin& b)
@@ -39,8 +38,7 @@ bool operator==(const Coin& a, const Coin& b)
void initialize_coins_view()
{
static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
g_setup = testing_setup.get();
static const auto testing_setup = MakeNoLogFileContext<>();
}
FUZZ_TARGET(coins_view, .init = initialize_coins_view)

View File

@@ -31,7 +31,13 @@ void initialize_chain()
FUZZ_TARGET(utxo_snapshot, .init = initialize_chain)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
std::unique_ptr<const TestingSetup> setup{MakeNoLogFileContext<const TestingSetup>()};
std::unique_ptr<const TestingSetup> setup{
MakeNoLogFileContext<const TestingSetup>(
ChainType::REGTEST,
TestOpts{
.setup_net = false,
.setup_validation_interface = false,
})};
const auto& node = setup->m_node;
auto& chainman{*node.chainman};