diff options
Diffstat (limited to 'src/qt/test/test_main.cpp')
-rw-r--r-- | src/qt/test/test_main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 1b28a285f1..4c04e67ccc 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -53,11 +53,15 @@ 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; // Prefer the "minimal" platform for the test instead of the normal default - // platform ("xcb", "windows", or "cocoa") so tests can't unintentially + // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally // interfere with any background GUIs and don't require extra resources. #if defined(WIN32) _putenv_s("QT_QPA_PLATFORM", "minimal"); @@ -97,5 +101,7 @@ int main(int argc, char *argv[]) } #endif + fs::remove_all(pathTemp); + return fInvalid; } |