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