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 --- .../qsystemsemaphore/test/tst_qsystemsemaphore.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/kernel/qsystemsemaphore') 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() { -- cgit v1.2.3