summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2015-10-26 12:53:02 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-03-30 17:01:35 +0000
commit8bd67f61a61f7fc247ed81964c9f4b0d8978cec3 (patch)
treef0bcb2559bbb11856fda38c5cf58bcaa2952556e /tests
parentc031ba30d5c981e1e0f390ee728eda3260cd01b8 (diff)
tst_qsslsocket::protocolServeSide - fix for macOS 10.11
Mixing different protocols on client-server sockets works differently on 10.11, making previously successful handshakes failing now. Failure is specific to 10.11 with SecureTransport. Change-Id: I35374b40fa3d167802775b526cf6465ae78749cf Task-number: QTBUG-48860 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 8a8522760c..f9ca119d1b 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -29,6 +29,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qthread.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qhostinfo.h>
#include <QtNetwork/qnetworkproxy.h>
@@ -1166,6 +1167,19 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::addColumn<QSsl::SslProtocol>("clientProtocol");
QTest::addColumn<bool>("works");
+ // On macOS 10.11 with SecureTransport backend some tests are failing for no
+ // obvious reason (so no bug in our code): QTBUG-48860 - an error can be
+ // errSSLInternal or cipher negotiation failure. This problem does not exist
+ // on macOS before 10.11 and after 10.11, so we adjust these tests only for 10.11.
+
+#if defined(QT_SECURETRANSPORT)
+ using OSVersion = QOperatingSystemVersion;
+ const bool testWorks = OSVersion::current() < OSVersion::OSXElCapitan
+ || OSVersion::current() > OSVersion::OSXElCapitan;
+#else
+ const bool testWorks = true;
+#endif
+
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
@@ -1190,14 +1204,14 @@ void tst_QSslSocket::protocolServerSide_data()
#endif
#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false;
- QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true;
+ QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << testWorks;
QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a
// numerical IP, so OpenSSL will send a SSL 2 handshake
#elif !defined(OPENSSL_NO_SSL3)
- QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true;
+ QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << testWorks;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)