diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-01-25 12:22:03 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-03-03 09:17:37 +0100 |
commit | fa576b4532814b4bca1936d170cabd01fbc51960 (patch) | |
tree | 406f945a0fa46f6750f6a563e311c88932673f97 /src/test/util | |
parent | cfce346508f1f7513a0cfa2cea7d7f8336d01c6b (diff) | |
download | bitcoin-fa576b4532814b4bca1936d170cabd01fbc51960.tar.xz |
Move MakeNoLogFileContext to common libtest_util, and use it in bench
Can be reviewed with --color-moved=dimmed-zebra
Diffstat (limited to 'src/test/util')
-rw-r--r-- | src/test/util/setup_common.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 33f24e7c44..7323f1f0b6 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -15,6 +15,7 @@ #include <txmempool.h> #include <util/check.h> #include <util/string.h> +#include <util/vector.h> #include <type_traits> #include <vector> @@ -152,6 +153,23 @@ struct TestChain100DeterministicSetup : public TestChain100Setup { TestChain100DeterministicSetup() : TestChain100Setup(true) { } }; +/** + * Make a test setup that has disk access to the debug.log file disabled. Can + * be used in "hot loops", for example fuzzing or benchmarking. + */ +template <class T = const BasicTestingSetup> +std::unique_ptr<T> MakeNoLogFileContext(const std::string& chain_name = CBaseChainParams::REGTEST, const std::vector<const char*>& extra_args = {}) +{ + const std::vector<const char*> arguments = Cat( + { + "-nodebuglogfile", + "-nodebug", + }, + extra_args); + + return std::make_unique<T>(chain_name, arguments); +} + class CTxMemPoolEntry; struct TestMemPoolEntryHelper |