Fix failing setSocketDescriptor test in QTcpSocket
setSocketDescriptor fails because socket is in the wrong state. This is timing dependent, if qt-test-server is still in the DNS cache then the test failed. - clear the DNS cache to avoid the host lookup state being skipped. Change-Id: If159d514b1aa9b62a4834f6352d5e7b0a00a5724 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
parent
f7d11b216a
commit
9138890bd6
@ -583,6 +583,7 @@ void tst_QTcpSocket::setSocketDescriptor()
|
|||||||
QVERIFY(socket->setSocketDescriptor(sock, QTcpSocket::UnconnectedState));
|
QVERIFY(socket->setSocketDescriptor(sock, QTcpSocket::UnconnectedState));
|
||||||
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
||||||
|
|
||||||
|
qt_qhostinfo_clear_cache(); //avoid the HostLookupState being skipped due to address being in cache from previous test.
|
||||||
socket->connectToHost(QtNetworkSettings::serverName(), 143);
|
socket->connectToHost(QtNetworkSettings::serverName(), 143);
|
||||||
QCOMPARE(socket->state(), QTcpSocket::HostLookupState);
|
QCOMPARE(socket->state(), QTcpSocket::HostLookupState);
|
||||||
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
QCOMPARE(socket->socketDescriptor(), (int)sock);
|
||||||
|
Loading…
Reference in New Issue
Block a user