diff options
author | merge-script <fanquake@gmail.com> | 2024-07-15 17:21:55 +0100 |
---|---|---|
committer | merge-script <fanquake@gmail.com> | 2024-07-15 17:21:55 +0100 |
commit | ff827a8f46e504712285c145e13e72e1b19eb169 (patch) | |
tree | 6422a69ba7e162c7dce004cc3584d51ee9cd2eff /src/bench | |
parent | 262260ce1e919613ba60194a5861b0b0a51dfe01 (diff) | |
parent | fa690c8e532672f7ab53be6f7a0bb3070858745e (diff) |
Merge bitcoin/bitcoin#30407: test: [refactor] Pass TestOpts
fa690c8e532672f7ab53be6f7a0bb3070858745e test: [refactor] Pass TestOpts (MarcoFalke)
Pull request description:
Currently optional test context setup settings are passed by adding a new optional argument to the constructors. For example `extra_args`. This is problematic, because:
* Adding more optional settings in the future requires touching all affected constructors, increasing their verbosity.
* Setting only a later option requires setting the earlier ones.
* Clang-tidy named args passed to `std::make_unique` are not checked.
Fix all issues by adding a new struct `TestOpts`, which holds all options. Notes:
* The chain type is not an option in the struct for now, because the default values vary.
* The struct holds all possible test options globally. Not all fields may be used by all constructors. Albeit harmless, it is up to the test author to not set a field that is unused.
ACKs for top commit:
kevkevinpal:
utACK [fa690c8](https://github.com/bitcoin/bitcoin/pull/30407/commits/fa690c8e532672f7ab53be6f7a0bb3070858745e)
dergoegge:
utACK fa690c8e532672f7ab53be6f7a0bb3070858745e
TheCharlatan:
Nice, ACK fa690c8e532672f7ab53be6f7a0bb3070858745e
Tree-SHA512: 8db8efa5dff854a73757d3f454f8f902e41bb4358f5f9bae29dbb3e251e20ee93489605de51d0822ba31d97835cd15526a29c075278dd6a8bbde26134feb4f49
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/logging.cpp | 2 | ||||
-rw-r--r-- | src/bench/mempool_stress.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bench/logging.cpp b/src/bench/logging.cpp index c97c4e151b..8a745a0ba7 100644 --- a/src/bench/logging.cpp +++ b/src/bench/logging.cpp @@ -20,7 +20,7 @@ static void Logging(benchmark::Bench& bench, const std::vector<const char*>& ext TestingSetup test_setup{ ChainType::REGTEST, - extra_args, + {.extra_args = extra_args}, }; bench.run([&] { log(); }); diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp index fe3e204fb3..3c82f55c19 100644 --- a/src/bench/mempool_stress.cpp +++ b/src/bench/mempool_stress.cpp @@ -106,7 +106,7 @@ static void ComplexMemPool(benchmark::Bench& bench) static void MempoolCheck(benchmark::Bench& bench) { FastRandomContext det_rand{true}; - auto testing_setup = MakeNoLogFileContext<TestChain100Setup>(ChainType::REGTEST, {"-checkmempool=1"}); + auto testing_setup = MakeNoLogFileContext<TestChain100Setup>(ChainType::REGTEST, {.extra_args = {"-checkmempool=1"}}); CTxMemPool& pool = *testing_setup.get()->m_node.mempool; LOCK2(cs_main, pool.cs); testing_setup->PopulateMempool(det_rand, 400, true); |