Skip to content

Commit fa4a04a

Browse files
author
MarcoFalke
committed
test: use common setup in gui tests
1 parent fad3d2a commit fa4a04a

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/qt/test/apptests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <qt/test/apptests.h>
66

77
#include <chainparams.h>
8+
#include <key.h>
89
#include <qt/bitcoin.h>
910
#include <qt/bitcoingui.h>
1011
#include <qt/networkstyle.h>
@@ -62,6 +63,7 @@ void AppTests::appTests()
6263
}
6364
#endif
6465

66+
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
6567
m_app.parameterSetup();
6668
m_app.createOptionsModel(true /* reset settings */);
6769
QScopedPointer<const NetworkStyle> style(

src/qt/test/test_main.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include <qt/bitcoin.h>
1212
#include <qt/test/apptests.h>
1313
#include <qt/test/rpcnestedtests.h>
14-
#include <util/system.h>
1514
#include <qt/test/uritests.h>
1615
#include <qt/test/compattests.h>
16+
#include <test/setup_common.h>
1717

1818
#ifdef ENABLE_WALLET
1919
#include <qt/test/addressbooktests.h>
@@ -48,14 +48,8 @@ extern void noui_connect();
4848
// This is all you need to run all the tests
4949
int main(int argc, char *argv[])
5050
{
51-
SetupEnvironment();
52-
SetupNetworking();
53-
SelectParams(CBaseChainParams::REGTEST);
54-
noui_connect();
55-
ClearDatadirCache();
56-
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
57-
fs::create_directories(pathTemp);
58-
gArgs.ForceSetArg("-datadir", pathTemp.string());
51+
BasicTestingSetup test{CBaseChainParams::REGTEST};
52+
5953
auto node = interfaces::MakeNode();
6054

6155
bool fInvalid = false;
@@ -109,7 +103,5 @@ int main(int argc, char *argv[])
109103
}
110104
#endif
111105

112-
fs::remove_all(pathTemp);
113-
114106
return fInvalid;
115107
}

0 commit comments

Comments
 (0)