diff options
author | Kiminuo <kiminuo@protonmail.com> | 2021-04-18 11:37:06 +0200 |
---|---|---|
committer | Kiminuo <kiminuo@protonmail.com> | 2021-04-18 11:59:28 +0200 |
commit | 511ce3a26b3b78e14acd0d85496b5422a236cf63 (patch) | |
tree | b9feb74ddb13d4b9672fb145f3987bfb0a0b7752 /src/test/util/setup_common.cpp | |
parent | 1cb52ba0656e78ca6c2ef84b1558198ad113b76a (diff) | |
download | bitcoin-511ce3a26b3b78e14acd0d85496b5422a236cf63.tar.xz |
BasicTestingSetup: Add ArgsManager.
Diffstat (limited to 'src/test/util/setup_common.cpp')
-rw-r--r-- | src/test/util/setup_common.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 2e7f64a444..831083ccb8 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -71,7 +71,8 @@ std::ostream& operator<<(std::ostream& os, const uint256& num) } 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()} + : m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / g_insecure_rand_ctx_temp_path.rand256().ToString()}, + m_args{} { const std::vector<const char*> arguments = Cat( { @@ -87,6 +88,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve extra_args); util::ThreadRename("test"); fs::create_directories(m_path_root); + m_args.ForceSetArg("-datadir", m_path_root.string()); gArgs.ForceSetArg("-datadir", m_path_root.string()); ClearDatadirCache(); { @@ -191,7 +193,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const } m_node.addrman = std::make_unique<CAddrMan>(); - m_node.banman = std::make_unique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME); + m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirPath() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME); m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests. m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman, m_node.banman.get(), *m_node.scheduler, *m_node.chainman, |