test: [refactor] Pass TestOpts

This commit is contained in:
MarcoFalke
2024-07-08 15:45:56 +02:00
parent bd5d1688b4
commit fa690c8e53
13 changed files with 40 additions and 41 deletions

View File

@@ -112,7 +112,7 @@ static void ExitFailure(std::string_view str_err)
exit(EXIT_FAILURE);
}
BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vector<const char*>& extra_args)
BasicTestingSetup::BasicTestingSetup(const ChainType chainType, TestOpts opts)
: m_args{}
{
m_node.shutdown = &m_interrupt;
@@ -129,7 +129,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vecto
"-debugexclude=libevent",
"-debugexclude=leveldb",
},
extra_args);
opts.extra_args);
if (G_TEST_COMMAND_LINE_ARGUMENTS) {
arguments = Cat(arguments, G_TEST_COMMAND_LINE_ARGUMENTS());
}
@@ -220,8 +220,8 @@ BasicTestingSetup::~BasicTestingSetup()
gArgs.ClearArgs();
}
ChainTestingSetup::ChainTestingSetup(const ChainType chainType, const std::vector<const char*>& extra_args)
: BasicTestingSetup(chainType, extra_args)
ChainTestingSetup::ChainTestingSetup(const ChainType chainType, TestOpts opts)
: BasicTestingSetup(chainType, opts)
{
const CChainParams& chainparams = Params();
@@ -304,13 +304,11 @@ void ChainTestingSetup::LoadVerifyActivateChainstate()
TestingSetup::TestingSetup(
const ChainType chainType,
const std::vector<const char*>& extra_args,
const bool coins_db_in_memory,
const bool block_tree_db_in_memory)
: ChainTestingSetup(chainType, extra_args)
TestOpts opts)
: ChainTestingSetup(chainType, opts)
{
m_coins_db_in_memory = coins_db_in_memory;
m_block_tree_db_in_memory = block_tree_db_in_memory;
m_coins_db_in_memory = opts.coins_db_in_memory;
m_block_tree_db_in_memory = opts.block_tree_db_in_memory;
// Ideally we'd move all the RPC tests to the functional testing framework
// instead of unit tests, but for now we need these here.
RegisterAllCoreRPCCommands(tableRPC);
@@ -339,11 +337,9 @@ TestingSetup::TestingSetup(
}
TestChain100Setup::TestChain100Setup(
const ChainType chain_type,
const std::vector<const char*>& extra_args,
const bool coins_db_in_memory,
const bool block_tree_db_in_memory)
: TestingSetup{ChainType::REGTEST, extra_args, coins_db_in_memory, block_tree_db_in_memory}
const ChainType chain_type,
TestOpts opts)
: TestingSetup{ChainType::REGTEST, opts}
{
SetMockTime(1598887952);
constexpr std::array<unsigned char, 32> vchKey = {