summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-10-12 14:00:56 +0100
committerQt by Nokia <qt-info@nokia.com>2011-10-12 16:17:45 +0200
commit450962be95cbde7c1b23aaa455bf7238e7b2513f (patch)
tree25592f2b3406698b881f218685bd1d45db9a033d
parenteba17baaed035e1e0848c71b485e4fede1ad398f (diff)
Fix platformsocketengine test failures
The platformsocketengine autotest uses the native socket engine directly rather than through QAbstractSocket. The bind tests were failing because the autotest was creating a socket with IPv4 (AF_INET) and then binding with QHostAddress::Any (AF_INET6). A linux kernel update caused this to start failing on the test machines. Change-Id: Iea62f3d56dbfb35fcb952dcf00313578eb2bd764 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index f3aae4b09e..4638e33ee0 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -307,7 +307,7 @@ void tst_PlatformSocketEngine::broadcastTest()
PLATFORMSOCKETENGINE broadcastSocket;
// Initialize a regular Udp socket
- QVERIFY(broadcastSocket.initialize(QAbstractSocket::UdpSocket));
+ QVERIFY(broadcastSocket.initialize(QAbstractSocket::UdpSocket, QAbstractSocket::AnyIPProtocol));
// Bind to any port on all interfaces
QVERIFY(broadcastSocket.bind(QHostAddress::Any, 0));
@@ -559,18 +559,31 @@ void tst_PlatformSocketEngine::bind()
#if !defined Q_OS_WIN
PLATFORMSOCKETENGINE binder;
QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
- QVERIFY(!binder.bind(QHostAddress::Any, 82));
+ QVERIFY(!binder.bind(QHostAddress::AnyIPv4, 82));
QVERIFY(binder.error() == QAbstractSocket::SocketAccessError);
#endif
PLATFORMSOCKETENGINE binder2;
QVERIFY(binder2.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
- QVERIFY(binder2.bind(QHostAddress::Any, 31180));
+ QVERIFY(binder2.bind(QHostAddress::AnyIPv4, 31180));
PLATFORMSOCKETENGINE binder3;
QVERIFY(binder3.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
- QVERIFY(!binder3.bind(QHostAddress::Any, 31180));
+ QVERIFY(!binder3.bind(QHostAddress::AnyIPv4, 31180));
QVERIFY(binder3.error() == QAbstractSocket::AddressInUseError);
+
+ PLATFORMSOCKETENGINE binder4;
+ QVERIFY(binder4.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
+ QVERIFY(binder4.bind(QHostAddress::AnyIPv6, 31180));
+
+ PLATFORMSOCKETENGINE binder5;
+ QVERIFY(binder5.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
+ QVERIFY(!binder5.bind(QHostAddress::AnyIPv6, 31180));
+ QVERIFY(binder5.error() == QAbstractSocket::AddressInUseError);
+
+ PLATFORMSOCKETENGINE binder6;
+ QVERIFY(binder6.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::AnyIPProtocol));
+ QVERIFY(binder6.bind(QHostAddress::Any, 31181));
}
//---------------------------------------------------------------------------