tst_QUdpSocket: fix linkLocalIPv4 test

I broke it in commit 4da2dda2aa. It wasn't
flaky or anything: it was plain broken and would never pass. That
indicates no node in the CI has an IPv4 link-local address (and
apparently neither did I at the time).

Change-Id: Ifb5969bf206e4cd7b14efffd14fb62176546916e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2017-11-28 14:59:12 -08:00
parent 637e8ebcc3
commit 81a88639ac

View File

@ -1723,7 +1723,7 @@ void tst_QUdpSocket::linkLocalIPv4()
foreach (QNetworkAddressEntry addr, iface.addressEntries()) {
if (addr.ip().isInSubnet(localMask, 16)) {
addresses << addr.ip();
qDebug() << addr.ip();
qDebug() << "Found IPv4 link local address" << addr.ip();
}
}
}
@ -1748,7 +1748,6 @@ void tst_QUdpSocket::linkLocalIPv4()
QVERIFY(s->writeDatagram(testData, s->localAddress(), neutral.localPort()));
QVERIFY2(neutral.waitForReadyRead(10000), QtNetworkSettings::msgSocketError(neutral).constData());
QVERIFY2(s->waitForReadyRead(10000), QtNetworkSettings::msgSocketError(*s).constData());
QNetworkDatagram dgram = neutral.receiveDatagram(testData.length() * 2);
QVERIFY(dgram.isValid());
QCOMPARE(dgram.senderAddress(), s->localAddress());
@ -1771,7 +1770,7 @@ void tst_QUdpSocket::linkLocalIPv4()
}
QVERIFY(neutral.writeDatagram(dgram.makeReply(testData)));
QVERIFY2(s->waitForReadyRead(10000), QtNetworkSettings::msgSocketError(*s).constData());
dgram = s->receiveDatagram(testData.length() * 2);
QVERIFY(dgram.isValid());
QCOMPARE(dgram.data(), testData);