aboutsummaryrefslogtreecommitdiff
path: root/src/test/setup_common.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-06-19 17:52:35 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-06-20 09:31:02 -0400
commitfad3d2a624377de4b0311e6ddd446c36dafd1ddc (patch)
tree6663ba6afdd3b667880fdc5aee0b410c20f85d89 /src/test/setup_common.cpp
parentb1344eac5fcccd1847438ca203ce625f30d1151d (diff)
test: Create data dir in BasicTestingSetup
Diffstat (limited to 'src/test/setup_common.cpp')
-rw-r--r--src/test/setup_common.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/test/setup_common.cpp b/src/test/setup_common.cpp
index b11d090f67..fe98a1ceac 100644
--- a/src/test/setup_common.cpp
+++ b/src/test/setup_common.cpp
@@ -34,6 +34,9 @@ std::ostream& operator<<(std::ostream& os, const uint256& num)
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
: m_path_root(fs::temp_directory_path() / "test_common_" PACKAGE_NAME / strprintf("%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(1 << 30))))
{
+ fs::create_directories(m_path_root);
+ gArgs.ForceSetArg("-datadir", m_path_root.string());
+ ClearDatadirCache();
SHA256AutoDetect();
ECC_Start();
SetupEnvironment();
@@ -55,23 +58,13 @@ BasicTestingSetup::~BasicTestingSetup()
ECC_Stop();
}
-fs::path BasicTestingSetup::SetDataDir(const std::string& name)
-{
- fs::path ret = m_path_root / name;
- fs::create_directories(ret);
- gArgs.ForceSetArg("-datadir", ret.string());
- return ret;
-}
-
TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
{
- SetDataDir("tempdir");
const CChainParams& chainparams = Params();
// Ideally we'd move all the RPC tests to the functional testing framework
// instead of unit tests, but for now we need these here.
RegisterAllCoreRPCCommands(tableRPC);
- ClearDatadirCache();
// We have to run a scheduler thread to prevent ActivateBestChain
// from blocking due to queue overrun.