diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-09-06 19:18:47 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-09-06 19:19:01 +0200 |
commit | 5368614aa106b96e02ffb9e68eb86ebe197bc07f (patch) | |
tree | 8a35a47b975ef374372d9f993af1b3fa6c8e6b2d /src/qt | |
parent | 815fe62421cb29472c7f052a42197a8a5fda9cc9 (diff) | |
parent | dea086f498097d19a2c9acbfc753c9c2d68dbb03 (diff) |
Merge #11210: Stop test_bitcoin-qt touching ~/.bitcoin
dea086f49 Stop test_bitcoin-qt touching ~/.bitcoin (MeshCollider)
Pull request description:
Fixes https://github.com/bitcoin/bitcoin/issues/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
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/test/rpcnestedtests.cpp | 7 | ||||
-rw-r--r-- | src/qt/test/test_main.cpp | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 00edd64f72..70fdd4bf58 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -36,11 +36,6 @@ void RPCNestedTests::rpcNestedTests() // do some test setup // could be moved to a more generic place when we add more tests on QT level tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]); - ClearDatadirCache(); - std::string path = QDir::tempPath().toStdString() + "/" + strprintf("test_bitcoin_qt_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); - QDir dir(QString::fromStdString(path)); - dir.mkpath("."); - gArgs.ForceSetArg("-datadir", path); //mempool.setSanityCheck(1.0); TestingSetup test; @@ -135,6 +130,4 @@ void RPCNestedTests::rpcNestedTests() QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,abc)"), std::runtime_error); //don't tollerate empty arguments when using , QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(result, "rpcNestedTest(abc,,)"), std::runtime_error); //don't tollerate empty arguments when using , #endif - - fs::remove_all(fs::path(path)); } diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 80a00a634a..4c04e67ccc 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -53,6 +53,10 @@ int main(int argc, char *argv[]) SetupNetworking(); SelectParams(CBaseChainParams::MAIN); noui_connect(); + ClearDatadirCache(); + fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000)); + fs::create_directories(pathTemp); + gArgs.ForceSetArg("-datadir", pathTemp.string()); bool fInvalid = false; @@ -97,5 +101,7 @@ int main(int argc, char *argv[]) } #endif + fs::remove_all(pathTemp); + return fInvalid; } |