2016-08-20 11:19:35 +02:00
|
|
|
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
2014-09-05 13:11:11 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2013-12-11 15:00:56 +01:00
|
|
|
#if defined(HAVE_CONFIG_H)
|
2014-06-23 20:04:24 +02:00
|
|
|
#include "config/bitcoin-config.h"
|
2013-12-11 15:00:56 +01:00
|
|
|
#endif
|
|
|
|
|
2016-08-20 11:19:35 +02:00
|
|
|
#include "chainparams.h"
|
|
|
|
#include "rpcnestedtests.h"
|
2015-03-27 01:33:34 +01:00
|
|
|
#include "util.h"
|
2014-09-05 13:11:11 +02:00
|
|
|
#include "uritests.h"
|
2016-12-16 08:52:35 +01:00
|
|
|
#include "compattests.h"
|
2014-09-05 13:11:11 +02:00
|
|
|
|
2013-12-11 15:00:56 +01:00
|
|
|
#ifdef ENABLE_WALLET
|
2013-07-22 08:50:39 +02:00
|
|
|
#include "paymentservertests.h"
|
2017-03-10 21:58:53 +01:00
|
|
|
#include "wallettests.h"
|
2013-12-11 15:00:56 +01:00
|
|
|
#endif
|
2013-04-13 07:13:08 +02:00
|
|
|
|
2017-03-10 21:58:53 +01:00
|
|
|
#include <QApplication>
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <QObject>
|
|
|
|
#include <QTest>
|
2013-07-22 08:50:39 +02:00
|
|
|
|
2015-01-20 13:35:13 +01:00
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
2017-03-15 01:45:00 +01:00
|
|
|
#if defined(QT_STATICPLUGIN)
|
2013-12-18 21:46:48 +01:00
|
|
|
#include <QtPlugin>
|
2017-03-15 01:45:00 +01:00
|
|
|
#if QT_VERSION < 0x050000
|
2013-12-18 21:46:48 +01:00
|
|
|
Q_IMPORT_PLUGIN(qcncodecs)
|
|
|
|
Q_IMPORT_PLUGIN(qjpcodecs)
|
|
|
|
Q_IMPORT_PLUGIN(qtwcodecs)
|
|
|
|
Q_IMPORT_PLUGIN(qkrcodecs)
|
2017-03-15 01:45:00 +01:00
|
|
|
#else
|
2017-04-03 17:07:40 +02:00
|
|
|
#if defined(QT_QPA_PLATFORM_MINIMAL)
|
|
|
|
Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
|
|
|
|
#endif
|
2017-03-15 01:45:00 +01:00
|
|
|
#if defined(QT_QPA_PLATFORM_XCB)
|
|
|
|
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
|
|
|
|
#elif defined(QT_QPA_PLATFORM_WINDOWS)
|
|
|
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
|
|
|
#elif defined(QT_QPA_PLATFORM_COCOA)
|
|
|
|
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-12-18 21:46:48 +01:00
|
|
|
#endif
|
|
|
|
|
2016-08-20 11:19:35 +02:00
|
|
|
extern void noui_connect();
|
|
|
|
|
2013-07-22 08:50:39 +02:00
|
|
|
// This is all you need to run all the tests
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2015-03-27 01:33:34 +01:00
|
|
|
SetupEnvironment();
|
2016-08-20 11:19:35 +02:00
|
|
|
SetupNetworking();
|
|
|
|
SelectParams(CBaseChainParams::MAIN);
|
|
|
|
noui_connect();
|
|
|
|
|
2013-07-22 08:50:39 +02:00
|
|
|
bool fInvalid = false;
|
|
|
|
|
2017-04-03 17:07:40 +02:00
|
|
|
// Prefer the "minimal" platform for the test instead of the normal default
|
|
|
|
// platform ("xcb", "windows", or "cocoa") so tests can't unintentially
|
|
|
|
// interfere with any background GUIs and don't require extra resources.
|
|
|
|
setenv("QT_QPA_PLATFORM", "minimal", 0);
|
|
|
|
|
2013-11-14 19:21:16 +01:00
|
|
|
// Don't remove this, it's needed to access
|
2017-03-10 21:58:53 +01:00
|
|
|
// QApplication:: and QCoreApplication:: in the tests
|
|
|
|
QApplication app(argc, argv);
|
2013-11-14 19:21:16 +01:00
|
|
|
app.setApplicationName("Bitcoin-Qt-test");
|
|
|
|
|
2015-01-20 13:35:13 +01:00
|
|
|
SSL_library_init();
|
|
|
|
|
2013-07-22 08:50:39 +02:00
|
|
|
URITests test1;
|
2017-03-15 18:02:02 +01:00
|
|
|
if (QTest::qExec(&test1) != 0) {
|
2013-07-22 08:50:39 +02:00
|
|
|
fInvalid = true;
|
2017-03-15 18:02:02 +01:00
|
|
|
}
|
2013-12-11 15:00:56 +01:00
|
|
|
#ifdef ENABLE_WALLET
|
2013-07-22 08:50:39 +02:00
|
|
|
PaymentServerTests test2;
|
2017-03-15 18:02:02 +01:00
|
|
|
if (QTest::qExec(&test2) != 0) {
|
2013-07-22 08:50:39 +02:00
|
|
|
fInvalid = true;
|
2017-03-15 18:02:02 +01:00
|
|
|
}
|
2013-12-11 15:00:56 +01:00
|
|
|
#endif
|
2016-08-20 11:19:35 +02:00
|
|
|
RPCNestedTests test3;
|
2017-03-15 18:02:02 +01:00
|
|
|
if (QTest::qExec(&test3) != 0) {
|
2016-08-20 11:19:35 +02:00
|
|
|
fInvalid = true;
|
2017-03-15 18:02:02 +01:00
|
|
|
}
|
2016-12-16 08:52:35 +01:00
|
|
|
CompatTests test4;
|
2017-03-15 18:02:02 +01:00
|
|
|
if (QTest::qExec(&test4) != 0) {
|
2016-12-16 08:52:35 +01:00
|
|
|
fInvalid = true;
|
2017-03-15 18:02:02 +01:00
|
|
|
}
|
2017-03-10 21:58:53 +01:00
|
|
|
#ifdef ENABLE_WALLET
|
|
|
|
WalletTests test5;
|
|
|
|
if (QTest::qExec(&test5) != 0) {
|
|
|
|
fInvalid = true;
|
|
|
|
}
|
|
|
|
#endif
|
2013-07-22 08:50:39 +02:00
|
|
|
|
|
|
|
return fInvalid;
|
|
|
|
}
|