Skip to content

Commit 5368614

Browse files
committed
Merge #11210: Stop test_bitcoin-qt touching ~/.bitcoin
dea086f Stop test_bitcoin-qt touching ~/.bitcoin (MeshCollider) Pull request description: Fixes bitcoin/bitcoin#11192 The directory remains unused, but this stops the tests touching ~/.bitcoin at all (namely creating it if it doesn't exist) Tree-SHA512: e59ad6b83dbc5ea2fb2761994c09933721d29668b0eef09b9d938a4ee1c67871c5125c57483ee0ea25f2385e308d275d86bcb9087dd4d502923013b4f3dbac82
2 parents 815fe62 + dea086f commit 5368614

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/qt/test/rpcnestedtests.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ void RPCNestedTests::rpcNestedTests()
3636
// do some test setup
3737
// could be moved to a more generic place when we add more tests on QT level
3838
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
39-
ClearDatadirCache();
40-
std::string path = QDir::tempPath().toStdString() + "/" + strprintf("test_bitcoin_qt_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
41-
QDir dir(QString::fromStdString(path));
42-
dir.mkpath(".");
43-
gArgs.ForceSetArg("-datadir", path);
4439
//mempool.setSanityCheck(1.0);
4540

4641
TestingSetup test;
@@ -135,6 +130,4 @@ void RPCNestedTests::rpcNestedTests()
135130
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using ,
136131
QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using ,
137132
#endif
138-
139-
fs::remove_all(fs::path(path));
140133
}

src/qt/test/test_main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ int main(int argc, char *argv[])
5353
SetupNetworking();
5454
SelectParams(CBaseChainParams::MAIN);
5555
noui_connect();
56+
ClearDatadirCache();
57+
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
58+
fs::create_directories(pathTemp);
59+
gArgs.ForceSetArg("-datadir", pathTemp.string());
5660

5761
bool fInvalid = false;
5862

@@ -97,5 +101,7 @@ int main(int argc, char *argv[])
97101
}
98102
#endif
99103

104+
fs::remove_all(pathTemp);
105+
100106
return fInvalid;
101107
}

0 commit comments

Comments
 (0)