Make tst_QUdpSocket::lincLocalIPv6 less sadistic

It fails on CI (Windows 10). Given our qabstractsocket disables
read notifications/stops emitting readyRead if it already has pending data
(unbuffered, aka UDP socket type) - make sure we do not suffer from this.
The change does not affect the test's logic (unless the logic was to fail),
it just makes it more fail-proof.

Change-Id: I6c9b7ded20478f675260872a2a7032b4f356f197
Fixes: QTBUG-73884
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d3eb9e944a)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Timur Pocheptsov 2019-02-20 13:30:52 +01:00 committed by Jani Heikkinen
parent 96f6cab22c
commit 01f5d41a40

View File

@ -1640,15 +1640,14 @@ void tst_QUdpSocket::linkLocalIPv6()
sockets << s;
}
QByteArray testData("hello");
foreach (QUdpSocket *s, sockets) {
QUdpSocket neutral;
QVERIFY(neutral.bind(QHostAddress(QHostAddress::AnyIPv6)));
QSignalSpy neutralReadSpy(&neutral, SIGNAL(readyRead()));
QByteArray testData("hello");
foreach (QUdpSocket *s, sockets) {
QSignalSpy spy(s, SIGNAL(readyRead()));
neutralReadSpy.clear();
QVERIFY(s->writeDatagram(testData, s->localAddress(), neutral.localPort()));
QTRY_VERIFY(neutralReadSpy.count() > 0); //note may need to accept a firewall prompt