diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-08-06 12:24:37 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-08-07 12:50:28 +0200 |
commit | 05b90be3c5ce4709156178478abb2e7ba125a0be (patch) | |
tree | a7c39b76c99f4887dbc6837be3a41afc7fdb29b4 /tests/auto/network/access | |
parent | 7301e44161d8bb25410219a31405584c9492b83e (diff) | |
parent | 6f357f50b4b72e3c5a6903a09624ade1d72d12c1 (diff) |
Merge "Merge remote-tracking branch 'origin/dev' into wip/qt6"
Diffstat (limited to 'tests/auto/network/access')
-rw-r--r-- | tests/auto/network/access/http2/tst_http2.cpp | 179 | ||||
-rw-r--r-- | tests/auto/network/access/qabstractnetworkcache/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/network/access/qftp/BLACKLIST | 11 | ||||
-rw-r--r-- | tests/auto/network/access/qftp/tst_qftp.cpp | 80 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkreply/BLACKLIST | 246 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 14 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp | 7 | ||||
-rw-r--r-- | tests/auto/network/access/spdy/BLACKLIST | 10 |
8 files changed, 461 insertions, 88 deletions
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index e24370fc87..bf3d936446 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -46,6 +46,7 @@ #endif // NO_SSL #include <cstdlib> +#include <memory> #include <string> #include "emulationdetector.h" @@ -71,6 +72,8 @@ class tst_Http2 : public QObject public: tst_Http2(); ~tst_Http2(); +public slots: + void init(); private slots: // Tests: void singleRequest_data(); @@ -82,6 +85,8 @@ private slots: void goaway_data(); void goaway(); void earlyResponse(); + void connectToHost_data(); + void connectToHost(); protected slots: // Slots to listen to our in-process server: @@ -115,7 +120,7 @@ private: quint16 serverPort = 0; QThread *workerThread = nullptr; - QNetworkAccessManager manager; + std::unique_ptr<QNetworkAccessManager> manager; QTestEventLoop eventLoop; @@ -129,6 +134,10 @@ private: static const Http2::RawSettings defaultServerSettings; }; +#define STOP_ON_FAILURE \ + if (QTest::currentTestFailed()) \ + return; + const Http2::RawSettings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}}; namespace { @@ -174,6 +183,11 @@ tst_Http2::~tst_Http2() } } +void tst_Http2::init() +{ + manager.reset(new QNetworkAccessManager); +} + void tst_Http2::singleRequest_data() { QTest::addColumn<QNetworkRequest::Attribute>("h2Attribute"); @@ -228,13 +242,14 @@ void tst_Http2::singleRequest() QFETCH(const QNetworkRequest::Attribute, h2Attribute); request.setAttribute(h2Attribute, QVariant(true)); - auto reply = manager.get(request); + auto reply = manager->get(request); connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished); // Since we're using self-signed certificates, // ignore SSL errors: reply->ignoreSslErrors(); runEventLoop(); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -270,6 +285,7 @@ void tst_Http2::multipleRequests() sendRequest(i, priorities[QRandomGenerator::global()->bounded(3)]); runEventLoop(); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -299,7 +315,7 @@ void tst_Http2::flowControlClientSide() params.maxSessionReceiveWindowSize = Http2::defaultSessionWindowSize * 5; params.settingsFrameData[Settings::INITIAL_WINDOW_SIZE_ID] = Http2::defaultSessionWindowSize; // Inform our manager about non-default settings: - manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); + manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, quint32(3)}}; ServerPtr srv(newServer(serverSettings, defaultConnectionType(), params)); @@ -317,6 +333,7 @@ void tst_Http2::flowControlClientSide() sendRequest(i); runEventLoop(120000); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -357,6 +374,7 @@ void tst_Http2::flowControlServerSide() sendRequest(i, QNetworkRequest::NormalPriority, payload); runEventLoop(120000); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -377,7 +395,7 @@ void tst_Http2::pushPromise() Http2::ProtocolParameters params; // Defaults are good, except ENABLE_PUSH: params.settingsFrameData[Settings::ENABLE_PUSH_ID] = 1; - manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); + manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); ServerPtr srv(newServer(defaultServerSettings, defaultConnectionType(), params)); srv->enablePushPromise(true, QByteArray("/script.js")); @@ -393,12 +411,13 @@ void tst_Http2::pushPromise() QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true)); - auto reply = manager.get(request); + auto reply = manager->get(request); connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished); // Since we're using self-signed certificates, ignore SSL errors: reply->ignoreSslErrors(); runEventLoop(); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -416,7 +435,7 @@ void tst_Http2::pushPromise() url.setPath("/script.js"); QNetworkRequest promisedRequest(url); promisedRequest.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true)); - reply = manager.get(promisedRequest); + reply = manager->get(promisedRequest); connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished); reply->ignoreSslErrors(); @@ -467,7 +486,7 @@ void tst_Http2::goaway() url.setPath(QString("/%1").arg(i)); QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true)); - replies[i] = manager.get(request); + replies[i] = manager->get(request); QCOMPARE(replies[i]->error(), QNetworkReply::NoError); void (QNetworkReply::*errorSignal)(QNetworkReply::NetworkError) = &QNetworkReply::error; @@ -477,6 +496,7 @@ void tst_Http2::goaway() } runEventLoop(5000 + responseTimeoutMS); + STOP_ON_FAILURE // No request processed, no 'replyFinished' slot calls: QCOMPARE(nRequests, 0); @@ -520,10 +540,132 @@ void tst_Http2::earlyResponse() sendRequest(1, QNetworkRequest::NormalPriority, {1000000, Qt::Uninitialized}); runEventLoop(); + STOP_ON_FAILURE + + QVERIFY(nRequests == 0); + QVERIFY(prefaceOK); + QVERIFY(serverGotSettingsACK); +} + +void tst_Http2::connectToHost_data() +{ + // The attribute to set on a new request: + QTest::addColumn<QNetworkRequest::Attribute>("requestAttribute"); + // The corresponding (to the attribute above) connection type the + // server will use: + QTest::addColumn<H2Type>("connectionType"); + +#if QT_CONFIG(ssl) + QTest::addRow("encrypted-h2-direct") << QNetworkRequest::Http2DirectAttribute << H2Type::h2Direct; + if (!clearTextHTTP2) + QTest::addRow("encrypted-h2-ALPN") << QNetworkRequest::HTTP2AllowedAttribute << H2Type::h2Alpn; +#endif // QT_CONFIG(ssl) + // This works for all configurations, tests 'preconnect-http' scheme: + // h2 with protocol upgrade is not working for now (the logic is a bit + // complicated there ...). + QTest::addRow("h2-direct") << QNetworkRequest::Http2DirectAttribute << H2Type::h2cDirect; +} + +void tst_Http2::connectToHost() +{ + // QNetworkAccessManager::connectToHostEncrypted() and connectToHost() + // creates a special request with 'preconnect-https' or 'preconnect-http' + // schemes. At the level of the protocol handler we are supposed to report + // these requests as finished and wait for the real requests. This test will + // connect to a server with the first reply 'finished' signal meaning we + // indeed connected. At this point we check that a client preface was not + // sent yet, and no response received. Then we send the second (the real) + // request and do our usual checks. Since our server closes its listening + // socket on the first incoming connection (would not accept a new one), + // the successful completion of the second requests also means we were able + // to find a cached connection and re-use it. + + QFETCH(const QNetworkRequest::Attribute, requestAttribute); + QFETCH(const H2Type, connectionType); + + clearHTTP2State(); + + serverPort = 0; + nRequests = 2; + + ServerPtr targetServer(newServer(defaultServerSettings, connectionType)); + +#if QT_CONFIG(ssl) + Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn); +#else + Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect); + Q_ASSERT(targetServer->isClearText()); +#endif // QT_CONFIG(ssl) + + QMetaObject::invokeMethod(targetServer.data(), "startServer", Qt::QueuedConnection); + runEventLoop(); + + QVERIFY(serverPort != 0); + + auto url = requestUrl(connectionType); + url.setPath("/index.html"); + + QNetworkReply *reply = nullptr; + // Here some mess with how we create this first reply: +#if QT_CONFIG(ssl) + if (!targetServer->isClearText()) { + // Let's emulate what QNetworkAccessManager::connectToHostEncrypted() does. + // Alas, we cannot use it directly, since it does not return the reply and + // also does not know the difference between H2 with ALPN or direct. + auto copyUrl = url; + copyUrl.setScheme(QLatin1String("preconnect-https")); + QNetworkRequest request(copyUrl); + request.setAttribute(requestAttribute, true); + reply = manager->get(request); + // Since we're using self-signed certificates, ignore SSL errors: + reply->ignoreSslErrors(); + } else +#endif // QT_CONFIG(ssl) + { + // Emulating what QNetworkAccessManager::connectToHost() does with + // additional information that it cannot provide (the attribute). + auto copyUrl = url; + copyUrl.setScheme(QLatin1String("preconnect-http")); + QNetworkRequest request(copyUrl); + request.setAttribute(requestAttribute, true); + reply = manager->get(request); + } + + connect(reply, &QNetworkReply::finished, [this, reply]() { + --nRequests; + eventLoop.exitLoop(); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(reply->isFinished()); + // Nothing must be sent yet: + QVERIFY(!prefaceOK); + QVERIFY(!serverGotSettingsACK); + // Nothing received back: + QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull()); + QCOMPARE(reply->readAll().size(), 0); + }); + + runEventLoop(); + STOP_ON_FAILURE + + QCOMPARE(nRequests, 1); + + QNetworkRequest request(url); + request.setAttribute(requestAttribute, QVariant(true)); + reply = manager->get(request); + connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished); + // Note, unlike the first request, when the connection is ecnrytped, we + // do not ignore TLS errors on this reply - we should re-use existing + // connection, there TLS errors were already ignored. + + runEventLoop(); + STOP_ON_FAILURE QVERIFY(nRequests == 0); QVERIFY(prefaceOK); QVERIFY(serverGotSettingsACK); + + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(reply->isFinished()); } void tst_Http2::serverStarted(quint16 port) @@ -537,7 +679,7 @@ void tst_Http2::clearHTTP2State() windowUpdates = 0; prefaceOK = false; serverGotSettingsACK = false; - manager.setProperty(Http2::http2ParametersPropertyName, QVariant()); + manager->setProperty(Http2::http2ParametersPropertyName, QVariant()); } void tst_Http2::runEventLoop(int ms) @@ -590,9 +732,9 @@ void tst_Http2::sendRequest(int streamNumber, QNetworkReply *reply = nullptr; if (payload.size()) - reply = manager.post(request, payload); + reply = manager->post(request, payload); else - reply = manager.get(request); + reply = manager->get(request); reply->ignoreSslErrors(); connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished); @@ -684,14 +826,29 @@ void tst_Http2::replyFinished() QVERIFY(nRequests); if (const auto reply = qobject_cast<QNetworkReply *>(sender())) { + if (reply->error() != QNetworkReply::NoError) + stopEventLoop(); + QCOMPARE(reply->error(), QNetworkReply::NoError); + const QVariant http2Used(reply->attribute(QNetworkRequest::HTTP2WasUsedAttribute)); + if (!http2Used.isValid() || !http2Used.toBool()) + stopEventLoop(); + QVERIFY(http2Used.isValid()); QVERIFY(http2Used.toBool()); + const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute)); + if (!spdyUsed.isValid() || spdyUsed.toBool()) + stopEventLoop(); + QVERIFY(spdyUsed.isValid()); QVERIFY(!spdyUsed.toBool()); + const QVariant code(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute)); + if (!code.isValid() || !code.canConvert<int>() || code.value<int>() != 200) + stopEventLoop(); + QVERIFY(code.isValid()); QVERIFY(code.canConvert<int>()); QCOMPARE(code.value<int>(), 200); @@ -709,6 +866,8 @@ void tst_Http2::replyFinishedWithError() if (const auto reply = qobject_cast<QNetworkReply *>(sender())) { // For now this is a 'generic' code, it just verifies some error was // reported without testing its type. + if (reply->error() == QNetworkReply::NoError) + stopEventLoop(); QVERIFY(reply->error() != QNetworkReply::NoError); } diff --git a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST index 2ad52f8b31..12f45f0e12 100644 --- a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST +++ b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST @@ -1,2 +1,2 @@ [cacheControl] -windows +windows-10 msvc-2015 diff --git a/tests/auto/network/access/qftp/BLACKLIST b/tests/auto/network/access/qftp/BLACKLIST index 96d9274653..463030a089 100644 --- a/tests/auto/network/access/qftp/BLACKLIST +++ b/tests/auto/network/access/qftp/BLACKLIST @@ -6,5 +6,16 @@ redhatenterpriselinuxworkstation-6.6 [activeMode:WithoutProxyWithSession] redhatenterpriselinuxworkstation-6.6 +[list] +ubuntu-16.04 +opensuse-leap +osx-10.11 +windows-7sp1 +ubuntu-18.04 +osx-10.14 +b2qt +osx-10.12 +windows-10 msvc-2015 +opensuse-42.3 [list:epsvNotSupported] * diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index a04c2ae01d..2068738a67 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -134,8 +134,8 @@ private: bool fileExists( const QString &host, quint16 port, const QString &user, const QString &password, const QString &file, const QString &cdDir = QString() ); bool dirExists( const QString &host, quint16 port, const QString &user, const QString &password, const QString &cdDir, const QString &dirToCreate ); - void renameInit( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &createFile ); - void renameCleanup( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &fileToDelete ); + void renameInit( const QString &host, const QString &user, const QString &password, const QString &createFile ); + void renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete ); QFtp *ftp; #ifndef QT_NO_BEARERMANAGEMENT @@ -336,11 +336,7 @@ static QByteArray msgTimedOut(const QString &host, quint16 port = 0) result += ':'; result += QByteArray::number(port); } - - if (host == QtNetworkSettings::ftpServerName()) - return "(QTBUG-75549) Flaky results: " % result; - else - return result; + return result; } void tst_QFtp::connectToHost() @@ -355,7 +351,7 @@ void tst_QFtp::connectToHost() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); QTEST( connectToHost_state, "state" ); @@ -438,7 +434,7 @@ void tst_QFtp::login() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Login ); QVERIFY( it != resultMap.end() ); @@ -486,7 +482,7 @@ void tst_QFtp::close() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); QCOMPARE( close_state, (int)QFtp::Unconnected ); @@ -554,7 +550,7 @@ void tst_QFtp::list() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::List ); QVERIFY( it != resultMap.end() ); @@ -615,7 +611,7 @@ void tst_QFtp::cd() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) { - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); } ResMapIt it = resultMap.find( QFtp::Cd ); @@ -692,7 +688,7 @@ void tst_QFtp::get() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Get ); QVERIFY( it != resultMap.end() ); @@ -819,7 +815,7 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Put ); QVERIFY( it != resultMap.end() ); @@ -852,7 +848,7 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); QCOMPARE( done_success, 1 ); QTEST( buf.buffer(), "fileData" ); @@ -870,7 +866,7 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -934,7 +930,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Mkdir ); QVERIFY( it != resultMap.end() ); @@ -959,7 +955,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Mkdir ); QVERIFY( it != resultMap.end() ); @@ -979,7 +975,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Rmdir ); QVERIFY( it != resultMap.end() ); @@ -1077,9 +1073,8 @@ void tst_QFtp::rename_data() << 0; } -void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &createFile ) +void tst_QFtp::renameInit( const QString &host, const QString &user, const QString &password, const QString &createFile ) { - isSuccess = false; if ( !createFile.isNull() ) { // upload the file init(); @@ -1093,7 +1088,7 @@ void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString & delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host) ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Put ); QVERIFY( it != resultMap.end() ); @@ -1101,12 +1096,10 @@ void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString & QVERIFY( fileExists( host, 21, user, password, createFile ) ); } - isSuccess = true; } -void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &fileToDelete ) +void tst_QFtp::renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete ) { - isSuccess = false; if ( !fileToDelete.isNull() ) { // cleanup (i.e. remove the file) init(); @@ -1120,7 +1113,7 @@ void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QStrin delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host) ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -1128,7 +1121,6 @@ void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QStrin QVERIFY( !fileExists( host, 21, user, password, fileToDelete ) ); } - isSuccess = true; } void tst_QFtp::rename() @@ -1151,10 +1143,7 @@ void tst_QFtp::rename() if(renamedFile.contains('%')) renamedFile = renamedFile.arg(uniqueExtension); - bool isSuccess = true; - renameInit(isSuccess, host, user, password, createFile); - if (!isSuccess) - QSKIP("(QTBUG-75549) abort test when there is an error in helper functions"); + renameInit( host, user, password, createFile ); init(); ftp = newFtp(); @@ -1169,7 +1158,7 @@ void tst_QFtp::rename() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host) ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Rename ); QVERIFY( it != resultMap.end() ); @@ -1184,9 +1173,7 @@ void tst_QFtp::rename() QVERIFY( !fileExists( host, 21, user, password, renamedFile ) ); } - renameCleanup(isSuccess, host, user, password, renamedFile); - if (!isSuccess) - QSKIP("(QTBUG-75549) abort test when there is an error in helper functions"); + renameCleanup( host, user, password, renamedFile ); } /* @@ -1360,7 +1347,7 @@ void tst_QFtp::commandSequence() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host) ); + QFAIL( msgTimedOut(host) ); QTEST( commandSequence_success, "success" ); } @@ -1415,7 +1402,7 @@ void tst_QFtp::abort() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( cmd ); QVERIFY( it != resultMap.end() ); @@ -1453,7 +1440,7 @@ void tst_QFtp::abort() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -1491,11 +1478,8 @@ void tst_QFtp::bytesAvailable() addCommand( QFtp::Close, ftp->close() ); QTestEventLoop::instance().enterLoop( 40 ); - if ( QTestEventLoop::instance().timeout() ) { - delete ftp; - ftp = 0; - QSKIP( msgTimedOut(host) ); - } + if ( QTestEventLoop::instance().timeout() ) + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Get ); QVERIFY( it != resultMap.end() ); @@ -1588,7 +1572,7 @@ void tst_QFtp::proxy() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) { - QSKIP( msgTimedOut(host, port) ); + QFAIL( msgTimedOut(host, port) ); } ResMapIt it = resultMap.find( QFtp::Cd ); @@ -1623,7 +1607,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) ); + QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) ); ResMapIt it = resultMap.find(QFtp::Put); QVERIFY(it != resultMap.end()); @@ -1645,7 +1629,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) ); + QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) ); ResMapIt it2 = resultMap.find(QFtp::Get); QVERIFY(it2 != resultMap.end()); @@ -1668,7 +1652,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) ); + QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -2100,7 +2084,7 @@ void tst_QFtp::doneSignal() connect(&ftp, SIGNAL(done(bool)), &(QTestEventLoop::instance()), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(61); if (QTestEventLoop::instance().timeout()) - QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) ); + QFAIL("Network operation timed out"); QCOMPARE(spy.count(), 1); QCOMPARE(spy.first().first().toBool(), false); diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 4d29a830e9..f9bbdd96c3 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -1,47 +1,249 @@ # See qtbase/src/testlib/qtestblacklist.cpp for format -osx [authenticationCacheAfterCancel] -windows +windows-10 msvc-2017 +windows-10 msvc-2015 +osx-10.13 +windows-7sp1 [httpAbort] -* +ubuntu-16.04 +rhel-7.6 +[backgroundRequestInterruption] +ubuntu-16.04 +opensuse-leap +ubuntu-18.04 +b2qt +osx-10.12 +windows-10 msvc-2015 +opensuse-42.3 [backgroundRequestInterruption:ftp, bg, nobg] * +[getErrors] +osx-10.13 +# QTBUG-71953 [getErrors:ftp-host] linux # QTBUG-71953 +[getFromHttp] +rhel-6.6 +ubuntu-16.04 +rhel-7.6 +opensuse-leap +osx-10.11 +osx-10.13 +windows-7sp1 +ubuntu-18.04 +osx-10.14 +rhel-7.4 +b2qt +windows-10 msvc-2017 +osx-10.12 +windows-10 msvc-2015 +opensuse-42.3 [getFromHttp:success-external] * [getFromHttpIntoBuffer] -windows +osx-10.12 +osx-10.13 [getFromHttpIntoBuffer2] -windows +windows-10 msvc-2015 +windows-10 msvc-2017 [headFromHttp] -windows +osx-10.13 +windows-10 msvc-2017 [ioGetFromHttpWithSocksProxy] -windows +osx-10.12 [ioPostToHttpFromSocket] -windows # QTBUG-66247 +osx-10.13 +windows-7sp1 +windows-10 msvc-2017 +osx-10.12 +windows-10 msvc-2015 [ioHttpRedirect] -windows +windows-10 msvc-2015 # QTBUG-66602 +windows-10 msvc-2017 [ioHttpRedirectMultipartPost] -* +ubuntu-16.04 +rhel-7.6 # QTBUG-66247 +opensuse-leap +osx-10.13 +ubuntu-18.04 +rhel-7.4 +b2qt +osx-10.12 +windows-10 msvc-2015 +opensuse-42.3 [ioHttpRedirectPolicy] -* +ubuntu-16.04 +opensuse-leap +windows-7sp1 +ubuntu-18.04 +b2qt +windows-10 msvc-2017 +windows-10 msvc-2015 +opensuse-42.3 [ioHttpRedirectPostPut] -linux -windows +osx-10.12 +windows-10 msvc-2015 [putToFtp] -windows ci -[putToFtpWithInvalidCredentials] -windows ci +windows-10 msvc-2017 [putWithServerClosingConnectionImmediately] -windows +osx-10.11 +osx-10.13 +windows-7sp1 +windows-10 msvc-2017 +osx-10.12 +windows-10 msvc-2015 [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] -windows -[getFromUnreachableIp] -windows msvc-2017 -[ioHttpRedirectErrors:too-many-redirects] -rhel-6.6 ci +windows-10 msvc-2015 +windows-7sp1 +[authenticationWithDifferentRealm] +osx-10.13 +[backgroundRequest] +osx-10.12 +[connectToIPv6Address] +osx-10.12 +[deleteFromHttp] +osx-10.12 +[downloadProgress] +osx-10.12 +[emitErrorForAllReplies] +osx-10.12 +[encrypted] +osx-10.13 +[ftpAuthentication] +osx-10.13 +[httpCanReadLine] +osx-10.12 +osx-10.13 +[httpRecursiveCreation] +osx-10.12 +osx-10.13 +[httpWithNoCredentialUsage] +osx-10.12 +[ignoreSslErrorsList] +osx-10.12 +osx-10.13 +[ignoreSslErrorsListWithSlot] +osx-10.12 +osx-10.13 +[ioGetFromBuiltinHttp] +osx-10.12 +osx-10.11 +osx-10.14 +osx-10.13 +[ioGetFromHttp] +osx-10.12 +[ioGetFromHttpWithAuth] +osx-10.12 +osx-10.13 +[ioGetFromHttpWithAuthSynchronous] +osx-10.12 +[ioGetFromHttpWithProxyAuth] +osx-10.12 +[ioGetFromHttpWithReuseParallel] +osx-10.12 +osx-10.13 +[ioGetFromHttpWithReuseSequential] +osx-10.12 +osx-10.13 +[ioGetFromHttpsWithIgnoreSslErrors] +osx-10.12 +[ioGetFromHttpsWithSslErrors] +osx-10.12 +[ioGetFromHttpsWithSslHandshakeError] +osx-10.12 +[ioGetWithManyProxies] +osx-10.12 +[ioPostToHttpFromFile] +osx-10.13 +[ioPostToHttpFromMiddleOfFileFiveBytes] +osx-10.13 +[ioPostToHttpFromMiddleOfFileToEnd] +osx-10.13 +[ioPostToHttpFromMiddleOfQBufferFiveBytes] +osx-10.13 +[ioPostToHttpFromSocketSynchronous] +osx-10.12 +osx-10.13 +[ioPostToHttpNoBufferFlag] +osx-10.13 +[ioPostToHttpUploadProgress] +osx-10.12 +osx-10.11 +osx-10.13 +[ioPutToHttpFromFile] +osx-10.13 +[lastModifiedHeaderForHttp] +osx-10.12 +osx-10.13 +[multipartSkipIndices] +osx-10.12 +osx-10.13 +[nestedEventLoops] +osx-10.12 +osx-10.13 +[pipelining] +osx-10.13 +[postToHttp] +osx-10.12 +osx-10.13 +[postToHttpMultipart] +osx-10.12 +osx-10.13 +[postToHttpSynchronous] +osx-10.12 +osx-10.13 +[postToHttps] +osx-10.12 +osx-10.13 +[postToHttpsMultipart] +osx-10.12 +osx-10.13 +[postToHttpsSynchronous] +osx-10.12 +osx-10.13 +[putGetDeleteGetFromHttp] +osx-10.12 +[putToHttp] +osx-10.12 +osx-10.13 +[putToHttpSynchronous] +osx-10.12 +osx-10.13 +[putToHttps] +osx-10.12 +osx-10.13 +[putToHttpsSynchronous] +osx-10.12 +osx-10.13 +[putWithRateLimiting] +osx-10.12 +osx-10.13 +[qtbug13431replyThrottling] +osx-10.12 +[receiveCookiesFromHttp] +osx-10.12 +osx-10.13 +[receiveCookiesFromHttpSynchronous] +osx-10.12 +osx-10.13 +[sendCookies] +osx-10.12 +osx-10.13 +[sendCookiesSynchronous] +osx-10.12 +osx-10.13 +[sendCustomRequestToHttp] +osx-10.12 +[sslConfiguration] +osx-10.12 +osx-10.13 +[synchronousRequest] +osx-10.12 +osx-10.13 +[backgroundRequestConnectInBackground] +osx-10.12 +osx-10.13 diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 1afd8af7b0..418e1caf68 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6426,7 +6426,8 @@ void tst_QNetworkReply::abortOnEncrypted() QSKIP("Server fails to listen. Skipping since QTcpServer is covered in another test."); server.connect(&server, &SslServer::newEncryptedConnection, [&server]() { - connect(server.socket, &QTcpSocket::readyRead, server.socket, []() { + // MSVC 201X C4573-misunderstands connect() or QObject::connect(), so use server.connect(): + server.connect(server.socket, &QTcpSocket::readyRead, server.socket, []() { // This slot must not be invoked! QVERIFY(false); }); @@ -6474,8 +6475,8 @@ void tst_QNetworkReply::sslSessionSharing_data() void tst_QNetworkReply::sslSessionSharing() { -#ifdef QT_SECURETRANSPORT - QSKIP("Not implemented with SecureTransport"); +#if QT_CONFIG(schannel) || defined(QT_SECURETRANSPORT) + QSKIP("Not implemented with SecureTransport/Schannel"); #endif QString urlString("https://" + QtNetworkSettings::httpServerName()); @@ -6542,8 +6543,8 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession_data() void tst_QNetworkReply::sslSessionSharingFromPersistentSession() { -#ifdef QT_SECURETRANSPORT - QSKIP("Not implemented with SecureTransport"); +#if QT_CONFIG(schannel) || defined(QT_SECURETRANSPORT) + QSKIP("Not implemented with SecureTransport/Schannel"); #endif QString urlString("https://" + QtNetworkSettings::httpServerName()); @@ -8200,6 +8201,9 @@ void tst_QNetworkReply::backgroundRequestInterruption_data() void tst_QNetworkReply::backgroundRequestInterruption() { #ifndef QT_NO_BEARERMANAGEMENT + if (QNetworkStatusMonitor::isEnabled() && QByteArray(QTest::currentDataTag()).startsWith("http")) + QSKIP("This test (currently) doesn't make any sense when QNetworkStatusMonitor is enabled"); + QFETCH(QUrl, url); QFETCH(bool, background); QFETCH(QNetworkReply::NetworkError, error); diff --git a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp index 7a3def410a..6637be0174 100644 --- a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp +++ b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp @@ -41,6 +41,7 @@ class tst_QNetworkRequest: public QObject private slots: void ctor_data(); void ctor(); + void implicitDefaultCtor(); void setUrl_data(); void setUrl(); void setRawHeader_data(); @@ -78,6 +79,12 @@ void tst_QNetworkRequest::ctor() } } +void tst_QNetworkRequest::implicitDefaultCtor() +{ + QNetworkRequest r = {}; + Q_UNUSED(r); +} + void tst_QNetworkRequest::setUrl_data() { ctor_data(); diff --git a/tests/auto/network/access/spdy/BLACKLIST b/tests/auto/network/access/spdy/BLACKLIST index b13eae1000..ce2f7f383f 100644 --- a/tests/auto/network/access/spdy/BLACKLIST +++ b/tests/auto/network/access/spdy/BLACKLIST @@ -1,4 +1,10 @@ [download] -linux +opensuse-leap +ubuntu-18.04 +ubuntu-16.04 +b2qt [upload] -linux +opensuse-leap +ubuntu-18.04 +b2qt + |