1 // Copyright (c) 2009-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #if defined(HAVE_CONFIG_H)
6 #include "config/bitcoin-config.h"
9 #include "chainparams.h"
10 #include "rpcnestedtests.h"
13 #include "compattests.h"
16 #include "paymentservertests.h"
17 #include "wallettests.h"
20 #include <QApplication>
24 #include <openssl/ssl.h>
26 #if defined(QT_STATICPLUGIN)
28 #if QT_VERSION < 0x050000
29 Q_IMPORT_PLUGIN(qcncodecs
)
30 Q_IMPORT_PLUGIN(qjpcodecs
)
31 Q_IMPORT_PLUGIN(qtwcodecs
)
32 Q_IMPORT_PLUGIN(qkrcodecs
)
34 #if defined(QT_QPA_PLATFORM_MINIMAL)
35 Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin
);
37 #if defined(QT_QPA_PLATFORM_XCB)
38 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin
);
39 #elif defined(QT_QPA_PLATFORM_WINDOWS)
40 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin
);
41 #elif defined(QT_QPA_PLATFORM_COCOA)
42 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin
);
47 extern void noui_connect();
49 // This is all you need to run all the tests
50 int main(int argc
, char *argv
[])
54 SelectParams(CBaseChainParams::MAIN
);
57 fs::path pathTemp
= fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
58 fs::create_directories(pathTemp
);
59 gArgs
.ForceSetArg("-datadir", pathTemp
.string());
61 bool fInvalid
= false;
63 // Prefer the "minimal" platform for the test instead of the normal default
64 // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
65 // interfere with any background GUIs and don't require extra resources.
67 _putenv_s("QT_QPA_PLATFORM", "minimal");
69 setenv("QT_QPA_PLATFORM", "minimal", 0);
72 // Don't remove this, it's needed to access
73 // QApplication:: and QCoreApplication:: in the tests
74 QApplication
app(argc
, argv
);
75 app
.setApplicationName("Bitcoin-Qt-test");
80 if (QTest::qExec(&test1
) != 0) {
84 PaymentServerTests test2
;
85 if (QTest::qExec(&test2
) != 0) {
90 if (QTest::qExec(&test3
) != 0) {
94 if (QTest::qExec(&test4
) != 0) {
99 if (QTest::qExec(&test5
) != 0) {
104 fs::remove_all(pathTemp
);