diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-11-28 11:28:59 -0800 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-12-05 21:59:35 +0000 |
commit | 1853aeb50a41062d8585065c97edd3e58db1fba7 (patch) | |
tree | e397886e00714cf3fe42470c63fb0704612be6d2 | |
parent | 3d175cd5411bf54fdf94410ef9b144cb293741fd (diff) |
tst_QUdpSocket: remove Bearer portions of the test
Test fails to start on FreeBSD:
FAIL! : tst_QUdpSocket::initTestCase() 'networkSession->waitForOpened(30000)' returned FALSE. ()
Loc: [/usr/home/tjmaciei/src/qt/qt5/qtbase/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp(234)]
This commit is basically a revert of the Qt 4.8 commit
a951fb79139498774d021759d0466b4b2ff50e68. FORCE_SESSION was only used by
manual testing, as the commit message said
> 8. For manual testing, added the FORCE_SESSION macro to test behaviour
> of UDP sockets when they have an explicit network session associated
So I doubt it has been tested recently.
Change-Id: Ifb5969bf206e4cd7b14efffd14fb569ebf53497b
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r-- | tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 0f46caa7c2..6dff9f3420 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -47,12 +47,6 @@ #include "../../../network-settings.h" #include "emulationdetector.h" -#ifndef QT_NO_BEARERMANAGEMENT -#include <QtNetwork/qnetworkconfigmanager.h> -#include <QtNetwork/qnetworkconfiguration.h> -#include <QtNetwork/qnetworksession.h> -#endif - #if defined(Q_OS_LINUX) #define SHOULD_CHECK_SYSCALL_SUPPORT #include <netinet/in.h> @@ -130,11 +124,6 @@ private: bool m_skipUnsupportedIPv6Tests; QList<QHostAddress> allAddresses; -#ifndef QT_NO_BEARERMANAGEMENT - QNetworkConfigurationManager *netConfMan; - QNetworkConfiguration networkConfiguration; - QSharedPointer<QNetworkSession> networkSession; -#endif QUdpSocket *m_asyncSender; QUdpSocket *m_asyncReceiver; }; @@ -210,16 +199,6 @@ void tst_QUdpSocket::initTestCase_data() if (!newTestServer) QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); #endif - -#ifndef QT_NO_BEARERMANAGEMENT - netConfMan = new QNetworkConfigurationManager(this); - networkConfiguration = netConfMan->defaultConfiguration(); - networkSession = QSharedPointer<QNetworkSession>::create(networkConfiguration); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); - } -#endif } void tst_QUdpSocket::initTestCase() @@ -261,9 +240,6 @@ void tst_QUdpSocket::cleanup() void tst_QUdpSocket::constructing() { QUdpSocket socket; -#ifdef FORCE_SESSION - socket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(socket.isSequential()); QVERIFY(!socket.isOpen()); @@ -281,9 +257,6 @@ void tst_QUdpSocket::constructing() void tst_QUdpSocket::unconnectedServerAndClientTest() { QUdpSocket serverSocket; -#ifdef FORCE_SESSION - serverSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState"); @@ -296,9 +269,6 @@ void tst_QUdpSocket::unconnectedServerAndClientTest() QHostAddress serverAddress = makeNonAny(serverSocket.localAddress()); for (int i = 0; i < 3; ++i) { QUdpSocket clientSocket; -#ifdef FORCE_SESSION - clientSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QCOMPARE(int(clientSocket.writeDatagram(message[i], strlen(message[i]), serverAddress, serverSocket.localPort())), int(strlen(message[i]))); @@ -352,9 +322,6 @@ void tst_QUdpSocket::broadcasting() QSKIP("No interface can broadcast"); for (int i = 0; i < 4; ++i) { QUdpSocket serverSocket; -#ifdef FORCE_SESSION - serverSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(serverSocket.bind(QHostAddress(QHostAddress::AnyIPv4), 0), serverSocket.errorString().toLatin1().constData()); quint16 serverPort = serverSocket.localPort(); @@ -363,9 +330,6 @@ void tst_QUdpSocket::broadcasting() connect(&serverSocket, SIGNAL(readyRead()), SLOT(empty_readyReadSlot())); QUdpSocket broadcastSocket; -#ifdef FORCE_SESSION - broadcastSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif broadcastSocket.bind(QHostAddress(QHostAddress::AnyIPv4), 0); for (int j = 0; j < 10; ++j) { @@ -444,10 +408,6 @@ void tst_QUdpSocket::loop() QUdpSocket peter; QUdpSocket paul; -#ifdef FORCE_SESSION - peter.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - paul.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // make sure we bind to IPv4 QHostAddress localhost = QHostAddress::LocalHost; @@ -518,10 +478,6 @@ void tst_QUdpSocket::ipv6Loop() QUdpSocket peter; QUdpSocket paul; -#ifdef FORCE_SESSION - peter.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - paul.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif int peterPort; int paulPort; @@ -745,10 +701,6 @@ void tst_QUdpSocket::connectToHost() { QUdpSocket socket1; QUdpSocket socket2; -#ifdef FORCE_SESSION - socket1.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - socket2.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(socket1.bind(), socket1.errorString().toLatin1().constData()); @@ -763,11 +715,6 @@ void tst_QUdpSocket::bindAndConnectToHost() QUdpSocket socket1; QUdpSocket socket2; QUdpSocket dummysocket; -#ifdef FORCE_SESSION - socket1.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - socket2.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - dummysocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // we use the dummy socket to use up a file descriptor dummysocket.bind(); @@ -791,16 +738,10 @@ void tst_QUdpSocket::bindAndConnectToHost() void tst_QUdpSocket::pendingDatagramSize() { QUdpSocket server; -#ifdef FORCE_SESSION - server.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(server.bind(), server.errorString().toLatin1().constData()); QHostAddress serverAddress = makeNonAny(server.localAddress()); QUdpSocket client; -#ifdef FORCE_SESSION - client.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(client.writeDatagram("this is", 7, serverAddress, server.localPort()) == 7); QVERIFY(client.writeDatagram(0, 0, serverAddress, server.localPort()) == 0); QVERIFY(client.writeDatagram("3 messages", 10, serverAddress, server.localPort()) == 10); @@ -839,16 +780,10 @@ void tst_QUdpSocket::pendingDatagramSize() void tst_QUdpSocket::writeDatagram() { QUdpSocket server; -#ifdef FORCE_SESSION - server.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(server.bind(), server.errorString().toLatin1().constData()); QHostAddress serverAddress = makeNonAny(server.localAddress()); QUdpSocket client; -#ifdef FORCE_SESSION - client.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); @@ -886,16 +821,10 @@ void tst_QUdpSocket::performance() QByteArray arr(8192, '@'); QUdpSocket server; -#ifdef FORCE_SESSION - server.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(server.bind(), server.errorString().toLatin1().constData()); QHostAddress serverAddress = makeNonAny(server.localAddress()); QUdpSocket client; -#ifdef FORCE_SESSION - client.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif client.connectToHost(serverAddress, server.localPort()); QVERIFY(client.waitForConnected(10000)); @@ -932,14 +861,8 @@ void tst_QUdpSocket::bindMode() } QUdpSocket socket; -#ifdef FORCE_SESSION - socket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY2(socket.bind(), socket.errorString().toLatin1().constData()); QUdpSocket socket2; -#ifdef FORCE_SESSION - socket2.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(!socket2.bind(socket.localPort())); #if defined(Q_OS_UNIX) QVERIFY(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint)); @@ -991,9 +914,6 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer() quint16 peerPort = 33533 + int(bind); QUdpSocket sUdp; -#ifdef FORCE_SESSION - sUdp.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QSignalSpy sReadyReadSpy(&sUdp, SIGNAL(readyRead())); if (bind) QVERIFY(sUdp.bind()); @@ -1026,9 +946,6 @@ void tst_QUdpSocket::writeToNonExistingPeer() qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); QUdpSocket sConnected; -#ifdef FORCE_SESSION - sConnected.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QSignalSpy sConnectedReadyReadSpy(&sConnected, SIGNAL(readyRead())); QSignalSpy sConnectedErrorSpy(&sConnected, SIGNAL(error(QAbstractSocket::SocketError))); sConnected.connectToHost(peerAddress, peerPort, QIODevice::ReadWrite); @@ -1198,18 +1115,12 @@ void tst_QUdpSocket::zeroLengthDatagram() return; QUdpSocket receiver; -#ifdef FORCE_SESSION - receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(receiver.bind()); QVERIFY(!receiver.waitForReadyRead(100)); QVERIFY(!receiver.hasPendingDatagrams()); QUdpSocket sender; -#ifdef FORCE_SESSION - sender.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QCOMPARE(sender.writeDatagram(QNetworkDatagram(QByteArray(), QHostAddress::LocalHost, receiver.localPort())), qint64(0)); QVERIFY2(receiver.waitForReadyRead(1000), QtNetworkSettings::msgSocketError(receiver).constData()); @@ -1262,9 +1173,6 @@ void tst_QUdpSocket::multicastTtlOption() } QUdpSocket udpSocket; -#ifdef FORCE_SESSION - udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // bind, but ignore the result, we are only interested in initializing the socket (void) udpSocket.bind(bindAddress, 0); udpSocket.setSocketOption(QUdpSocket::MulticastTtlOption, ttl); @@ -1315,9 +1223,6 @@ void tst_QUdpSocket::multicastLoopbackOption() } QUdpSocket udpSocket; -#ifdef FORCE_SESSION - udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // bind, but ignore the result, we are only interested in initializing the socket (void) udpSocket.bind(bindAddress, 0); udpSocket.setSocketOption(QUdpSocket::MulticastLoopbackOption, loopback); @@ -1341,9 +1246,6 @@ void tst_QUdpSocket::multicastJoinBeforeBind() QFETCH(QHostAddress, groupAddress); QUdpSocket udpSocket; -#ifdef FORCE_SESSION - udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // cannot join group before binding QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::joinMulticastGroup() called on a QUdpSocket when not in QUdpSocket::BoundState"); QVERIFY(!udpSocket.joinMulticastGroup(groupAddress)); @@ -1376,9 +1278,6 @@ void tst_QUdpSocket::multicastLeaveAfterClose() } QUdpSocket udpSocket; -#ifdef FORCE_SESSION - udpSocket.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QHostAddress bindAddress = QHostAddress::AnyIPv4; if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) bindAddress = QHostAddress::AnyIPv6; @@ -1487,9 +1386,6 @@ void tst_QUdpSocket::multicast() } QUdpSocket receiver; -#ifdef FORCE_SESSION - receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif // bind first, then verify that we can join the multicast group QVERIFY2(receiver.bind(bindAddress, 0) == bindResult, @@ -1515,9 +1411,6 @@ void tst_QUdpSocket::multicast() << QByteArray("cdef"); QUdpSocket sender; -#ifdef FORCE_SESSION - sender.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif sender.bind(); foreach (const QByteArray &datagram, datagrams) { QCOMPARE(int(sender.writeDatagram(datagram, groupAddress, receiver.localPort())), @@ -1563,9 +1456,6 @@ void tst_QUdpSocket::echo() QHostAddress remote = info.addresses().first(); QUdpSocket sock; -#ifdef FORCE_SESSION - sock.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif if (connect) { sock.connectToHost(remote, 7); QVERIFY(sock.waitForConnected(10000)); @@ -1785,10 +1675,6 @@ void tst_QUdpSocket::readyRead() char buf[1]; QUdpSocket sender, receiver; -#ifdef FORCE_SESSION - sender.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(receiver.bind(QHostAddress(QHostAddress::AnyIPv4), 0)); quint16 port = receiver.localPort(); @@ -1839,10 +1725,6 @@ void tst_QUdpSocket::readyReadForEmptyDatagram() return; QUdpSocket sender, receiver; -#ifdef FORCE_SESSION - sender.setProperty("_q_networksession", QVariant::fromValue(networkSession)); - receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(receiver.bind(QHostAddress(QHostAddress::AnyIPv4), 0)); quint16 port = receiver.localPort(); @@ -1891,10 +1773,6 @@ void tst_QUdpSocket::asyncReadDatagram() m_asyncSender = new QUdpSocket; m_asyncReceiver = new QUdpSocket; -#ifdef FORCE_SESSION - m_asyncSender->setProperty("_q_networksession", QVariant::fromValue(networkSession)); - m_asyncReceiver->setProperty("_q_networksession", QVariant::fromValue(networkSession)); -#endif QVERIFY(m_asyncReceiver->bind(QHostAddress(QHostAddress::AnyIPv4), 0)); quint16 port = m_asyncReceiver->localPort(); |