aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/setup_common.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-04-08 20:02:20 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-04-15 15:13:04 -0400
commitfa0cbd48c418ec14e1d91bffea206bce20bd1e56 (patch)
tree6548d94091886ab42a1a9a3c1a2c7e500394a99d /src/test/util/setup_common.cpp
parentfad4fa7e2fb95b7ced9007060ebfd0e8f181f5d8 (diff)
test: Add optional extra_args to testing setup
Diffstat (limited to 'src/test/util/setup_common.cpp')
-rw-r--r--src/test/util/setup_common.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index b49e2a56d0..0d455d48b3 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