diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index a30a2d0c14..bb9751fe03 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -53,6 +53,7 @@ class tst_QIODevice : public QObject Q_OBJECT private slots: + void initTestCase(); void getSetCheck(); void constructing_QTcpSocket(); void constructing_QFile(); @@ -70,6 +71,11 @@ private slots: void peekBug(); }; +void tst_QIODevice::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + // Testing get/set functions void tst_QIODevice::getSetCheck() { diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index a2e8006951..c8bc826608 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -76,6 +76,7 @@ class tst_QTextStream : public QObject Q_OBJECT public slots: + void initTestCase(); void cleanup(); private slots: @@ -243,6 +244,11 @@ private: void generateRealNumbersDataWrite(); }; +void tst_QTextStream::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + // Testing get/set functions void tst_QTextStream::getSetCheck() { diff --git a/tests/auto/integrationtests/networkselftest/tst_networkselftest.cpp b/tests/auto/integrationtests/networkselftest/tst_networkselftest.cpp index 1cf2060809..c768a29bf8 100644 --- a/tests/auto/integrationtests/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/integrationtests/networkselftest/tst_networkselftest.cpp @@ -363,6 +363,7 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress() void tst_NetworkSelfTest::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/integrationtests/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/integrationtests/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp index abf5aa528c..63506fed1d 100644 --- a/tests/auto/integrationtests/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp +++ b/tests/auto/integrationtests/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -58,6 +58,7 @@ class tst_QNetworkAccessManager_And_QProgressDialog : public QObject public: tst_QNetworkAccessManager_And_QProgressDialog(); private slots: + void initTestCase(); void downloadCheck(); void downloadCheck_data(); }; @@ -125,6 +126,11 @@ tst_QNetworkAccessManager_And_QProgressDialog::tst_QNetworkAccessManager_And_QPr { } +void tst_QNetworkAccessManager_And_QProgressDialog::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck_data() { QTest::addColumn("useZeroCopy"); diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 77bcfe0157..5cf32d32b1 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -143,20 +143,18 @@ public: return false; } -}; #ifdef QT_NETWORK_LIB -class QtNetworkSettingsInitializerCode { -public: - QtNetworkSettingsInitializerCode() { + static bool verifyTestNetworkSettings() + { QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName()); if (testServerResult.error() != QHostInfo::NoError) { qWarning() << "Could not lookup" << QtNetworkSettings::serverName(); qWarning() << "Please configure the test environment!"; qWarning() << "See /etc/hosts or network-settings.h"; - qFatal("Exiting"); + return false; } + return true; } -}; -QtNetworkSettingsInitializerCode qtNetworkSettingsInitializer; #endif +}; diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 614096df15..59a9c559c0 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -137,6 +137,7 @@ Q_DECLARE_METATYPE(QNetworkRequest::CacheLoadControl) void tst_QAbstractNetworkCache::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 87a4dbfc02..6caa98b702 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -216,6 +216,7 @@ void tst_QFtp::initTestCase_data() void tst_QFtp::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT QNetworkConfigurationManager manager; networkSessionImplicit = QSharedPointer(new QNetworkSession(manager.defaultConfiguration())); diff --git a/tests/auto/network/access/qhttp/tst_qhttp.cpp b/tests/auto/network/access/qhttp/tst_qhttp.cpp index 7150400c4f..7ef061413d 100644 --- a/tests/auto/network/access/qhttp/tst_qhttp.cpp +++ b/tests/auto/network/access/qhttp/tst_qhttp.cpp @@ -209,6 +209,7 @@ void tst_QHttp::initTestCase_data() void tst_QHttp::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); } void tst_QHttp::cleanupTestCase() diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index bbc1d21068..b4c0e2c93a 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -122,6 +122,7 @@ tst_QHttpNetworkConnection::tst_QHttpNetworkConnection() void tst_QHttpNetworkConnection::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); } void tst_QHttpNetworkConnection::cleanupTestCase() diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 6d7cce505d..d3b92ea9b1 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1275,6 +1275,7 @@ void tst_QNetworkReply::gotError() void tst_QNetworkReply::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #if !defined Q_OS_WIN wronlyFileName = QDir::currentPath() + "/write-only"; QFile wr(wronlyFileName); diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index fbf414483b..217a46a81d 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -194,6 +194,7 @@ tst_QHostInfo::~tst_QHostInfo() void tst_QHostInfo::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT //start the default network netConfMan = new QNetworkConfigurationManager(this); diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index 7a2f0e578e..06dd62e18a 100644 --- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -87,6 +87,7 @@ tst_QNetworkInterface::~tst_QNetworkInterface() void tst_QNetworkInterface::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 103ea1323e..bf3e2f2442 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -78,6 +78,7 @@ public: public slots: + void initTestCase(); void init(); void cleanup(); private slots: @@ -106,6 +107,11 @@ tst_PlatformSocketEngine::~tst_PlatformSocketEngine() { } +void tst_PlatformSocketEngine::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_PlatformSocketEngine::init() { } diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index 92da0e865b..93344a3bf4 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -66,6 +66,7 @@ public: public slots: + void initTestCase(); void init(); void cleanup(); private slots: @@ -147,6 +148,10 @@ tst_QHttpSocketEngine::~tst_QHttpSocketEngine() { } +void tst_QHttpSocketEngine::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} void tst_QHttpSocketEngine::init() { diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index d738926ca8..8c600c5400 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -73,6 +73,7 @@ public: public slots: + void initTestCase(); void init(); void cleanup(); private slots: @@ -157,6 +158,11 @@ tst_QSocks5SocketEngine::~tst_QSocks5SocketEngine() { } +void tst_QSocks5SocketEngine::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QSocks5SocketEngine::init() { tmpSocket = 0; diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index f96ad2781e..0cdd3a7120 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -155,6 +155,7 @@ void tst_QTcpServer::initTestCase_data() void tst_QTcpServer::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT QNetworkConfigurationManager man; networkSession = new QNetworkSession(man.defaultConfiguration(), this); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 3fb4333494..9c87ac04a0 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -133,6 +133,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); private slots: @@ -348,6 +349,11 @@ void tst_QTcpSocket::initTestCase_data() #endif } +void tst_QTcpSocket::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QTcpSocket::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index f737b94e5e..786714af13 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -80,6 +80,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); private slots: @@ -159,6 +160,11 @@ void tst_QUdpSocket::initTestCase_data() #endif } +void tst_QUdpSocket::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QUdpSocket::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 3e81c1fcfa..e742c229c1 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -118,6 +118,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); @@ -270,6 +271,11 @@ void tst_QSslSocket::initTestCase_data() // QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); } +void tst_QSslSocket::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QSslSocket::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 881ec36d4c..7e9c427192 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -78,6 +78,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); @@ -126,6 +127,11 @@ void tst_QSslSocket_onDemandCertificates_member::initTestCase_data() // QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); } +void tst_QSslSocket_onDemandCertificates_member::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QSslSocket_onDemandCertificates_member::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp index bbbfb3e6b9..59894244a4 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp @@ -78,6 +78,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); @@ -126,6 +127,11 @@ void tst_QSslSocket_onDemandCertificates_static::initTestCase_data() // QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); } +void tst_QSslSocket_onDemandCertificates_static::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QSslSocket_onDemandCertificates_static::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 565bdd70fd..9fc6147b00 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -454,6 +454,7 @@ class tst_qnetworkreply : public QObject QNetworkAccessManager manager; private slots: + void initTestCase(); void httpLatency(); #ifndef QT_NO_OPENSSL @@ -472,6 +473,11 @@ private slots: void httpsRequestChain(); }; +void tst_qnetworkreply::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_qnetworkreply::httpLatency() { QNetworkAccessManager manager; diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index b7106edb76..7f6ded8111 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -70,6 +70,7 @@ public: public slots: void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); private slots: @@ -95,6 +96,11 @@ void tst_QTcpServer::initTestCase_data() QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); } +void tst_QTcpServer::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_QTcpServer::init() { QFETCH_GLOBAL(bool, setProxy); diff --git a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp index aa4d014687..9f0a694b9a 100644 --- a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -61,7 +61,7 @@ public: public slots: - void initTestCase_data(); + void initTestCase(); void init(); void cleanup(); private slots: @@ -77,8 +77,9 @@ tst_QSslSocket::~tst_QSslSocket() { } -void tst_QSslSocket::initTestCase_data() +void tst_QSslSocket::initTestCase() { + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); } void tst_QSslSocket::init() diff --git a/tests/manual/network_stresstest/tst_network_stresstest.cpp b/tests/manual/network_stresstest/tst_network_stresstest.cpp index ca5486e09b..8337118bbf 100644 --- a/tests/manual/network_stresstest/tst_network_stresstest.cpp +++ b/tests/manual/network_stresstest/tst_network_stresstest.cpp @@ -93,6 +93,7 @@ private: public slots: void initTestCase_data(); + void initTestCase(); void init(); void slotReadAll() { byteCounter += static_cast(sender())->readAll().size(); } @@ -133,6 +134,11 @@ void tst_NetworkStressTest::initTestCase_data() QTest::newRow("remote") << false << QtNetworkSettings::serverName() << 80; } +void tst_NetworkStressTest::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_NetworkStressTest::init() { // clear the internal cache diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp index 56f3260e38..8033251d06 100644 --- a/tests/manual/qnetworkreply/main.cpp +++ b/tests/manual/qnetworkreply/main.cpp @@ -54,10 +54,10 @@ class tst_qnetworkreply : public QObject { Q_OBJECT - private slots: +private slots: + void initTestCase(); void limiting_data(); void limiting(); - }; QNetworkReply *reply; @@ -90,6 +90,11 @@ protected: QTime stopwatch; }; +void tst_qnetworkreply::initTestCase() +{ + QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +} + void tst_qnetworkreply::limiting_data() { QTest::addColumn("url");