From 450962be95cbde7c1b23aaa455bf7238e7b2513f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 12 Oct 2011 14:00:56 +0100 Subject: 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 Reviewed-by: Sergio Ahumada --- .../tst_platformsocketengine.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tests/auto/network/socket/platformsocketengine') 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)); } //--------------------------------------------------------------------------- -- cgit v1.2.3