Improve qhostinfo autotest on HPUX 11i

Several test functions use IPv6 reverse lookups, which evidently don't
work on HPUX 11i, but only one of these tests was skipped on that
platform and the others presumably fail.

This commit also removes the commented-out test data and makes it easier
to put some useful test data back. QTBUG-22287 records the fact that no
real IPv6 hostnames are currently used in the reverseLookup test.

Change-Id: Iff1ed1b725492bcc28ca4cb5f8e2dc106887c0b4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Jason McDonald 2011-10-24 16:26:50 +10:00 committed by Qt by Nokia
parent c0fb09465b
commit c7dd882b7a

View File

@ -214,7 +214,8 @@ void tst_QHostInfo::initTestCase()
ipv6Available = true;
}
#if !defined(QT_NO_GETADDRINFO)
// HP-UX 11i does not support IPv6 reverse lookups.
#if !defined(QT_NO_GETADDRINFO) || !(defined(Q_OS_HPUX) && defined(__ia64))
// check if the system getaddrinfo can do IPv6 lookups
struct addrinfo hint, *result = 0;
memset(&hint, 0, sizeof hint);
@ -355,13 +356,11 @@ void tst_QHostInfo::reverseLookup_data()
QTest::addColumn<QString>("address");
QTest::addColumn<QStringList>("hostNames");
QTest::addColumn<int>("err");
QTest::addColumn<bool>("ipv6");
QTest::newRow("trolltech.com") << QString("62.70.27.69") << QStringList(QString("diverse.troll.no")) << 0;
// ### Use internal DNS instead. Discussed with Andreas.
//QTest::newRow("classical.hexago.com") << QString("2001:5c0:0:2::24") << QStringList(QString("classical.hexago.com")) << 0;
QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 0;
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1;
QTest::newRow("trolltech.com") << QString("62.70.27.69") << QStringList(QString("diverse.troll.no")) << 0 << false;
QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 0 << false;
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
}
void tst_QHostInfo::reverseLookup()
@ -369,14 +368,11 @@ void tst_QHostInfo::reverseLookup()
QFETCH(QString, address);
QFETCH(QStringList, hostNames);
QFETCH(int, err);
QFETCH(bool, ipv6);
if (!ipv6LookupsAvailable && hostNames.contains("classical.hexago.com")) {
QSKIP("IPv6 lookups are not supported on this platform");
if (ipv6 && !ipv6LookupsAvailable) {
QSKIP("IPv6 reverse lookups are not supported on this platform");
}
#if defined(Q_OS_HPUX) && defined(__ia64)
if (hostNames.contains("classical.hexago.com"))
QSKIP("HP-UX 11i does not support IPv6 reverse lookups.");
#endif
QHostInfo info = QHostInfo::fromName(address);