Skip to content

Commit fa6c186

Browse files
author
MarcoFalke
committed
gui tests: Limit life-time of dummy testing setup
Its only purpose is to create a directory. So instead of keeping it alive, use it only to get the path of the directory and then create it explicitly.
1 parent fa28a61 commit fa6c186

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/qt/test/apptests.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ void AppTests::appTests()
6262
}
6363
#endif
6464

65-
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
66-
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
67-
LogInstance().DisconnectTestLogger();
65+
fs::create_directories([] {
66+
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
67+
return GetDataDir() / "blocks";
68+
}());
6869

6970
m_app.parameterSetup();
7071
m_app.createOptionsModel(true /* reset settings */);
@@ -80,6 +81,7 @@ void AppTests::appTests()
8081
m_app.exec();
8182

8283
// Reset global state to avoid interfering with later tests.
84+
LogInstance().DisconnectTestLogger();
8385
AbortShutdown();
8486
UnloadBlockIndex();
8587
WITH_LOCK(::cs_main, g_chainman.Reset());

0 commit comments

Comments
 (0)