Skip to content

Commit

Permalink
tst_QSslSocket_onDemandCertificates_member: Blacklist Windows & debug
Browse files Browse the repository at this point in the history
The test function occasionally can fail on CI/Windows, when a
certificate update on www.qt.io requires installing a new root
certificate on the test VM.

This patch blacklists the test class (which has only one test function)
on Windows. It adds diagnostic output, so future failure reasons can
be established from CI artifacts.

Pick-to: 6.5
Task-number: QTBUG-63481
Change-Id: If686d006f379fe6dbfb0d11d80b8455f72fdbb09
Reviewed-by: Mårten Nordheim <[email protected]>
  • Loading branch information
ASpoerl authored and Morten242 committed Mar 30, 2023
1 parent fc319a8 commit 7350088
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# QTBUG-101274
[onDemandRootCertLoadingMemberMethods:WithoutProxy]
qnx ci
# [onDemandRootCertLoadingMemberMethods:WithoutProxy]
# qnx ci

# QTBUG-63481
[onDemandRootCertLoadingMemberMethods]
*
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ static bool waitForEncrypted(QSslSocket *socket)

void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMethods()
{
#define ERR(socket) socket->errorString().toLatin1()
const QString host("www.qt.io");

// not using any root certs -> should not work
Expand All @@ -203,13 +204,13 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
sslConfig.setCaCertificates(QList<QSslCertificate>());
socket2->setSslConfiguration(sslConfig);
socket2->connectToHostEncrypted(host, 443);
QVERIFY(!waitForEncrypted(socket2.data()));
QVERIFY2(!waitForEncrypted(socket2.data()), ERR(socket2));

// default: using on demand loading -> should work
QSslSocketPtr socket = newSocket();
this->socket = socket.data();
socket->connectToHostEncrypted(host, 443);
QVERIFY2(waitForEncrypted(socket.data()), qPrintable(socket->errorString()));
QVERIFY2(waitForEncrypted(socket.data()), ERR(socket));

// not using any root certs again -> should not work
QSslSocketPtr socket3 = newSocket();
Expand All @@ -218,7 +219,7 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
sslConfig.setCaCertificates(QList<QSslCertificate>());
socket3->setSslConfiguration(sslConfig);
socket3->connectToHostEncrypted(host, 443);
QVERIFY(!waitForEncrypted(socket3.data()));
QVERIFY2(!waitForEncrypted(socket3.data()), ERR(socket3));

// setting empty SSL configuration explicitly -> depends on on-demand loading
QSslSocketPtr socket4 = newSocket();
Expand All @@ -229,16 +230,20 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
#ifdef QT_BUILD_INTERNAL
const bool works = QSslSocketPrivate::rootCertOnDemandLoadingSupported();
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
QCOMPARE(works, true);
QVERIFY2(works, ERR(socket4));
#elif defined(Q_OS_MAC)
QCOMPARE(works, false);
QVERIFY2(!works, ERR(socket4));
#endif // other platforms: undecided.
// When we *allow* on-demand loading, we enable it by default; so, on Unix,
// it will work without setting any certificates. Otherwise, the configuration
// contains an empty set of certificates, so on-demand loading shall fail.
QCOMPARE(waitForEncrypted(socket4.data()), works);
const bool result = waitForEncrypted(socket4.data());
if (result != works)
qDebug() << socket4->errorString();
QCOMPARE(waitForEncrypted(socket4.data()), works);
#endif // QT_BUILD_INTERNAL
}
#undef ERR

#endif // QT_NO_OPENSSL

Expand Down

0 comments on commit 7350088

Please sign in to comment.