mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
test: Create data dir in BasicTestingSetup
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user