Skip to content
Permalink
Browse files

Stop test_bitcoin-qt touching ~/.bitcoin

Github-Pull: #11210
Rebased-From: dea086f
  • Loading branch information...
meshcollider authored and MarcoFalke committed Aug 30, 2017
1 parent f0b6795 commit f3f78917769b9bc65c133a160dba7df18a33b27d
Showing with 6 additions and 7 deletions.
  1. +0 −7 src/qt/test/rpcnestedtests.cpp
  2. +6 −0 src/qt/test/test_main.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));
}
@@ -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;
}

0 comments on commit f3f7891

Please sign in to comment.
You can’t perform that action at this time.