Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I21664d8d92b27c26c64789fc08d0ec7b8988456a Reviewed-on: http://codereview.qt-project.org/5941 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
fe90725ced
commit
9d2ff58f36
@ -97,8 +97,10 @@ private slots:
|
||||
void proxy2();
|
||||
void proxy3();
|
||||
void postAuthNtlm();
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void proxyAndSsl();
|
||||
void cachingProxyAndSsl();
|
||||
#endif
|
||||
void reconnect();
|
||||
void setSocket();
|
||||
void unexpectedRemoteClose();
|
||||
@ -1357,11 +1359,9 @@ void tst_QHttp::postAuthNtlm()
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
};
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void tst_QHttp::proxyAndSsl()
|
||||
{
|
||||
#ifdef QT_NO_OPENSSL
|
||||
QSKIP("No OpenSSL support in this platform", SkipAll);
|
||||
#else
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy)
|
||||
return;
|
||||
@ -1388,14 +1388,12 @@ void tst_QHttp::proxyAndSsl()
|
||||
QHttpResponseHeader header = http.lastResponse();
|
||||
QVERIFY(header.isValid());
|
||||
QVERIFY(header.statusCode() < 400); // Should be 200, but as long as it's not an error, we're happy
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void tst_QHttp::cachingProxyAndSsl()
|
||||
{
|
||||
#ifdef QT_NO_OPENSSL
|
||||
QSKIP("No OpenSSL support in this platform", SkipAll);
|
||||
#else
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy)
|
||||
return;
|
||||
@ -1420,8 +1418,8 @@ void tst_QHttp::cachingProxyAndSsl()
|
||||
|
||||
QHttpResponseHeader header = http.lastResponse();
|
||||
QVERIFY(!header.isValid());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QHttp::emptyBodyInReply()
|
||||
{
|
||||
|
@ -54,8 +54,10 @@ private slots:
|
||||
void setCookiesFromUrl();
|
||||
void cookiesForUrl_data();
|
||||
void cookiesForUrl();
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
void effectiveTLDs_data();
|
||||
void effectiveTLDs();
|
||||
#endif
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -362,6 +364,8 @@ void tst_QNetworkCookieJar::cookiesForUrl()
|
||||
QCOMPARE(result, expectedResult);
|
||||
}
|
||||
|
||||
// This test requires private API.
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
void tst_QNetworkCookieJar::effectiveTLDs_data()
|
||||
{
|
||||
QTest::addColumn<QString>("domain");
|
||||
@ -433,13 +437,11 @@ void tst_QNetworkCookieJar::effectiveTLDs_data()
|
||||
|
||||
void tst_QNetworkCookieJar::effectiveTLDs()
|
||||
{
|
||||
#ifndef QT_BUILD_INTERNAL
|
||||
QSKIP("Test requires private API", SkipAll);
|
||||
#endif
|
||||
QFETCH(QString, domain);
|
||||
QFETCH(bool, isTLD);
|
||||
QCOMPARE(qIsEffectiveTLD(domain), isTLD);
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QNetworkCookieJar)
|
||||
#include "tst_qnetworkcookiejar.moc"
|
||||
|
@ -262,8 +262,10 @@ private Q_SLOTS:
|
||||
void ioPutToFileFromSocket();
|
||||
void ioPutToFileFromLocalSocket_data();
|
||||
void ioPutToFileFromLocalSocket();
|
||||
#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
|
||||
void ioPutToFileFromProcess_data();
|
||||
void ioPutToFileFromProcess();
|
||||
#endif
|
||||
void ioPutToFtpFromFile_data();
|
||||
void ioPutToFtpFromFile();
|
||||
void ioPutToHttpFromFile_data();
|
||||
@ -3744,6 +3746,8 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
|
||||
QCOMPARE(contents, data);
|
||||
}
|
||||
|
||||
// Currently no stdin/out supported for Windows CE.
|
||||
#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
|
||||
void tst_QNetworkReply::ioPutToFileFromProcess_data()
|
||||
{
|
||||
putToFile_data();
|
||||
@ -3751,19 +3755,12 @@ void tst_QNetworkReply::ioPutToFileFromProcess_data()
|
||||
|
||||
void tst_QNetworkReply::ioPutToFileFromProcess()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
|
||||
#else
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (qstrcmp(QTest::currentDataTag(), "small") == 0)
|
||||
QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, "
|
||||
"so this test fails. Disabled on Windows", SkipSingle);
|
||||
#endif
|
||||
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
QFile file(testFileName);
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(file.fileName());
|
||||
@ -3790,9 +3787,8 @@ void tst_QNetworkReply::ioPutToFileFromProcess()
|
||||
QCOMPARE(file.size(), qint64(data.size()));
|
||||
QByteArray contents = file.readAll();
|
||||
QCOMPARE(contents, data);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QNetworkReply::ioPutToFtpFromFile_data()
|
||||
{
|
||||
|
@ -85,7 +85,9 @@ private slots:
|
||||
void simpleConnectToIMAP();
|
||||
void udpLoopbackTest();
|
||||
void udpIPv6LoopbackTest();
|
||||
#ifndef Q_OS_AIX
|
||||
void broadcastTest();
|
||||
#endif
|
||||
void serverTest();
|
||||
void udpLoopbackPerformance();
|
||||
void tcpLoopbackPerformance();
|
||||
@ -95,7 +97,9 @@ private slots:
|
||||
void setSocketDescriptor();
|
||||
void invalidSend();
|
||||
void receiveUrgentData();
|
||||
#ifndef Q_OS_WIN
|
||||
void tooManySockets();
|
||||
#endif
|
||||
};
|
||||
|
||||
tst_PlatformSocketEngine::tst_PlatformSocketEngine()
|
||||
@ -296,11 +300,10 @@ void tst_PlatformSocketEngine::udpIPv6LoopbackTest()
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef Q_OS_AIX
|
||||
void tst_PlatformSocketEngine::broadcastTest()
|
||||
{
|
||||
#ifdef Q_OS_AIX
|
||||
QSKIP("Broadcast does not work on darko", SkipAll);
|
||||
#endif
|
||||
PLATFORMSOCKETENGINE broadcastSocket;
|
||||
|
||||
// Initialize a regular Udp socket
|
||||
@ -335,8 +338,8 @@ void tst_PlatformSocketEngine::broadcastTest()
|
||||
QVERIFY(broadcastSocket.readDatagram(response.data(), response.size())
|
||||
== response.size());
|
||||
QCOMPARE(response, trollMessage);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void tst_PlatformSocketEngine::serverTest()
|
||||
@ -529,11 +532,11 @@ void tst_PlatformSocketEngine::readWriteBufferSize()
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Certain windows machines suffocate and spend too much time in this test.
|
||||
#ifndef Q_OS_WIN
|
||||
void tst_PlatformSocketEngine::tooManySockets()
|
||||
{
|
||||
#if defined Q_OS_WIN
|
||||
QSKIP("Certain windows machines suffocate and spend too much time in this test.", SkipAll);
|
||||
#endif
|
||||
QList<PLATFORMSOCKETENGINE *> sockets;
|
||||
PLATFORMSOCKETENGINE *socketLayer = 0;
|
||||
for (;;) {
|
||||
@ -548,6 +551,7 @@ void tst_PlatformSocketEngine::tooManySockets()
|
||||
|
||||
qDeleteAll(sockets);
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void tst_PlatformSocketEngine::bind()
|
||||
|
@ -92,8 +92,10 @@ private slots:
|
||||
void threadedConnection_data();
|
||||
void threadedConnection();
|
||||
|
||||
#ifndef QT_NO_PROCESS
|
||||
void processConnection_data();
|
||||
void processConnection();
|
||||
#endif
|
||||
|
||||
void longPath();
|
||||
void waitForDisconnect();
|
||||
@ -739,6 +741,7 @@ void tst_QLocalSocket::threadedConnection()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_PROCESS
|
||||
void tst_QLocalSocket::processConnection_data()
|
||||
{
|
||||
QTest::addColumn<int>("processes");
|
||||
@ -755,9 +758,6 @@ void tst_QLocalSocket::processConnection_data()
|
||||
*/
|
||||
void tst_QLocalSocket::processConnection()
|
||||
{
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
QFETCH(int, processes);
|
||||
QStringList serverArguments = QStringList() << SRCDIR "lackey/scripts/server.js" << QString::number(processes);
|
||||
QProcess producer;
|
||||
@ -789,8 +789,8 @@ void tst_QLocalSocket::processConnection()
|
||||
delete consumer;
|
||||
}
|
||||
producer.waitForFinished(15000);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QLocalSocket::longPath()
|
||||
{
|
||||
|
@ -105,7 +105,9 @@ private slots:
|
||||
void waitForConnectionTest();
|
||||
void setSocketDescriptor();
|
||||
void listenWhileListening();
|
||||
#ifndef QT_NO_PROCESS
|
||||
void addressReusable();
|
||||
#endif
|
||||
void setNewSocketDescriptorBlocking();
|
||||
void invalidProxy_data();
|
||||
void invalidProxy();
|
||||
@ -525,12 +527,9 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef QT_NO_PROCESS
|
||||
void tst_QTcpServer::addressReusable()
|
||||
{
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy) {
|
||||
QFETCH_GLOBAL(int, proxyType);
|
||||
@ -567,8 +566,8 @@ void tst_QTcpServer::addressReusable()
|
||||
|
||||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress::LocalHost, 49199));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QTcpServer::setNewSocketDescriptorBlocking()
|
||||
{
|
||||
|
@ -176,12 +176,16 @@ private slots:
|
||||
void socketsInThreads();
|
||||
void waitForReadyReadInASlot();
|
||||
void remoteCloseError();
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void openMessageBoxInErrorSlot();
|
||||
#endif
|
||||
#ifndef Q_OS_WIN
|
||||
void connectToLocalHostNoService();
|
||||
#endif
|
||||
void waitForConnectedInHostLookupSlot();
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_VXWORKS)
|
||||
void waitForConnectedInHostLookupSlot2();
|
||||
#endif
|
||||
void readyReadSignalsAfterWaitForReadyRead();
|
||||
#ifdef Q_OS_LINUX
|
||||
void linuxKernelBugLocalSocket();
|
||||
@ -192,7 +196,9 @@ private slots:
|
||||
void connectionRefused();
|
||||
void suddenRemoteDisconnect_data();
|
||||
void suddenRemoteDisconnect();
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void connectToMultiIP();
|
||||
#endif
|
||||
void moveToThread0();
|
||||
void increaseReadBufferSize();
|
||||
void taskQtBug5799ConnectionErrorWaitForConnected();
|
||||
@ -218,7 +224,9 @@ protected slots:
|
||||
void downloadBigFileSlot();
|
||||
void recursiveReadyReadSlot();
|
||||
void waitForReadyReadInASlotSlot();
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void messageBoxSlot();
|
||||
#endif
|
||||
void hostLookupSlot();
|
||||
void abortiveClose_abortSlot();
|
||||
void remoteCloseErrorSlot();
|
||||
@ -1759,9 +1767,10 @@ void tst_QTcpSocket::remoteCloseErrorSlot()
|
||||
static_cast<QTcpSocket *>(sender())->close();
|
||||
}
|
||||
|
||||
// VxWorks has no default gui
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void tst_QTcpSocket::messageBoxSlot()
|
||||
{
|
||||
#if !defined(Q_OS_VXWORKS) // no gui
|
||||
QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
|
||||
socket->deleteLater();
|
||||
QMessageBox box;
|
||||
@ -1772,14 +1781,15 @@ void tst_QTcpSocket::messageBoxSlot()
|
||||
|
||||
// Fire a non-0 singleshot to leave time for the delete
|
||||
QTimer::singleShot(250, this, SLOT(exitLoopSlot()));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// VxWorks has no default gui
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void tst_QTcpSocket::openMessageBoxInErrorSlot()
|
||||
{
|
||||
#if defined(Q_OS_VXWORKS) // no gui
|
||||
QSKIP("no default gui available on VxWorks", SkipAll);
|
||||
#else
|
||||
QTcpSocket *socket = newSocket();
|
||||
QPointer<QTcpSocket> p(socket);
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(messageBoxSlot()));
|
||||
@ -1787,8 +1797,8 @@ void tst_QTcpSocket::openMessageBoxInErrorSlot()
|
||||
socket->connectToHost("hostnotfoundhostnotfound.troll.no", 9999); // Host not found, fyi
|
||||
enterLoop(30);
|
||||
QVERIFY(!p);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
#ifndef Q_OS_WIN
|
||||
@ -1909,12 +1919,10 @@ public slots:
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_VXWORKS)
|
||||
void tst_QTcpSocket::waitForConnectedInHostLookupSlot2()
|
||||
{
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_VXWORKS)
|
||||
QSKIP("waitForConnectedInHostLookupSlot2 is not run on Windows and VxWorks", SkipAll);
|
||||
#else
|
||||
|
||||
Foo foo;
|
||||
QPushButton top("Go", 0);
|
||||
top.show();
|
||||
@ -1929,8 +1937,8 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot2()
|
||||
|
||||
QVERIFY(foo.attemptedToConnect);
|
||||
QCOMPARE(foo.count, 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
|
||||
@ -2212,13 +2220,13 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// VxSim in standard config doesn't even run a DNS resolver.
|
||||
#ifndef Q_OS_VXWORKS
|
||||
void tst_QTcpSocket::connectToMultiIP()
|
||||
{
|
||||
QSKIP("TODO: setup DNS in the new network", SkipAll);
|
||||
|
||||
#if defined(Q_OS_VXWORKS)
|
||||
QSKIP("VxSim in standard config doesn't even run a DNS resolver", SkipAll);
|
||||
#else
|
||||
QFETCH_GLOBAL(bool, ssl);
|
||||
if (ssl)
|
||||
return;
|
||||
@ -2246,8 +2254,8 @@ void tst_QTcpSocket::connectToMultiIP()
|
||||
QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError);
|
||||
|
||||
delete socket;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void tst_QTcpSocket::moveToThread0()
|
||||
|
@ -85,7 +85,9 @@ public slots:
|
||||
private slots:
|
||||
void constructing();
|
||||
void unconnectedServerAndClientTest();
|
||||
#ifndef Q_OS_AIX
|
||||
void broadcasting();
|
||||
#endif
|
||||
void loop_data();
|
||||
void loop();
|
||||
void ipv6Loop_data();
|
||||
@ -100,8 +102,10 @@ private slots:
|
||||
void writeDatagramToNonExistingPeer();
|
||||
void writeToNonExistingPeer_data();
|
||||
void writeToNonExistingPeer();
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void outOfProcessConnectedClientServerTest();
|
||||
void outOfProcessUnconnectedClientServerTest();
|
||||
#endif
|
||||
void zeroLengthDatagram();
|
||||
void multicastTtlOption_data();
|
||||
void multicastTtlOption();
|
||||
@ -236,6 +240,7 @@ void tst_QUdpSocket::unconnectedServerAndClientTest()
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef Q_OS_AIX
|
||||
void tst_QUdpSocket::broadcasting()
|
||||
{
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
@ -245,9 +250,6 @@ void tst_QUdpSocket::broadcasting()
|
||||
QSKIP("With socks5 Broadcast is not supported.", SkipSingle);
|
||||
}
|
||||
}
|
||||
#ifdef Q_OS_AIX
|
||||
QSKIP("Broadcast does not work on darko", SkipAll);
|
||||
#endif
|
||||
const char *message[] = {"Yo mista", "", "Yo", "Wassap"};
|
||||
|
||||
QList<QHostAddress> broadcastAddresses;
|
||||
@ -308,6 +310,7 @@ void tst_QUdpSocket::broadcasting()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@ -790,15 +793,10 @@ void tst_QUdpSocket::writeToNonExistingPeer()
|
||||
QCOMPARE(int(sConnected.state()), int(QUdpSocket::ConnectedState));
|
||||
}
|
||||
|
||||
// This test depends on reading data from QProcess (not supported on Qt/WinCE).
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE).", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
|
||||
QProcess serverProcess;
|
||||
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
|
||||
QIODevice::ReadWrite | QIODevice::Text);
|
||||
@ -852,18 +850,13 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
|
||||
QVERIFY(clientProcess.waitForFinished());
|
||||
serverProcess.kill();
|
||||
QVERIFY(serverProcess.waitForFinished());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// This test depends on reading data from QProcess (not supported on Qt/WinCE).
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE).", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
|
||||
QProcess serverProcess;
|
||||
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
|
||||
QIODevice::ReadWrite | QIODevice::Text);
|
||||
@ -918,8 +911,8 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
|
||||
QVERIFY(clientProcess.waitForFinished());
|
||||
serverProcess.kill();
|
||||
QVERIFY(serverProcess.waitForFinished());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QUdpSocket::zeroLengthDatagram()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user