28
28
#include < util/time.h>
29
29
#include < util/translation.h>
30
30
#include < util/url.h>
31
+ #include < util/vector.h>
31
32
#include < validation.h>
32
33
#include < validationinterface.h>
33
34
@@ -65,17 +66,34 @@ std::ostream& operator<<(std::ostream& os, const uint256& num)
65
66
return os;
66
67
}
67
68
68
- BasicTestingSetup::BasicTestingSetup (const std::string& chainName)
69
+ BasicTestingSetup::BasicTestingSetup (const std::string& chainName, const std::vector< const char *>& extra_args )
69
70
: m_path_root{fs::temp_directory_path () / " test_common_" PACKAGE_NAME / g_insecure_rand_ctx_temp_path.rand256 ().ToString ()}
70
71
{
72
+ const std::vector<const char *> arguments = Cat (
73
+ {
74
+ " dummy" ,
75
+ " -printtoconsole=0" ,
76
+ " -logtimemicros" ,
77
+ " -debug" ,
78
+ " -debugexclude=libevent" ,
79
+ " -debugexclude=leveldb" ,
80
+ },
81
+ extra_args);
71
82
fs::create_directories (m_path_root);
72
83
gArgs .ForceSetArg (" -datadir" , m_path_root.string ());
73
84
ClearDatadirCache ();
85
+ {
86
+ SetupServerArgs (m_node);
87
+ std::string error;
88
+ const bool success{m_node.args ->ParseParameters (arguments.size (), arguments.data (), error)};
89
+ assert (success);
90
+ assert (error.empty ());
91
+ }
74
92
SelectParams (chainName);
75
93
SeedInsecureRand ();
76
- gArgs .ForceSetArg (" -printtoconsole" , " 0" );
77
94
if (G_TEST_LOG_FUN) LogInstance ().PushBackCallback (G_TEST_LOG_FUN);
78
95
InitLogging ();
96
+ AppInitParameterInteraction ();
79
97
LogInstance ().StartLogging ();
80
98
SHA256AutoDetect ();
81
99
ECC_Start ();
@@ -95,10 +113,12 @@ BasicTestingSetup::~BasicTestingSetup()
95
113
{
96
114
LogInstance ().DisconnectTestLogger ();
97
115
fs::remove_all (m_path_root);
116
+ gArgs .ClearArgs ();
98
117
ECC_Stop ();
99
118
}
100
119
101
- TestingSetup::TestingSetup (const std::string& chainName) : BasicTestingSetup(chainName)
120
+ TestingSetup::TestingSetup (const std::string& chainName, const std::vector<const char *>& extra_args)
121
+ : BasicTestingSetup(chainName, extra_args)
102
122
{
103
123
const CChainParams& chainparams = Params ();
104
124
// Ideally we'd move all the RPC tests to the functional testing framework
0 commit comments