summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPasi Petäjäjärvi <pasi.petajajarvi@digia.com>2013-01-16 14:34:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-28 16:06:15 +0100
commitf3fc2078b895e257af0c0e88eec92da620b6094f (patch)
tree863a655432d55097fdd8d98547b9f7366a2d27a4 /tests
parente778042ed7dc5c12aeea0dfcd5401bc9d002dc53 (diff)
Check existence of QProcess feature before using it on Qt autotests.
VxWorks does not have QProcess support. Change-Id: I917b769f967e9d71ec5025aae788f3e237b07aeb Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> (cherry picked from commit 416e73a0fcaf31f7c32ba7dcd214b62e6060123c)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp5
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp8
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp8
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp4
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp4
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp4
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp4
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp4
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp8
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp4
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp4
11 files changed, 49 insertions, 8 deletions
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index 9d3519680c..45f143b9fb 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -43,6 +43,10 @@
#include <QObject>
#include <QProcessEnvironment>
+#ifdef QT_NO_PROCESS
+QTEST_NOOP_MAIN
+#else
+
class tst_QProcessEnvironment: public QObject
{
Q_OBJECT
@@ -318,3 +322,4 @@ void tst_QProcessEnvironment::putenv()
QTEST_MAIN(tst_QProcessEnvironment)
#include "tst_qprocessenvironment.moc"
+#endif
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index a6e1f73904..56c07f1590 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -194,7 +194,7 @@ private slots:
void pos();
void pos2();
void pos3LargeFile();
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void readStdin();
void readAllFromStdin();
void readLineFromStdin();
@@ -1386,8 +1386,8 @@ void tst_QTextStream::pos3LargeFile()
}
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QTextStream::readStdin()
{
QProcess stdinProcess;
@@ -1409,10 +1409,8 @@ void tst_QTextStream::readStdin()
QCOMPARE(b, 2);
QCOMPARE(c, 3);
}
-#endif
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readAllFromStdin()
{
@@ -1430,10 +1428,8 @@ void tst_QTextStream::readAllFromStdin()
QChar quoteChar('"');
QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar));
}
-#endif
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readLineFromStdin()
{
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
index daf8c31772..02f99b08d3 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
@@ -82,7 +82,7 @@ private slots:
void removeWhileAttached();
#endif
void emptyMemory();
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS)
void readOnly();
#endif
@@ -98,8 +98,10 @@ private slots:
void simpleThreadedProducerConsumer();
// with processes
+#ifndef QT_NO_PROCESS
void simpleProcessProducerConsumer_data();
void simpleProcessProducerConsumer();
+#endif
// extreme cases
void useTooMuchMemory();
@@ -447,7 +449,7 @@ void tst_QSharedMemory::emptyMemory()
by writing to data and causing a segfault.
*/
// This test opens a crash dialog on Windows.
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS)
void tst_QSharedMemory::readOnly()
{
rememberKey("readonly_segfault");
@@ -728,6 +730,7 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer()
}
}
+#ifndef QT_NO_PROCESS
void tst_QSharedMemory::simpleProcessProducerConsumer_data()
{
QTest::addColumn<int>("processes");
@@ -785,6 +788,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
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 b10da3ecb7..d2b6848dab 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
@@ -66,6 +66,7 @@ private slots:
void basicacquire();
void complexacquire();
+#ifndef QT_NO_PROCESS
void basicProcesses();
void processes_data();
@@ -75,6 +76,7 @@ private slots:
void undo();
#endif
void initialValue();
+#endif // QT_NO_PROCESS
private:
QString helperBinary();
@@ -154,6 +156,7 @@ void tst_QSystemSemaphore::complexacquire()
QCOMPARE(sem.errorString(), QString());
}
+#ifndef QT_NO_PROCESS
void tst_QSystemSemaphore::basicProcesses()
{
QSystemSemaphore sem("store", 0, QSystemSemaphore::Create);
@@ -261,6 +264,7 @@ void tst_QSystemSemaphore::initialValue()
release.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
}
+#endif
QString tst_QSystemSemaphore::helperBinary()
{
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 224c992def..197d56359f 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -73,7 +73,9 @@ private slots:
void versions();
void threadUniqueness();
+#ifndef QT_NO_PROCESS
void processUniqueness();
+#endif
void hash();
@@ -319,6 +321,7 @@ void tst_QUuid::threadUniqueness()
qDeleteAll(threads);
}
+#ifndef QT_NO_PROCESS
void tst_QUuid::processUniqueness()
{
QProcess process;
@@ -346,6 +349,7 @@ 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 29dbf2e31f..2072034f5f 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -71,7 +71,9 @@ private slots:
void autoDelete();
void adoptedThreads();
void ensureCleanupOrder();
+#ifndef QT_NO_PROCESS
void crashOnExit();
+#endif
void leakInDestructor();
void resetInDestructor();
void valueBased();
@@ -305,6 +307,7 @@ void tst_QThreadStorage::ensureCleanupOrder()
QVERIFY(First::order < Second::order);
}
+#ifndef QT_NO_PROCESS
static inline bool runCrashOnExit(const QString &binary, QString *errorMessage)
{
const int timeout = 60000;
@@ -332,6 +335,7 @@ void tst_QThreadStorage::crashOnExit()
QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage),
qPrintable(errorMessage));
}
+#endif
// S stands for thread Safe.
class SPointer
diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
index 8522031406..529f45f001 100644
--- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
+++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
@@ -75,7 +75,9 @@ private slots:
void sessionClosing_data();
void sessionClosing();
+#ifndef QT_NO_PROCESS
void outOfProcessSession();
+#endif
void invalidSession();
void repeatedOpenClose_data();
@@ -901,6 +903,7 @@ QDebug operator<<(QDebug debug, const QList<QNetworkConfiguration> &list)
// Note: outOfProcessSession requires that at least one configuration is
// at Discovered -state.
+#ifndef QT_NO_PROCESS
void tst_QNetworkSession::outOfProcessSession()
{
updateConfigurations();
@@ -998,6 +1001,7 @@ void tst_QNetworkSession::outOfProcessSession()
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/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index fa758d0498..2932387bdb 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -975,6 +975,7 @@ void tst_NetworkSelfTest::smbServer()
QCOMPARE(ret, strlen(contents));
QVERIFY(memcmp(buf, contents, strlen(contents)) == 0);
#else
+#ifndef QT_NO_PROCESS
// try to use Samba
QString progname = "smbclient";
QProcess smbclient;
@@ -1012,6 +1013,9 @@ void tst_NetworkSelfTest::smbServer()
output = smbclient.readAll();
QCOMPARE(output.constData(), contents);
qDebug() << "Test file is correct";
+#else
+ QSKIP( "No QProcess support", SkipAll);
+#endif
#endif
}
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 7e1cc77172..52cd1051ba 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -2142,6 +2142,7 @@ void tst_QApplication::qtbug_12673()
QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application");
path += "modal";
+#ifndef QT_NO_PROCESS
QProcess testProcess;
QStringList arguments;
testProcess.start(path, arguments);
@@ -2149,6 +2150,9 @@ void tst_QApplication::qtbug_12673()
qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(20000));
QCOMPARE(testProcess.exitStatus(), QProcess::NormalExit);
+#else
+ QSKIP( "No QProcess support", SkipAll);
+#endif
}
class NoQuitOnHideWidget : public QWidget
@@ -2222,7 +2226,9 @@ void tst_QApplication::abortQuitOnShow()
executed *after* the destruction of QApplication.
*/
Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
+#ifndef QT_NO_PROCESS
Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
+#endif
Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher);
#ifndef QT_NO_SHAREDMEMORY
Q_GLOBAL_STATIC(QSharedMemory, tst_qapp_sharedMemory);
@@ -2243,7 +2249,9 @@ void tst_QApplication::globalStaticObjectDestruction()
int argc = 1;
QApplication app(argc, &argv0);
QVERIFY(tst_qapp_locale());
+#ifndef QT_NO_PROCESS
QVERIFY(tst_qapp_process());
+#endif
QVERIFY(tst_qapp_fileSystemWatcher());
#ifndef QT_NO_SHAREDMEMORY
QVERIFY(tst_qapp_sharedMemory());
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index 17716ff130..c8a12a9866 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -201,7 +201,9 @@ private slots:
void deleteStack();
void checkSignals();
void addStackAndDie();
+#ifndef QT_NO_PROCESS
void commandTextFormat();
+#endif
};
tst_QUndoGroup::tst_QUndoGroup()
@@ -605,6 +607,7 @@ void tst_QUndoGroup::addStackAndDie()
delete stack;
}
+#ifndef QT_NO_PROCESS
void tst_QUndoGroup::commandTextFormat()
{
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
@@ -644,6 +647,7 @@ void tst_QUndoGroup::commandTextFormat()
qApp->removeTranslator(&translator);
}
+#endif
#else
class tst_QUndoGroup : public QObject
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 4d47ed4f58..9b48dc7798 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -247,7 +247,9 @@ private slots:
void macroBeginEnd();
void compression();
void undoLimit();
+#ifndef QT_NO_PROCESS
void commandTextFormat();
+#endif
void separateUndoText();
};
@@ -2964,6 +2966,7 @@ void tst_QUndoStack::undoLimit()
true); // redoChanged
}
+#ifndef QT_NO_PROCESS
void tst_QUndoStack::commandTextFormat()
{
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
@@ -3001,6 +3004,7 @@ void tst_QUndoStack::commandTextFormat()
qApp->removeTranslator(&translator);
}
+#endif
void tst_QUndoStack::separateUndoText()
{