diff options
author | Jonas M. Gastal <jgastal@profusion.mobi> | 2012-05-04 10:18:39 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-21 13:00:27 +0200 |
commit | 2c790b251d9e3a30abe8ac63ab50f81c9c7631ce (patch) | |
tree | ee36d0b9fb5e51673314689f0f714a1d40854978 /tests/auto/network/socket/qtcpserver | |
parent | 63ed8bf07e11a7be236494608e91150e7f084028 (diff) |
Fallback to IPv4 when IPv6 is not present.
In tests when IPv6 is not present QSKIP IPv6 tests.
Task-number: QTBUG-23660
Change-Id: I02abc7322d765a93cbf661e53c76257f03dca73e
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tests/auto/network/socket/qtcpserver')
-rw-r--r-- | tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index f730f67c1e..1d9ba55797 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -255,6 +255,8 @@ void tst_QTcpServer::clientServerLoop() //---------------------------------------------------------------------------------- void tst_QTcpServer::ipv6Server() { + if (!QtNetworkSettings::hasIPv6()) + QSKIP("system doesn't support ipv6!"); //### need to enter the event loop for the server to get the connection ?? ( windows) QTcpServer server; if (!server.listen(QHostAddress::LocalHostIPv6, 8944)) { @@ -295,6 +297,8 @@ void tst_QTcpServer::dualStack() QFETCH_GLOBAL(bool, setProxy); if (setProxy) QSKIP("test server proxy doesn't support ipv6"); + if (!QtNetworkSettings::hasIPv6()) + QSKIP("system doesn't support ipv6!"); QFETCH(QHostAddress, bindAddress); QFETCH(bool, v4ok); QFETCH(bool, v6ok); @@ -328,6 +332,9 @@ void tst_QTcpServer::ipv6ServerMapped() QVERIFY(server.waitForNewConnection(5000)); delete server.nextPendingConnection(); + if (!QtNetworkSettings::hasIPv6()) + QSKIP("system doesn't support ipv6!"); + // let's try the mapped one in the nice format QTcpSocket client2; client2.connectToHost("::ffff:127.0.0.1", server.serverPort()); @@ -814,9 +821,13 @@ void tst_QTcpServer::serverAddress_data() QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4); //windows XP doesn't support dual stack sockets else #endif - QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::Any); + if (QtNetworkSettings::hasIPv6()) + QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::Any); + else + QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4); QTest::newRow("AnyIPv4") << QHostAddress(QHostAddress::AnyIPv4) << QHostAddress(QHostAddress::AnyIPv4); - QTest::newRow("AnyIPv6") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv6); + if (QtNetworkSettings::hasIPv6()) + QTest::newRow("AnyIPv6") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress& addr, QNetworkInterface::allAddresses()) { if (addr.isInSubnet(QHostAddress::parseSubnet("fe80::/10")) || addr.isInSubnet(QHostAddress::parseSubnet("169.254/16"))) @@ -850,6 +861,7 @@ void tst_QTcpServer::qtbug6305() return; QFETCH(QHostAddress, listenAddress); + QTcpServer server; QVERIFY2(server.listen(listenAddress), qPrintable(server.errorString())); |