diff options
| author | MarcoFalke <[email protected]> | 2020-04-15 17:39:32 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-04-15 17:41:56 -0400 |
| commit | 544709763e1f45148d1926831e07ff03487673ee (patch) | |
| tree | fab6ea4898f8670ab6e7cf415976ae5f67f13514 /src/test/util/setup_common.cpp | |
| parent | Merge #18645: [doc] Update thread information in developer docs (diff) | |
| parent | fuzz: Disable debug log file (diff) | |
| download | discoin-544709763e1f45148d1926831e07ff03487673ee.tar.xz discoin-544709763e1f45148d1926831e07ff03487673ee.zip | |
Merge #18571: fuzz: Disable debug log file
fa69f88486e900aacf3fc768671f947927173226 fuzz: Disable debug log file (MarcoFalke)
fa0cbd48c418ec14e1d91bffea206bce20bd1e56 test: Add optional extra_args to testing setup (MarcoFalke)
fad4fa7e2fb95b7ced9007060ebfd0e8f181f5d8 node: Add args alias for gArgs global (MarcoFalke)
Pull request description:
There are several issues with writing to a debug log file when fuzzing:
* Disk access is slow, but fuzzing should be fast (Note: I could not verify this claim with data)
* Disks have a limited size and will eventually run out of space, but fuzzing should run continuous
Fix both issues by disabling the debug log file for fuzz tests
ACKs for top commit:
practicalswift:
ACK fa69f88486e900aacf3fc768671f947927173226 -- patch looks correct
Tree-SHA512: f61beb6c94a9ab664deb191685fcad601e228b77bb1c43db6ec40616ae393c9dd35c51474f1b0759ac0bc29b5ca8456a329906a3695bd0f18fa4372210c8b54a
Diffstat (limited to 'src/test/util/setup_common.cpp')
| -rw-r--r-- | src/test/util/setup_common.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 32d50e49b..0d455d48b 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -28,6 +28,7 @@ #include <util/time.h> #include <util/translation.h> #include <util/url.h> +#include <util/vector.h> #include <validation.h> #include <validationinterface.h> @@ -65,17 +66,34 @@ std::ostream& operator<<(std::ostream& os, const uint256& num) return os; } -BasicTestingSetup::BasicTestingSetup(const std::string& chainName) +BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args) : m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / g_insecure_rand_ctx_temp_path.rand256().ToString()} { + const std::vector<const char*> arguments = Cat( + { + "dummy", + "-printtoconsole=0", + "-logtimemicros", + "-debug", + "-debugexclude=libevent", + "-debugexclude=leveldb", + }, + extra_args); fs::create_directories(m_path_root); gArgs.ForceSetArg("-datadir", m_path_root.string()); ClearDatadirCache(); + { + SetupServerArgs(m_node); + std::string error; + const bool success{m_node.args->ParseParameters(arguments.size(), arguments.data(), error)}; + assert(success); + assert(error.empty()); + } SelectParams(chainName); SeedInsecureRand(); - gArgs.ForceSetArg("-printtoconsole", "0"); if (G_TEST_LOG_FUN) LogInstance().PushBackCallback(G_TEST_LOG_FUN); InitLogging(); + AppInitParameterInteraction(); LogInstance().StartLogging(); SHA256AutoDetect(); ECC_Start(); @@ -95,10 +113,12 @@ BasicTestingSetup::~BasicTestingSetup() { LogInstance().DisconnectTestLogger(); fs::remove_all(m_path_root); + gArgs.ClearArgs(); ECC_Stop(); } -TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName) +TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args) + : BasicTestingSetup(chainName, extra_args) { const CChainParams& chainparams = Params(); // Ideally we'd move all the RPC tests to the functional testing framework @@ -159,6 +179,7 @@ TestingSetup::~TestingSetup() g_rpc_node = nullptr; m_node.connman.reset(); m_node.banman.reset(); + m_node.args = nullptr; m_node.mempool = nullptr; m_node.scheduler.reset(); UnloadBlockIndex(); |