From bc69fd1dfe30876909091d93a07640a498a24c0c Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Fri, 13 Feb 2015 13:01:57 +0200 Subject: Skip instead of entirely excluding tests with disabled features Properly QSKIP tests that use disabled QProcess and symlink features instead of excluding them silently by #ifdef. Other reason is that moc doesn't respect QT_NO_* defines in class definition which causes build issues on some platforms. Change-Id: I041020f7452f7d36c7ec8a5866a4ba5eb23d1f94 Reviewed-by: Oswald Buddenhagen Reviewed-by: Jason McDonald --- .../corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 8 ++++++-- tests/auto/corelib/io/qfile/tst_qfile.cpp | 17 ++++++++++++++--- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 10 ++++++---- .../auto/corelib/io/qtextstream/tst_qtextstream.cpp | 16 ++++++++++++++-- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 8 ++++---- .../kernel/qsharedmemory/test/tst_qsharedmemory.cpp | 18 ++++++++++++------ .../qsystemsemaphore/test/tst_qsystemsemaphore.cpp | 20 ++++++++++++++++---- .../qmimedatabase-cache/tst_qmimedatabase-cache.cpp | 4 ++++ tests/auto/corelib/plugin/quuid/tst_quuid.cpp | 8 ++++---- .../thread/qthreadstorage/tst_qthreadstorage.cpp | 8 +++++--- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 8 +++++++- .../access/qnetworkreply/tst_qnetworkreply.cpp | 12 ++++++++---- .../qnetworksession/test/tst_qnetworksession.cpp | 8 ++++---- .../network/socket/qlocalsocket/tst_qlocalsocket.cpp | 10 ++++++---- .../network/socket/qtcpserver/tst_qtcpserver.cpp | 8 ++++---- .../network/socket/qudpsocket/tst_qudpsocket.cpp | 14 ++++++++------ 16 files changed, 122 insertions(+), 55 deletions(-) diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index 01d23e8aa2..c96e933f0e 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -84,7 +84,7 @@ private slots: void codecForUtfText_data(); void codecForUtfText(); -#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) +#if defined(Q_OS_UNIX) void toLocal8Bit(); #endif @@ -2070,9 +2070,12 @@ void tst_QTextCodec::codecForUtfText() QVERIFY(codec == 0); } -#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS) +#if defined(Q_OS_UNIX) void tst_QTextCodec::toLocal8Bit() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess process; process.start("echo/echo"); QString string(QChar(0x410)); @@ -2082,6 +2085,7 @@ void tst_QTextCodec::toLocal8Bit() process.waitForFinished(); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); +#endif } #endif diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index a0609d67ac..98963108be 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -139,7 +139,7 @@ private slots: void readAll_data(); void readAll(); void readAllBuffer(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void readAllStdin(); void readLineStdin(); void readLineStdin_lineByLine(); @@ -868,9 +868,12 @@ void tst_QFile::readAllBuffer() QFile::remove(fileName); } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void tst_QFile::readAllStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QByteArray lotsOfData(1024, '@'); // 10 megs QProcess process; @@ -887,11 +890,14 @@ void tst_QFile::readAllStdin() process.closeWriteChannel(); process.waitForFinished(); QCOMPARE(process.readAll().size(), lotsOfData.size() * 5); +#endif } void tst_QFile::readLineStdin() { - +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QByteArray lotsOfData(1024, '@'); // 10 megs for (int i = 0; i < lotsOfData.size(); ++i) { if ((i % 32) == 31) @@ -926,10 +932,14 @@ void tst_QFile::readLineStdin() QCOMPARE(char(array[i]), char('0' + i % 32)); } } +#endif } void tst_QFile::readLineStdin_lineByLine() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else for (int i = 0; i < 2; ++i) { QProcess process; process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), @@ -949,6 +959,7 @@ void tst_QFile::readLineStdin_lineByLine() process.closeWriteChannel(); QVERIFY(process.waitForFinished(5000)); } +#endif } #endif diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 05546eb2b7..62e183f619 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -219,10 +219,8 @@ private slots: void fileTimes(); void fileTimes_oldFile(); -#ifndef Q_NO_SYMLINKS void isSymLink_data(); void isSymLink(); -#endif void isHidden_data(); void isHidden(); @@ -1206,9 +1204,9 @@ void tst_QFileInfo::fileTimes_oldFile() #endif } -#ifndef Q_NO_SYMLINKS void tst_QFileInfo::isSymLink_data() { +#ifndef Q_NO_SYMLINKS QFile::remove("link.lnk"); QFile::remove("brokenlink.lnk"); QFile::remove("dummyfile"); @@ -1228,10 +1226,14 @@ void tst_QFileInfo::isSymLink_data() QTest::newRow("existent file") << m_sourceFile << false << ""; QTest::newRow("link") << "link.lnk" << true << QFileInfo(m_sourceFile).absoluteFilePath(); QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); +#endif } void tst_QFileInfo::isSymLink() { +#ifdef Q_NO_SYMLINKS + QSKIP("No symlink support", SkipAll); +#else QFETCH(QString, path); QFETCH(bool, isSymLink); QFETCH(QString, linkTarget); @@ -1239,8 +1241,8 @@ void tst_QFileInfo::isSymLink() QFileInfo fi(path); QCOMPARE(fi.isSymLink(), isSymLink); QCOMPARE(fi.symLinkTarget(), linkTarget); -} #endif +} void tst_QFileInfo::isHidden_data() { diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 63d07a7ce3..aa7a3762ce 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -187,7 +187,7 @@ private slots: void pos(); void pos2(); void pos3LargeFile(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void readStdin(); void readAllFromStdin(); void readLineFromStdin(); @@ -1484,9 +1484,12 @@ void tst_QTextStream::pos3LargeFile() // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void tst_QTextStream::readStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("stdinProcess/stdinProcess"); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1505,12 +1508,16 @@ void tst_QTextStream::readStdin() QCOMPARE(a, 1); QCOMPARE(b, 2); QCOMPARE(c, 3); +#endif } // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes void tst_QTextStream::readAllFromStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1523,12 +1530,16 @@ void tst_QTextStream::readAllFromStdin() QVERIFY(stdinProcess.waitForFinished(5000)); QCOMPARE(stream.readAll(), QString::fromLatin1("hello world\n")); +#endif } // ------------------------------------------------------------------------------ // Qt/CE has no stdin/out support for processes void tst_QTextStream::readLineFromStdin() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess stdinProcess; stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1544,6 +1555,7 @@ void tst_QTextStream::readLineFromStdin() stdinProcess.closeWriteChannel(); QVERIFY(stdinProcess.waitForFinished(5000)); +#endif } #endif diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 24cfe8f3bc..94242607f0 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -91,9 +91,7 @@ private slots: void floatProperty(); void qrealProperty(); void property(); -#ifndef QT_NO_PROCESS void recursiveSignalEmission(); -#endif void signalBlocking(); void blockingQueuedConnection(); void childEvents(); @@ -2981,9 +2979,11 @@ void tst_QObject::dynamicProperties() QVERIFY(obj.dynamicPropertyNames().isEmpty()); } -#ifndef QT_NO_PROCESS void tst_QObject::recursiveSignalEmission() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess proc; // signalbug helper app should always be next to this test binary const QString path = QStringLiteral("signalbug/signalbug"); @@ -2992,8 +2992,8 @@ void tst_QObject::recursiveSignalEmission() QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); -} #endif +} void tst_QObject::signalBlocking() { diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 5a92c2f0cb..26bb70fc66 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -74,7 +74,7 @@ private slots: void removeWhileAttached(); #endif void emptyMemory(); -#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WIN) void readOnly(); #endif @@ -90,10 +90,8 @@ private slots: void simpleThreadedProducerConsumer(); // with processes -#ifndef QT_NO_PROCESS void simpleProcessProducerConsumer_data(); void simpleProcessProducerConsumer(); -#endif // extreme cases void useTooMuchMemory(); @@ -457,9 +455,12 @@ void tst_QSharedMemory::emptyMemory() by writing to data and causing a segfault. */ // This test opens a crash dialog on Windows. -#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WIN) void tst_QSharedMemory::readOnly() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else rememberKey("readonly_segfault"); // ### on windows disable the popup somehow QProcess p; @@ -467,6 +468,7 @@ void tst_QSharedMemory::readOnly() p.setProcessChannelMode(QProcess::ForwardedChannels); p.waitForFinished(); QCOMPARE(p.error(), QProcess::Crashed); +#endif } #endif @@ -738,15 +740,16 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer() } } -#ifndef QT_NO_PROCESS void tst_QSharedMemory::simpleProcessProducerConsumer_data() { +#ifndef QT_NO_PROCESS QTest::addColumn("processes"); int tries = 5; for (int i = 0; i < tries; ++i) { QTest::newRow("1 process") << 1; QTest::newRow("5 processes") << 5; } +#endif } /*! @@ -754,6 +757,9 @@ void tst_QSharedMemory::simpleProcessProducerConsumer_data() */ void tst_QSharedMemory::simpleProcessProducerConsumer() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QFETCH(int, processes); QSKIP("This test is unstable: QTBUG-25655"); @@ -797,8 +803,8 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() producer.write("", 1); producer.waitForBytesWritten(); QVERIFY(producer.waitForFinished(5000)); -} #endif +} void tst_QSharedMemory::uniqueKey_data() { diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index b2198e9267..169a13aff2 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -59,7 +59,6 @@ private slots: void complexacquire(); void release(); -#ifndef QT_NO_PROCESS void basicProcesses(); void processes_data(); @@ -69,7 +68,6 @@ private slots: void undo(); #endif void initialValue(); -#endif // QT_NO_PROCESS private: static QString helperBinary(); @@ -177,9 +175,11 @@ void tst_QSystemSemaphore::release() QCOMPARE(sem.errorString(), QString()); } -#ifndef QT_NO_PROCESS void tst_QSystemSemaphore::basicProcesses() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 0, QSystemSemaphore::Create); QProcess acquire; @@ -198,6 +198,7 @@ void tst_QSystemSemaphore::basicProcesses() acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state() == QProcess::NotRunning); +#endif } void tst_QSystemSemaphore::processes_data() @@ -212,6 +213,9 @@ void tst_QSystemSemaphore::processes_data() void tst_QSystemSemaphore::processes() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QFETCH(int, processes); @@ -231,12 +235,16 @@ void tst_QSystemSemaphore::processes() QCOMPARE(consumers.first()->exitCode(), 0); delete consumers.takeFirst(); } +#endif } // This test only checks a system v unix behavior. #if !defined(Q_OS_WIN) && !defined(QT_POSIX_IPC) void tst_QSystemSemaphore::undo() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QStringList acquireArguments = QStringList("acquire"); @@ -253,11 +261,15 @@ void tst_QSystemSemaphore::undo() QVERIFY2(acquire.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); +#endif } #endif void tst_QSystemSemaphore::initialValue() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QStringList acquireArguments = QStringList("acquire"); @@ -284,8 +296,8 @@ void tst_QSystemSemaphore::initialValue() acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); QVERIFY(acquire.state()== QProcess::NotRunning); -} #endif +} QString tst_QSystemSemaphore::helperBinary() { diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp index 0fb1f91e3b..7f78312582 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp @@ -41,7 +41,11 @@ void tst_QMimeDatabase::init() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else const QString mimeDirName = m_globalXdgDir + QStringLiteral("/mime"); runUpdateMimeDatabase(mimeDirName); QVERIFY(QFile::exists(mimeDirName + QStringLiteral("/mime.cache"))); +#endif } diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index 2c70911274..8f37b265f6 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -66,9 +66,7 @@ private slots: void versions(); void threadUniqueness(); -#ifndef QT_NO_PROCESS void processUniqueness(); -#endif void hash(); @@ -325,9 +323,11 @@ void tst_QUuid::threadUniqueness() qDeleteAll(threads); } -#ifndef QT_NO_PROCESS void tst_QUuid::processUniqueness() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QProcess process; QString processOneOutput; QString processTwoOutput; @@ -352,8 +352,8 @@ void tst_QUuid::processUniqueness() // They should be *different*! QVERIFY(processOneOutput != processTwoOutput); -} #endif +} void tst_QUuid::hash() { diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 8a315af850..ac606acfc9 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -63,9 +63,7 @@ private slots: void autoDelete(); void adoptedThreads(); void ensureCleanupOrder(); -#ifndef QT_NO_PROCESS void crashOnExit(); -#endif void leakInDestructor(); void resetInDestructor(); void valueBased(); @@ -320,14 +318,18 @@ static inline bool runCrashOnExit(const QString &binary, QString *errorMessage) } return true; } +#endif void tst_QThreadStorage::crashOnExit() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else QString errorMessage; QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage), qPrintable(errorMessage)); -} #endif +} // S stands for thread Safe. class SPointer diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 1c96aaba98..5b9c9e0b36 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -134,7 +134,7 @@ private slots: #endif void ctor(); -#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +#if !defined(Q_OS_WINCE) void emptyCtor(); #endif void legacyNames(); @@ -499,9 +499,14 @@ static inline bool runSysAppTest(const QString &binary, } return true; } +#endif +#if !defined(Q_OS_WINCE) void tst_QLocale::emptyCtor() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #define TEST_CTOR(req_lc, exp_str) \ { \ /* Test constructor without arguments. Needs separate process */ \ @@ -570,6 +575,7 @@ void tst_QLocale::emptyCtor() #endif // Q_OS_BLACKBERRY #undef TEST_CTOR +#endif } #endif diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 3c3c5755eb..c63cfaf6b6 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -294,10 +294,8 @@ private Q_SLOTS: void ioPutToFileFromSocket(); void ioPutToFileFromLocalSocket_data(); void ioPutToFileFromLocalSocket(); -#ifndef QT_NO_PROCESS void ioPutToFileFromProcess_data(); void ioPutToFileFromProcess(); -#endif void ioPutToFtpFromFile_data(); void ioPutToFtpFromFile(); void ioPutToHttpFromFile_data(); @@ -4276,14 +4274,19 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket() } // Currently no stdin/out supported for Windows CE. -#ifndef QT_NO_PROCESS void tst_QNetworkReply::ioPutToFileFromProcess_data() { +#ifndef QT_NO_PROCESS putToFile_data(); +#endif } void tst_QNetworkReply::ioPutToFileFromProcess() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else + #if defined(Q_OS_WINCE) QSKIP("Currently no stdin/out supported for Windows CE"); #else @@ -4321,8 +4324,9 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QByteArray contents = file.readAll(); QCOMPARE(contents, data); #endif + +#endif // QT_NO_PROCESS } -#endif void tst_QNetworkReply::ioPutToFtpFromFile_data() { diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp index 4fee41ca8b..2fd80b3e71 100644 --- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp @@ -67,9 +67,7 @@ private slots: void sessionClosing_data(); void sessionClosing(); -#ifndef QT_NO_PROCESS void outOfProcessSession(); -#endif void invalidSession(); void repeatedOpenClose_data(); @@ -899,9 +897,11 @@ QDebug operator<<(QDebug debug, const QList &list) // Note: outOfProcessSession requires that at least one configuration is // at Discovered -state. -#ifndef QT_NO_PROCESS void tst_QNetworkSession::outOfProcessSession() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else updateConfigurations(); QTest::qWait(2000); @@ -996,8 +996,8 @@ void tst_QNetworkSession::outOfProcessSession() default: QSKIP("Lackey failed"); } -} #endif +} // A convenience / helper function for testcases. Return the first matching configuration. // Ignores configurations in other than 'discovered' -state. Returns invalid (QNetworkConfiguration()) diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index e0020c2968..4881d86937 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -88,10 +88,8 @@ private slots: void threadedConnection_data(); void threadedConnection(); -#ifndef QT_NO_PROCESS void processConnection_data(); void processConnection(); -#endif void longPath(); void waitForDisconnect(); @@ -784,7 +782,6 @@ void tst_QLocalSocket::threadedConnection() } } -#ifndef QT_NO_PROCESS void tst_QLocalSocket::processConnection_data() { QTest::addColumn("processes"); @@ -794,6 +791,7 @@ void tst_QLocalSocket::processConnection_data() QTest::newRow("30 clients") << 30; } +#ifndef QT_NO_PROCESS class ProcessOutputDumper { public: @@ -815,12 +813,16 @@ public: private: QProcess *process; }; +#endif /*! Create external processes that produce and consume. */ void tst_QLocalSocket::processConnection() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #ifdef Q_OS_MAC QSKIP("The processConnection test is unstable on Mac. See QTBUG-39986."); #endif @@ -860,8 +862,8 @@ void tst_QLocalSocket::processConnection() } producer.waitForFinished(15000); producerOutputDumper.clear(); -} #endif +} void tst_QLocalSocket::longPath() { diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 804f86b479..e0a6e3699d 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -96,9 +96,7 @@ private slots: void setSocketDescriptor(); #endif void listenWhileListening(); -#ifndef QT_NO_PROCESS void addressReusable(); -#endif void setNewSocketDescriptorBlocking(); #ifndef QT_NO_NETWORKPROXY void invalidProxy_data(); @@ -565,9 +563,11 @@ protected: #endif // !Q_OS_WINRT }; -#ifndef QT_NO_PROCESS void tst_QTcpServer::addressReusable() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #ifdef Q_OS_LINUX QSKIP("The addressReusable test is unstable on Linux. See QTBUG-39985."); #endif @@ -616,8 +616,8 @@ void tst_QTcpServer::addressReusable() QTcpServer server; QVERIFY(server.listen(QHostAddress::LocalHost, 49199)); -} #endif +} void tst_QTcpServer::setNewSocketDescriptorBlocking() { diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 6e04cd9d0e..8de9987ed1 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -95,10 +95,8 @@ private slots: void writeDatagramToNonExistingPeer(); void writeToNonExistingPeer_data(); void writeToNonExistingPeer(); -#ifndef QT_NO_PROCESS void outOfProcessConnectedClientServerTest(); void outOfProcessUnconnectedClientServerTest(); -#endif void zeroLengthDatagram(); void multicastTtlOption_data(); void multicastTtlOption(); @@ -937,9 +935,11 @@ void tst_QUdpSocket::writeToNonExistingPeer() QCOMPARE(int(sConnected.state()), int(QUdpSocket::ConnectedState)); } -#ifndef QT_NO_PROCESS void tst_QUdpSocket::outOfProcessConnectedClientServerTest() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #if defined(Q_OS_WINCE) QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); #endif @@ -996,12 +996,14 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest() QVERIFY(clientProcess.waitForFinished()); serverProcess.kill(); QVERIFY(serverProcess.waitForFinished()); -} #endif +} -#ifndef QT_NO_PROCESS void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() { +#ifdef QT_NO_PROCESS + QSKIP("No qprocess support", SkipAll); +#else #if defined(Q_OS_WINCE) QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE)."); #endif @@ -1059,8 +1061,8 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest() QVERIFY(clientProcess.waitForFinished()); serverProcess.kill(); QVERIFY(serverProcess.waitForFinished()); -} #endif +} void tst_QUdpSocket::zeroLengthDatagram() { -- cgit v1.2.3