From 91ab70d17f892f3ff6b2019632fda3920d045dcb Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 3 Jun 2019 16:16:14 +0200 Subject: tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows We use global object to store errors found by q_X509Callback. Thus, we also use a lock/mutex. It would appear all tests involving in-process server and QNAM are prone to intermittent failures on our Windows VMs - it's always about timeouts due to the client socket (QNAM) locking and the server socket blocking main thread while trying to acquire the same lock. The real fix is to get rid of global variable/locking, we'll have it later (quite a change and requires a lot of accuracy). Task-number: QTBUG-76247 Change-Id: Iffc90d9e16783f17f62e836e01c35f22681bdd39 Reviewed-by: Timur Pocheptsov --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 8627a37e12..9a2c62b955 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5031,6 +5031,9 @@ public: // very similar to ioPostToHttpUploadProgress but for SSL void tst_QNetworkReply::ioPostToHttpsUploadProgress() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif //QFile sourceFile(testDataDir + "/bigfile"); //QVERIFY(sourceFile.open(QIODevice::ReadOnly)); qint64 wantedSize = 2*1024*1024; // 2 MB @@ -6412,6 +6415,10 @@ void tst_QNetworkReply::encrypted() void tst_QNetworkReply::abortOnEncrypted() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif + SslServer server; server.listen(); if (!server.isListening()) @@ -8489,7 +8496,9 @@ void tst_QNetworkReply::ioHttpRedirectErrors_data() QTest::newRow("too-many-redirects") << "http://localhost" << tempRedirectReply << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("insecure-redirect") << "https://localhost" << tempRedirectReply << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("unknown-redirect") << "http://localhost"<< tempRedirectReply.replace("http", "bad_protocol") << QNetworkReply::ProtocolUnknownError; } @@ -8566,9 +8575,11 @@ void tst_QNetworkReply::ioHttpRedirectPolicy_data() QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; +#endif // Q_OS_WIN #endif } @@ -8622,33 +8633,41 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif // 2. SameOriginRedirectsPolicy QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif } @@ -9123,6 +9142,10 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() for (int s = 0; s <= 1; s++) { withSsl = (s == 1); +#ifdef Q_OS_WIN + if (withSsl) + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif // Q_OS_WIN // Test also needs to run several times because of 9c2ecf89 for (int j = 0; j < 20; j++) { // emulate a minimal https server -- cgit v1.2.3 From d2ed1074d051c870e7191d0a31f48fae9759e9d7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 19 May 2019 23:10:38 +0200 Subject: tests: remove the last uses of Java-style iterators ... except where they are actually the component under test. Java-style iterators are scheduled for deprecation. Change-Id: If4399f7f74c5ffc0f7e65205e422edfa1d908ee8 Reviewed-by: Lars Knoll --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 8 ++++---- tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 550d80501e..3e5f38d4bc 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -4147,10 +4147,10 @@ void tst_QNetworkReply::ioGetFromHttpWithCache() request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); QFETCH(QStringList, extraHttpHeaders); - QStringListIterator it(extraHttpHeaders); - while (it.hasNext()) { - QString header = it.next(); - QString value = it.next(); + QVERIFY(extraHttpHeaders.size() % 2 == 0); + for (auto it = extraHttpHeaders.cbegin(), end = extraHttpHeaders.cend(); it != end; /*double-stepping*/) { + QString header = *it++; + QString value = *it++; request.setRawHeader(header.toLatin1(), value.toLatin1()); // To latin1? Deal with it! } diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 0c8535f2de..efc0c26076 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -401,9 +401,7 @@ void tst_QSslCertificate::subjectAlternativeNames() certificate.subjectAlternativeNames(); // verify that each entry in subjAltNames is present in fileContents - QMapIterator it(altSubjectNames); - while (it.hasNext()) { - it.next(); + for (auto it = altSubjectNames.cbegin(), end = altSubjectNames.cend(); it != end; ++it) { QByteArray type; if (it.key() == QSsl::EmailEntry) type = "email"; -- cgit v1.2.3 From 2c9ba8474681abbd4c9eb87e8030e386b631e921 Mon Sep 17 00:00:00 2001 From: Dimitrios Apostolou Date: Tue, 11 Jun 2019 11:17:27 +0200 Subject: Do not use the resolver for the local hostname Fix test for systems that do not resolve their hostname to localhost. Not using name resolution also makes the test more robust. Change-Id: I558b9a975b9021536709db87fbf6a3b314f7ca79 Reviewed-by: Thiago Macieira --- tests/auto/network/access/qftp/tst_qftp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 6e18e1a663..1a8f264c28 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -2342,7 +2342,7 @@ void tst_QFtp::loginURL() ftp = newFtp(); addCommand(QFtp::ConnectToHost, - ftp->connectToHost(QHostInfo::localHostName(), port)); + ftp->connectToHost("127.0.0.1", port)); addCommand(QFtp::Login, ftp->login(user, password)); QTestEventLoop::instance().enterLoop(5); @@ -2350,7 +2350,7 @@ void tst_QFtp::loginURL() ftp = nullptr; server.stopServer(); if (QTestEventLoop::instance().timeout()) - QFAIL(msgTimedOut(QHostInfo::localHostName(), port)); + QFAIL(msgTimedOut("127.0.0.1", port)); QCOMPARE(server.getRawUser(), rawUser); QCOMPARE(server.getRawPassword(), rawPass); -- cgit v1.2.3 From 8c87a1402cc819c00301566755da5cb65461fac0 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 3 Jun 2019 16:16:14 +0200 Subject: tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows We use global object to store errors found by q_X509Callback. Thus, we also use a lock/mutex. It would appear all tests involving in-process server and QNAM are prone to intermittent failures on our Windows VMs - it's always about timeouts due to the client socket (QNAM) locking and the server socket blocking main thread while trying to acquire the same lock. The real fix is to get rid of global variable/locking, we'll have it later (quite a change and requires a lot of accuracy). Task-number: QTBUG-76247 Change-Id: Iffc90d9e16783f17f62e836e01c35f22681bdd39 Reviewed-by: Timur Pocheptsov (cherry picked from commit 91ab70d17f892f3ff6b2019632fda3920d045dcb) Reviewed-by: Jani Heikkinen --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 3876621983..342146648e 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5014,6 +5014,9 @@ public: // very similar to ioPostToHttpUploadProgress but for SSL void tst_QNetworkReply::ioPostToHttpsUploadProgress() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif //QFile sourceFile(testDataDir + "/bigfile"); //QVERIFY(sourceFile.open(QIODevice::ReadOnly)); qint64 wantedSize = 2*1024*1024; // 2 MB @@ -6395,6 +6398,10 @@ void tst_QNetworkReply::encrypted() void tst_QNetworkReply::abortOnEncrypted() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif + SslServer server; server.listen(); if (!server.isListening()) @@ -8472,7 +8479,9 @@ void tst_QNetworkReply::ioHttpRedirectErrors_data() QTest::newRow("too-many-redirects") << "http://localhost" << tempRedirectReply << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("insecure-redirect") << "https://localhost" << tempRedirectReply << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("unknown-redirect") << "http://localhost"<< tempRedirectReply.replace("http", "bad_protocol") << QNetworkReply::ProtocolUnknownError; } @@ -8549,9 +8558,11 @@ void tst_QNetworkReply::ioHttpRedirectPolicy_data() QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; +#endif // Q_OS_WIN #endif } @@ -8605,33 +8616,41 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif // 2. SameOriginRedirectsPolicy QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif } @@ -9106,6 +9125,10 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() for (int s = 0; s <= 1; s++) { withSsl = (s == 1); +#ifdef Q_OS_WIN + if (withSsl) + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif // Q_OS_WIN // Test also needs to run several times because of 9c2ecf89 for (int j = 0; j < 20; j++) { // emulate a minimal https server -- cgit v1.2.3 From d53b8b77bc8de236e148ef2652806015a9a87e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 11 Mar 2019 15:56:51 +0100 Subject: tst_qsslsocket: fix racy test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this threaded setup the server can sometimes have the data before it calls "waitForReadyRead", what happens then is that we fail the wait and as a result the test fails overall. Let's check if we actually got some data after all and then continue if we did. Since both the client and the server currently wait the same amount of time (2s) the max timeout for the client was increased by 0.5s so it has some time to notice that the server got the message. Change-Id: Ib5915958853413047aa5a7574712585bcae28f79 Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov (cherry picked from commit e79b1dcdf542be3a20d5c21ea163ff857ed875bf) Reviewed-by: Simo Fält --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index bca142e245..e569a5e9c2 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2171,7 +2171,7 @@ protected: // delayed reading data QTest::qSleep(100); - if (!socket->waitForReadyRead(2000)) + if (!socket->waitForReadyRead(2000) && socket->bytesAvailable() == 0) return; // error socket->readAll(); dataReadSemaphore.release(); @@ -2242,7 +2242,7 @@ void tst_QSslSocket::waitForMinusOne() socket.write("How are you doing?"); QVERIFY(socket.bytesToWrite() != 0); QVERIFY(socket.waitForBytesWritten(-1)); - QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2000)); + QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2500)); // third verification: it should wait for 100 ms: QVERIFY(socket.waitForReadyRead(-1)); -- cgit v1.2.3 From 515c6e7639a7df647cfcc8b639e258864aaaa4af Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 12 Jun 2019 15:29:09 +0200 Subject: H2 auto-test, degrage flowControlServerSide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit our powerful VMs die/time out on 30 requests, use 10 only. Change-Id: Ibf3ceedeac1839f9a88f88def844c7d61786b94f Reviewed-by: Mårten Nordheim --- tests/auto/network/access/http2/tst_http2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 9ca7c892f7..76eb431af6 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -339,7 +339,7 @@ void tst_Http2::flowControlServerSide() clearHTTP2State(); serverPort = 0; - nRequests = 30; + nRequests = 10; const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 7}}; -- cgit v1.2.3 From d8efc8d718e3b3a0464f321e740541f5b221a5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 13 Dec 2018 15:39:26 +0100 Subject: QSslSocket: add and set the TLSv1.3-specific PSK callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If this callback is not set then OpenSSL will call the callback used for <= TLS 1.2 unconditionally when connecting. If using PSK it will call it again later once the preshared key is needed. We don't currently handle the TLSv1.3 PSK, but we definitely should. But for now we can work around it - when psk_use_session_callback is called we simply change the PSK callback to a dummy function whose only purpose is to restore the old callback. This is mostly done to keep behavior the same as it is now for users (and to keep our tests running). Later we can add a new signal and handle this new feature properly. Task-number: QTBUG-67463 Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834 Reviewed-by: Simo Fält --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index e569a5e9c2..307e3d82bd 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -3550,12 +3550,7 @@ protected: socket = new QSslSocket(this); socket->setSslConfiguration(config); socket->setPeerVerifyMode(peerVerifyMode); - if (QSslSocket::sslLibraryVersionNumber() > 0x10101000L) { - // FIXME. With OpenSSL 1.1.1 and TLS 1.3 PSK auto-test is broken. - socket->setProtocol(QSsl::TlsV1_2); - } else { - socket->setProtocol(protocol); - } + socket->setProtocol(protocol); if (ignoreSslErrors) connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); @@ -3935,11 +3930,6 @@ void tst_QSslSocket::pskServer() return; QSslSocket socket; -#ifdef TLS1_3_VERSION - // FIXME: with OpenSSL 1.1.1 (thus TLS 1.3) test is known to fail - // due to the different PSK mechanism (?) - to be investigated ASAP. - socket.setProtocol(QSsl::TlsV1_2); -#endif this->socket = &socket; QSignalSpy connectedSpy(&socket, SIGNAL(connected())); -- cgit v1.2.3 From c6763ec1491e62b9d45179906cf4c05cdf794a85 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 3 Jun 2019 16:16:14 +0200 Subject: tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use global object to store errors found by q_X509Callback. Thus, we also use a lock/mutex. It would appear all tests involving in-process server and QNAM are prone to intermittent failures on our Windows VMs - it's always about timeouts due to the client socket (QNAM) locking and the server socket blocking main thread while trying to acquire the same lock. The real fix is to re-write our verification callback so that it does not need locking/does not block the main and 'http' threads as a result. But such change is too dangerous for 5.13.0 so we instead have a somewhat handicapped/reduced test on Windows. The fixed QSSlSocket will go into 5.13. Task-number: QTBUG-76157 Change-Id: Ia54701bcb3f6f079a69e52c8904ac3efcee4a787 Reviewed-by: Mårten Nordheim --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 8627a37e12..9a2c62b955 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5031,6 +5031,9 @@ public: // very similar to ioPostToHttpUploadProgress but for SSL void tst_QNetworkReply::ioPostToHttpsUploadProgress() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif //QFile sourceFile(testDataDir + "/bigfile"); //QVERIFY(sourceFile.open(QIODevice::ReadOnly)); qint64 wantedSize = 2*1024*1024; // 2 MB @@ -6412,6 +6415,10 @@ void tst_QNetworkReply::encrypted() void tst_QNetworkReply::abortOnEncrypted() { +#ifdef Q_OS_WIN + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif + SslServer server; server.listen(); if (!server.isListening()) @@ -8489,7 +8496,9 @@ void tst_QNetworkReply::ioHttpRedirectErrors_data() QTest::newRow("too-many-redirects") << "http://localhost" << tempRedirectReply << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("insecure-redirect") << "https://localhost" << tempRedirectReply << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("unknown-redirect") << "http://localhost"<< tempRedirectReply.replace("http", "bad_protocol") << QNetworkReply::ProtocolUnknownError; } @@ -8566,9 +8575,11 @@ void tst_QNetworkReply::ioHttpRedirectPolicy_data() QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; +#endif // Q_OS_WIN #endif } @@ -8622,33 +8633,41 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif // 2. SameOriginRedirectsPolicy QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) +#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // Q_OS_WIN #endif } @@ -9123,6 +9142,10 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() for (int s = 0; s <= 1; s++) { withSsl = (s == 1); +#ifdef Q_OS_WIN + if (withSsl) + QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); +#endif // Q_OS_WIN // Test also needs to run several times because of 9c2ecf89 for (int j = 0; j < 20; j++) { // emulate a minimal https server -- cgit v1.2.3 From 2e7b7e4c90882cef50b293fe8048205a9ca7e5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 13 Dec 2018 15:39:26 +0100 Subject: QSslSocket: add and set the TLSv1.3-specific PSK callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If this callback is not set then OpenSSL will call the callback used for <= TLS 1.2 unconditionally when connecting. If using PSK it will call it again later once the preshared key is needed. We don't currently handle the TLSv1.3 PSK, but we definitely should. But for now we can work around it - when psk_use_session_callback is called we simply change the PSK callback to a dummy function whose only purpose is to restore the old callback. This is mostly done to keep behavior the same as it is now for users (and to keep our tests running). Later we can add a new signal and handle this new feature properly. Reviewed-by: Simo Fält (cherry picked from commit d8efc8d718e3b3a0464f321e740541f5b221a5d6) Task-number: QTBUG-67463 Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 1c27901844..b4dc9bed33 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -3546,12 +3546,7 @@ protected: socket = new QSslSocket(this); socket->setSslConfiguration(config); socket->setPeerVerifyMode(peerVerifyMode); - if (QSslSocket::sslLibraryVersionNumber() > 0x10101000L) { - // FIXME. With OpenSSL 1.1.1 and TLS 1.3 PSK auto-test is broken. - socket->setProtocol(QSsl::TlsV1_2); - } else { - socket->setProtocol(protocol); - } + socket->setProtocol(protocol); if (ignoreSslErrors) connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); @@ -3895,11 +3890,6 @@ void tst_QSslSocket::pskServer() return; QSslSocket socket; -#ifdef TLS1_3_VERSION - // FIXME: with OpenSSL 1.1.1 (thus TLS 1.3) test is known to fail - // due to the different PSK mechanism (?) - to be investigated ASAP. - socket.setProtocol(QSsl::TlsV1_2); -#endif this->socket = &socket; QSignalSpy connectedSpy(&socket, SIGNAL(connected())); -- cgit v1.2.3 From 2c5d21be436ad5f2549cb1a6f40b185e159812a4 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 12 Jun 2019 15:29:09 +0200 Subject: H2 auto-test, degrage flowControlServerSide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit our powerful VMs die/time out on 30 requests, use 10 only. Change-Id: Ibf3ceedeac1839f9a88f88def844c7d61786b94f Reviewed-by: Mårten Nordheim (cherry picked from commit 515c6e7639a7df647cfcc8b639e258864aaaa4af) Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/http2/tst_http2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 53d0e7a694..e24370fc87 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -340,7 +340,7 @@ void tst_Http2::flowControlServerSide() clearHTTP2State(); serverPort = 0; - nRequests = 30; + nRequests = 10; const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 7}}; -- cgit v1.2.3 From fc9ae22c88dd085c7c31599037132fc756feeb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 11 Mar 2019 15:56:51 +0100 Subject: tst_qsslsocket: fix racy test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this threaded setup the server can sometimes have the data before it calls "waitForReadyRead", what happens then is that we fail the wait and as a result the test fails overall. Let's check if we actually got some data after all and then continue if we did. Since both the client and the server currently wait the same amount of time (2s) the max timeout for the client was increased by 0.5s so it has some time to notice that the server got the message. Change-Id: Ib5915958853413047aa5a7574712585bcae28f79 Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov (cherry picked from commit e79b1dcdf542be3a20d5c21ea163ff857ed875bf) Reviewed-by: Simo Fält (cherry picked from commit d53b8b77bc8de236e148ef2652806015a9a87e2b) Change-Id: I2f6ffb8e0a9b4d591edb6925e48baffcefc14511 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index b4dc9bed33..66475e55ad 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2096,7 +2096,7 @@ protected: // delayed reading data QTest::qSleep(100); - if (!socket->waitForReadyRead(2000)) + if (!socket->waitForReadyRead(2000) && socket->bytesAvailable() == 0) return; // error socket->readAll(); dataReadSemaphore.release(); @@ -2167,7 +2167,7 @@ void tst_QSslSocket::waitForMinusOne() socket.write("How are you doing?"); QVERIFY(socket.bytesToWrite() != 0); QVERIFY(socket.waitForBytesWritten(-1)); - QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2000)); + QVERIFY(server.dataReadSemaphore.tryAcquire(1, 2500)); // third verification: it should wait for 100 ms: QVERIFY(socket.waitForReadyRead(-1)); -- cgit v1.2.3 From 16cc3ea585f26bc403e051f105df677a6da79dd5 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 10 Jun 2019 16:49:19 +0200 Subject: test: migrate QNetworkReply test to QRegularExpression This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Ibdd3f63d9069c3f01dfe8431bcc64bde4f2aa569 Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ca870f1cbb..8867e4dbaa 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include #include @@ -7917,9 +7919,10 @@ void tst_QNetworkReply::synchronousAuthenticationCache() "Content-Type: text/plain\r\n" "\r\n" "auth"; - QRegExp rx("Authorization: Basic ([^\r\n]*)\r\n"); - if (rx.indexIn(receivedData) > 0) { - if (QByteArray::fromBase64(rx.cap(1).toLatin1()) == "login:password") { + QRegularExpression rx("Authorization: Basic ([^\r\n]*)\r\n"); + QRegularExpressionMatch match = rx.match(receivedData); + if (match.hasMatch()) { + if (QByteArray::fromBase64(match.captured(1).toLatin1()) == "login:password") { dataToTransmit = "HTTP/1.0 200 OK\r\n" "Content-Type: text/plain\r\n" -- cgit v1.2.3 From 84e89c1e9e00d4fab576b876cfa80e92b5602982 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 12 Jun 2019 18:06:23 +0200 Subject: Convert uses of QTime as a timer to QElapsedTimer Change-Id: I2297f61efa5adf9ea5194c7f3ff68574cbcf452c Reviewed-by: Friedemann Kleint --- tests/auto/network/access/qftp/tst_qftp.cpp | 3 ++- .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 +++++++++++----------- .../tst_platformsocketengine.cpp | 6 +++--- .../qhttpsocketengine/tst_qhttpsocketengine.cpp | 5 +++-- .../socket/qlocalsocket/tst_qlocalsocket.cpp | 3 ++- .../network/socket/qtcpsocket/tst_qtcpsocket.cpp | 11 +++++------ .../network/socket/qudpsocket/tst_qudpsocket.cpp | 3 ++- .../auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 3 ++- 8 files changed, 31 insertions(+), 26 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index e07588d6c6..63de0083f0 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "../../../network-settings.h" @@ -2160,7 +2161,7 @@ void tst_QFtp::qtbug7359Crash() QFtp ftp; ftp.connectToHost("127.0.0.1"); - QTime t; + QElapsedTimer t; int elapsed; t.start(); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 8867e4dbaa..e85147095c 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1149,7 +1150,7 @@ protected: } // now write in "blocking mode", this is where the rate measuring starts - QTime timer; + QElapsedTimer timer; timer.start(); //const qint64 writtenBefore = dataIndex; //qint64 measuredTotalBytes = wantedSize - writtenBefore; @@ -1248,7 +1249,7 @@ protected: } qint64 bytesRead = 0; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); do { if (device->bytesAvailable() == 0) { @@ -5153,8 +5154,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int rate = 200; // in kB per sec RateControlledReader reader(server, reply.data(), rate, bufferSize); - QTime loopTime; - loopTime.start(); + QElapsedTimer loopTimer; + loopTimer.start(); const int result = waitForFinish(reply); if (notEnoughDataForFastSender) { @@ -5164,7 +5165,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() QVERIFY2(result == Success, msgWaitForFinished(reply)); - const int elapsedTime = loopTime.elapsed(); + const int elapsedTime = loopTimer.elapsed(); server.wait(); reader.wrapUp(); @@ -5450,12 +5451,12 @@ void tst_QNetworkReply::rateControl() RateControlledReader reader(sender, reply.data(), rate, 20); // this test is designed to run for 25 seconds at most - QTime loopTime; - loopTime.start(); + QElapsedTimer loopTimer; + loopTimer.start(); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); - int elapsedTime = loopTime.elapsed(); + int elapsedTime = loopTimer.elapsed(); if (!errorSpy.isEmpty()) { qDebug() << "ERROR!" << errorSpy[0][0] << reply->errorString(); @@ -6125,8 +6126,8 @@ void tst_QNetworkReply::httpConnectionCount() } int pendingConnectionCount = 0; - QTime time; - time.start(); + QElapsedTimer timer; + timer.start(); while(pendingConnectionCount <= 20) { QTestEventLoop::instance().enterLoop(1); @@ -6138,7 +6139,7 @@ void tst_QNetworkReply::httpConnectionCount() } // at max. wait 10 sec - if (time.elapsed() > 10000) + if (timer.elapsed() > 10000) break; } diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 01168cc0d6..ffc63ee46a 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #ifdef Q_OS_UNIX #include @@ -403,7 +403,7 @@ void tst_PlatformSocketEngine::udpLoopbackPerformance() QHostAddress localhost = QHostAddress::LocalHost; qlonglong readBytes = 0; - QTime timer; + QElapsedTimer timer; timer.start(); while (timer.elapsed() < 5000) { udpSocket2.write(message1.data(), message1.size()); @@ -462,7 +462,7 @@ void tst_PlatformSocketEngine::tcpLoopbackPerformance() QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); - QTime timer; + QElapsedTimer timer; timer.start(); qlonglong readBytes = 0; while (timer.elapsed() < 5000) { diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index cdc6fef663..64241014d7 100644 --- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "../../../network-settings.h" @@ -397,7 +398,7 @@ void tst_QHttpSocketEngine::tcpLoopbackPerformance() QByteArray message1(messageSize, '@'); QByteArray answer(messageSize, '@'); - QTime timer; + QElapsedTimer timer; timer.start(); qlonglong readBytes = 0; while (timer.elapsed() < 30000) { @@ -629,7 +630,7 @@ void tst_QHttpSocketEngine::downloadBigFile() bytesAvailable = 0; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); QTestEventLoop::instance().enterLoop(60); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index f53c75c6a4..732f7eef00 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -1031,7 +1032,7 @@ void tst_QLocalSocket::waitForDisconnect() QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); socket.disconnectFromServer(); - QTime timer; + QElapsedTimer timer; timer.start(); QVERIFY(serverSocket->waitForDisconnected(3000)); QVERIFY(timer.elapsed() < 2000); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index abe9845213..c500c6b3c3 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -66,7 +66,7 @@ #endif #include #include -#include +#include #include #include // RVCT compiles also unused inline methods @@ -237,7 +237,6 @@ private: qint64 bytesAvailable; qint64 expectedLength; bool readingBody; - QTime timer; QByteArray expectedReplyIMAP_cached; @@ -1518,7 +1517,7 @@ void tst_QTcpSocket::downloadBigFile() expectedLength = 0; readingBody = false; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); enterLoop(600); @@ -2482,7 +2481,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect() QEventLoop loop; connect(&serverProcess, SIGNAL(finished(int)), &loop, SLOT(quit())); connect(&clientProcess, SIGNAL(finished(int)), &loop, SLOT(quit())); - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); QTimer::singleShot(20000, &loop, SLOT(quit())); @@ -2522,7 +2521,7 @@ void tst_QTcpSocket::connectToMultiIP() // rationale: this domain resolves to 3 A-records, 2 of them are // invalid. QTcpSocket should never spend more than 30 seconds per IP, and // 30s*2 = 60s. - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); socket->connectToHost("multi.dev.qt-project.org", 80); QVERIFY(socket->waitForConnected(60500)); @@ -2714,7 +2713,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorWaitForConnected() QTcpSocket socket; socket.connectToHost(QtNetworkSettings::httpServerName(), 12346); - QTime timer; + QElapsedTimer timer; timer.start(); socket.waitForConnected(10000); QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index a4b22cb000..0f419e9de4 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -922,7 +923,7 @@ void tst_QUdpSocket::performance() client.connectToHost(serverAddress, server.localPort()); QVERIFY(client.waitForConnected(10000)); - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); qint64 nbytes = 0; diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 7912063bc8..491f52a66b 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -1989,7 +1990,7 @@ public slots: QTestEventLoop::instance().exitLoop(); } void waitSomeMore(QSslSocket *socket) { - QTime t; + QElapsedTimer t; t.start(); while (!socket->encryptedBytesAvailable()) { QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents, 250); -- cgit v1.2.3 From a22a6c01f8d24a64adaa9988eab9831e42686de4 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 21 Jun 2019 09:52:19 +0200 Subject: Revert "tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QSslSocket (OpenSSL backend) does not use mutex/locks during a handshake, so we re-enable previously skipped tests. This reverts commit 8c87a1402cc819c00301566755da5cb65461fac0. Change-Id: I994b085f016f0eb18b3ba439a7041ea08cd3577b Reviewed-by: Mårten Nordheim --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 ---------------------- 1 file changed, 23 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 342146648e..3876621983 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5014,9 +5014,6 @@ public: // very similar to ioPostToHttpUploadProgress but for SSL void tst_QNetworkReply::ioPostToHttpsUploadProgress() { -#ifdef Q_OS_WIN - QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); -#endif //QFile sourceFile(testDataDir + "/bigfile"); //QVERIFY(sourceFile.open(QIODevice::ReadOnly)); qint64 wantedSize = 2*1024*1024; // 2 MB @@ -6398,10 +6395,6 @@ void tst_QNetworkReply::encrypted() void tst_QNetworkReply::abortOnEncrypted() { -#ifdef Q_OS_WIN - QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); -#endif - SslServer server; server.listen(); if (!server.isListening()) @@ -8479,9 +8472,7 @@ void tst_QNetworkReply::ioHttpRedirectErrors_data() QTest::newRow("too-many-redirects") << "http://localhost" << tempRedirectReply << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("insecure-redirect") << "https://localhost" << tempRedirectReply << QNetworkReply::InsecureRedirectError; -#endif // Q_OS_WIN #endif QTest::newRow("unknown-redirect") << "http://localhost"<< tempRedirectReply.replace("http", "bad_protocol") << QNetworkReply::ProtocolUnknownError; } @@ -8558,11 +8549,9 @@ void tst_QNetworkReply::ioHttpRedirectPolicy_data() QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; -#endif // Q_OS_WIN #endif } @@ -8616,41 +8605,33 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; -#endif // Q_OS_WIN #endif // 2. SameOriginRedirectsPolicy QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; -#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; -#endif // Q_OS_WIN #endif QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; #if QT_CONFIG(ssl) -#ifndef Q_OS_WIN // QTBUG-76157 QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; -#endif // Q_OS_WIN #endif } @@ -9125,10 +9106,6 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() for (int s = 0; s <= 1; s++) { withSsl = (s == 1); -#ifdef Q_OS_WIN - if (withSsl) - QSKIP("QTBUG-76157: get rid of locking in TLS handshake (QSslSocket)"); -#endif // Q_OS_WIN // Test also needs to run several times because of 9c2ecf89 for (int j = 0; j < 20; j++) { // emulate a minimal https server -- cgit v1.2.3 From 42f3b18ec9a101a7b8e5c6433257249bb36ab88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 24 Jun 2019 15:14:48 +0200 Subject: SSL: Update an about-to-expire certificate Change-Id: I9e29baf529b74ae33fa0ee7250e5af6b1873e86f Reviewed-by: Timur Pocheptsov --- .../qnetworkreply/certs/qt-test-server-cacert.pem | 30 +++++++++++----------- .../ssl/qsslsocket/certs/qt-test-server-cacert.pem | 30 +++++++++++----------- 2 files changed, 30 insertions(+), 30 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem index 25bd4046e8..c5aea0d7c9 100644 --- a/tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem +++ b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem @@ -1,17 +1,17 @@ -----BEGIN CERTIFICATE----- -MIICrTCCAhYCCQCdDn5rci6VDjANBgkqhkiG9w0BAQQFADCBmjEOMAwGA1UEChMF -Tm9raWExFDASBgNVBAsTC1F0IFNvZnR3YXJlMSIwIAYJKoZIhvcNAQkBFhNub2Jv -ZHlAbm9kb21haW4ub3JnMQ0wCwYDVQQHEwRPc2xvMQ0wCwYDVQQIEwRPc2xvMQsw -CQYDVQQGEwJOTzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQw -HhcNMDkwNzEwMDc0MTIzWhcNMTkwNzA4MDc0MTIzWjCBmjEOMAwGA1UEChMFTm9r -aWExFDASBgNVBAsTC1F0IFNvZnR3YXJlMSIwIAYJKoZIhvcNAQkBFhNub2JvZHlA -bm9kb21haW4ub3JnMQ0wCwYDVQQHEwRPc2xvMQ0wCwYDVQQIEwRPc2xvMQswCQYD -VQQGEwJOTzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwgZ8w -DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM2q22/WNMmn8cC+5EEYGeICySLmp9W6 -Ay6eKHr0Xxp3X3epETuPfvAuxp7rOtkS18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt -93CxGBXMIChiMPAsFeYzGa/D6xzAkfcRaJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJr -gsgBfWrwHdxzAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAy7YOLCZABQy2Ygkchq1I -+TUpvMn+gLwAyW8TNErM1V4lNY2+K78RawzKx3SqM97ymCy4TD45EA3A2gmi32NI -xSKBNjFyzngUqsXBdcSasALiowlZCiJrGwlGX5qCkBlxXvJeUEbuJLPYVl5FBjXZ -6o00K4cSPCqtqUez7WSmDZU= +MIICpzCCAhACCQCzAF1hyRVzAjANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UEBhMC +Tk8xDTALBgNVBAgTBE9zbG8xDTALBgNVBAcTBE9zbG8xDjAMBgNVBAoTBU5va2lh +MTUwMwYDVQQLFCxRdCBTb2Z0d2FyZS9lbWFpbEFkZHJlc3M9bm9ib2R5QG5vZG9t +YWluLm9yZzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwHhcN +MTkwNjI0MTI0OTIxWhcNMjIwNjIzMTI0OTIxWjCBlzELMAkGA1UEBhMCTk8xDTAL +BgNVBAgTBE9zbG8xDTALBgNVBAcTBE9zbG8xDjAMBgNVBAoTBU5va2lhMTUwMwYD +VQQLFCxRdCBTb2Z0d2FyZS9lbWFpbEFkZHJlc3M9bm9ib2R5QG5vZG9tYWluLm9y +ZzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwgZ8wDQYJKoZI +hvcNAQEBBQADgY0AMIGJAoGBAM2q22/WNMmn8cC+5EEYGeICySLmp9W6Ay6eKHr0 +Xxp3X3epETuPfvAuxp7rOtkS18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt93CxGBXM +IChiMPAsFeYzGa/D6xzAkfcRaJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJrgsgBfWrw +HdxzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEASCKbqEX5ysC549mq90ydk4jyDW3m +PUyet01fKpcRqVs+OJxdExFBTra3gho6WzzpTSPsuX2ZKOLF5k6KkCvdCGvhC1Kv +HHPIExurfzvdlSRzj6HbKyPuSfxyOloH0bBp7/Gg5RIuBPKlbmfbnTLtwEjhhbMU +SoYI8HZd3HfY87c= -----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem b/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem index 25bd4046e8..c5aea0d7c9 100644 --- a/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem +++ b/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem @@ -1,17 +1,17 @@ -----BEGIN CERTIFICATE----- -MIICrTCCAhYCCQCdDn5rci6VDjANBgkqhkiG9w0BAQQFADCBmjEOMAwGA1UEChMF -Tm9raWExFDASBgNVBAsTC1F0IFNvZnR3YXJlMSIwIAYJKoZIhvcNAQkBFhNub2Jv -ZHlAbm9kb21haW4ub3JnMQ0wCwYDVQQHEwRPc2xvMQ0wCwYDVQQIEwRPc2xvMQsw -CQYDVQQGEwJOTzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQw -HhcNMDkwNzEwMDc0MTIzWhcNMTkwNzA4MDc0MTIzWjCBmjEOMAwGA1UEChMFTm9r -aWExFDASBgNVBAsTC1F0IFNvZnR3YXJlMSIwIAYJKoZIhvcNAQkBFhNub2JvZHlA -bm9kb21haW4ub3JnMQ0wCwYDVQQHEwRPc2xvMQ0wCwYDVQQIEwRPc2xvMQswCQYD -VQQGEwJOTzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwgZ8w -DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM2q22/WNMmn8cC+5EEYGeICySLmp9W6 -Ay6eKHr0Xxp3X3epETuPfvAuxp7rOtkS18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt -93CxGBXMIChiMPAsFeYzGa/D6xzAkfcRaJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJr -gsgBfWrwHdxzAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAy7YOLCZABQy2Ygkchq1I -+TUpvMn+gLwAyW8TNErM1V4lNY2+K78RawzKx3SqM97ymCy4TD45EA3A2gmi32NI -xSKBNjFyzngUqsXBdcSasALiowlZCiJrGwlGX5qCkBlxXvJeUEbuJLPYVl5FBjXZ -6o00K4cSPCqtqUez7WSmDZU= +MIICpzCCAhACCQCzAF1hyRVzAjANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UEBhMC +Tk8xDTALBgNVBAgTBE9zbG8xDTALBgNVBAcTBE9zbG8xDjAMBgNVBAoTBU5va2lh +MTUwMwYDVQQLFCxRdCBTb2Z0d2FyZS9lbWFpbEFkZHJlc3M9bm9ib2R5QG5vZG9t +YWluLm9yZzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwHhcN +MTkwNjI0MTI0OTIxWhcNMjIwNjIzMTI0OTIxWjCBlzELMAkGA1UEBhMCTk8xDTAL +BgNVBAgTBE9zbG8xDTALBgNVBAcTBE9zbG8xDjAMBgNVBAoTBU5va2lhMTUwMwYD +VQQLFCxRdCBTb2Z0d2FyZS9lbWFpbEFkZHJlc3M9bm9ib2R5QG5vZG9tYWluLm9y +ZzEjMCEGA1UEAxMacXQtdGVzdC1zZXJ2ZXIucXQtdGVzdC1uZXQwgZ8wDQYJKoZI +hvcNAQEBBQADgY0AMIGJAoGBAM2q22/WNMmn8cC+5EEYGeICySLmp9W6Ay6eKHr0 +Xxp3X3epETuPfvAuxp7rOtkS18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt93CxGBXM +IChiMPAsFeYzGa/D6xzAkfcRaJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJrgsgBfWrw +HdxzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEASCKbqEX5ysC549mq90ydk4jyDW3m +PUyet01fKpcRqVs+OJxdExFBTra3gho6WzzpTSPsuX2ZKOLF5k6KkCvdCGvhC1Kv +HHPIExurfzvdlSRzj6HbKyPuSfxyOloH0bBp7/Gg5RIuBPKlbmfbnTLtwEjhhbMU +SoYI8HZd3HfY87c= -----END CERTIFICATE----- -- cgit v1.2.3 From a489e11b97ca6c0f5893711a363c9896dd8377f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 24 Jun 2019 15:16:14 +0200 Subject: Temporarily skip tst_QSslSocket::resume Will be reverted once ready Change-Id: Id03df7dea1dd65579ec83606fddf2a73a45a0d64 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 307e3d82bd..7420cd1296 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2780,6 +2780,7 @@ void tst_QSslSocket::encryptWithoutConnecting() void tst_QSslSocket::resume_data() { + QSKIP("Temporary skip while updating certificates"); QTest::addColumn("ignoreErrorsAfterPause"); QTest::addColumn >("errorsToIgnore"); QTest::addColumn("expectSuccess"); -- cgit v1.2.3 From ff2b2032a089d74975da4a3fac7c7c90989e6dc5 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 20 Jun 2019 17:40:45 +0200 Subject: Remove usages of deprecated APIs from QtAlgorithms Task-number: QTBUG-76491 Change-Id: I9dab736a0cbd2e86588919640c26e8ce6b3674d0 Reviewed-by: Alex Blasche Reviewed-by: Leena Miettinen --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index b05f989b5c..4035dfbf5f 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -711,7 +711,7 @@ void tst_QSslSocket::sslErrors() const auto socketSslErrors = socket->sslErrors(); for (const QSslError &err : socketSslErrors) sslErrors << err.error(); - qSort(sslErrors); + std::sort(sslErrors.begin(), sslErrors.end()); QVERIFY(sslErrors.contains(QSslError::HostNameMismatch)); QVERIFY(sslErrors.contains(FLUKE_CERTIFICATE_ERROR)); @@ -721,7 +721,7 @@ void tst_QSslSocket::sslErrors() const auto sslErrorsSpyErrors = qvariant_cast >(qAsConst(sslErrorsSpy).first().first()); for (const QSslError &err : sslErrorsSpyErrors) emittedErrors << err.error(); - qSort(emittedErrors); + std::sort(emittedErrors.begin(), emittedErrors.end()); QCOMPARE(sslErrors, emittedErrors); // check the same errors were emitted by peerVerifyError @@ -730,7 +730,7 @@ void tst_QSslSocket::sslErrors() const QList &peerVerifyList = peerVerifyErrorSpy; for (const QVariantList &args : peerVerifyList) peerErrors << qvariant_cast(args.first()).error(); - qSort(peerErrors); + std::sort(peerErrors.begin(), peerErrors.end()); QCOMPARE(sslErrors, peerErrors); } -- cgit v1.2.3 From 1eeab2d27f61485cb53364d40339a8d832a076e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 24 Jun 2019 18:55:36 +0200 Subject: QSocks5SocketEngine: account for in-transit signal when waiting for read When calling waitFor{ReadyRead,Disconnected} it will wait for data but if the data is already received and the read notification has been queued (and there's no more data coming in) it will return false. By checking if a read notification has been queued and then handling this we can easily take care of this scenario. Fixes some flaky tests which missed the read data in waitForDisconnect and similar. Fixes: QTBUG-38385 Change-Id: Ic05d59883c1175783e56ff1822b6636c35aec874 Reviewed-by: Volker Hilsheimer --- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index c473230246..2d64714f92 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -328,8 +328,8 @@ void tst_QTcpSocket::initTestCase_data() qDebug() << QtNetworkSettings::serverName(); QTest::newRow("WithoutProxy") << false << 0 << false; - //QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; ### temporarily disabled, QTBUG-38385 - //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; ### temporarily disabled, QTBUG-38385 + QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; + QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false; QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false; @@ -337,8 +337,8 @@ void tst_QTcpSocket::initTestCase_data() #ifndef QT_NO_SSL QTest::newRow("WithoutProxy SSL") << false << 0 << true; - //QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; ### temporarily disabled, QTBUG-38385 - //QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; ### temporarily disabled, QTBUG-38385 + QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; + QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true; QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true; -- cgit v1.2.3 From b0cd007335853f283c47ffb0f5611d14e6dbe84b Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 4 Jul 2019 15:06:13 +0200 Subject: Remove usages of QSysInfo's deprecated APIs - Replaced QOperatingSystemVersion::WindowsVersion, QSysInfo::windowsVersion(), QSysInfo::macVersion(), QSysInfo::MacintoshVersion with QOperatingSystemVersion::current(). - Added QOperatingSystemVersion::WindowsVista for convenience, as it is used in lots of places. Change-Id: If9c4ac496005b2e70b5c70be160747afa74b98c1 Reviewed-by: Timur Pocheptsov --- tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 22ac9aa076..fc5a7d1fab 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -882,7 +882,7 @@ void tst_QTcpServer::serverAddress_data() QTest::addColumn("listenAddress"); QTest::addColumn("serverAddress"); #ifdef Q_OS_WIN - if (QSysInfo::windowsVersion() < QSysInfo::WV_6_0) + if (QOperatingSystemVersion::current() < QOperatingSystemVersion::WindowsVista) QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4); //windows XP doesn't support dual stack sockets else #endif -- cgit v1.2.3 From 4cb074925006b75bb42aa2e4cdcb3a0a34453174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 4 Jul 2019 16:13:45 +0200 Subject: tst_QTcpSocket::hostNotFound Only expect failure for the http proxy When I added the QEXPECT_FAIL the http proxy was the only one. That's no longer true after fixing the SOCKS proxy, so let's make the condition more specific. Change-Id: I1eaa5117d5d0219e04cbd091ec54e522fe7b5509 Reviewed-by: Dimitrios Apostolou Reviewed-by: Timur Pocheptsov --- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index c500c6b3c3..1bb25aa653 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -865,7 +865,8 @@ void tst_QTcpSocket::hostNotFound() QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); #ifdef QT_TEST_SERVER QFETCH_GLOBAL(bool, setProxy); - if (setProxy) { + QFETCH_GLOBAL(int, proxyType); + if (setProxy && (proxyType & HttpProxy) == HttpProxy) { QEXPECT_FAIL("", "QTBUG-73953: The version of Squid in the docker container behaves " "differently to the one in the network testing server, returning 503 " "when we expect 404", Continue); -- cgit v1.2.3