Properly use the "process" feature

Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.

Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Ulf Hermann 2016-11-23 12:25:17 +01:00
parent 85b30fda7c
commit 44af54419e
56 changed files with 209 additions and 213 deletions

View File

@ -74,6 +74,7 @@
#define QT_NO_LIBRARY
#define QT_FEATURE_library -1
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
#define QT_NO_SYSTEMLOCALE
#define QT_FEATURE_slog2 -1
#define QT_FEATURE_syslog -1

View File

@ -39,7 +39,6 @@
// these might be defined via precompiled headers
#include <QtCore/qatomic.h>
#include "qprocess_p.h"
#define FORKFD_NO_SPAWNFD

View File

@ -22,8 +22,6 @@ HEADERS += \
io/qlockfile.h \
io/qlockfile_p.h \
io/qnoncontiguousbytedevice_p.h \
io/qprocess.h \
io/qprocess_p.h \
io/qtextstream.h \
io/qtextstream_p.h \
io/qtemporarydir.h \
@ -72,7 +70,6 @@ SOURCES += \
io/qiodevice.cpp \
io/qlockfile.cpp \
io/qnoncontiguousbytedevice.cpp \
io/qprocess.cpp \
io/qstorageinfo.cpp \
io/qtextstream.cpp \
io/qtemporarydir.cpp \
@ -96,6 +93,19 @@ SOURCES += \
io/qloggingcategory.cpp \
io/qloggingregistry.cpp
qtConfig(process) {
SOURCES += \
io/qprocess.cpp
HEADERS += \
io/qprocess.h \
io/qprocess_p.h
win32:!winrt: \
SOURCES += io/qprocess_win.cpp
else: unix: \
SOURCES += io/qprocess_unix.cpp
}
win32 {
SOURCES += io/qfsfileengine_win.cpp
SOURCES += io/qlockfile_win.cpp
@ -112,7 +122,6 @@ win32 {
io/qwinoverlappedionotifier_p.h
SOURCES += \
io/qprocess_win.cpp \
io/qsettings_win.cpp \
io/qstandardpaths_win.cpp \
io/qstorageinfo_win.cpp \
@ -132,7 +141,6 @@ win32 {
io/qfsfileengine_unix.cpp \
io/qfilesystemengine_unix.cpp \
io/qlockfile_unix.cpp \
io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
!integrity:!uikit {

View File

@ -99,8 +99,6 @@ QT_END_NAMESPACE
#include <private/qcore_unix_p.h>
#endif
#ifndef QT_NO_PROCESS
QT_BEGIN_NAMESPACE
/*!
@ -2604,6 +2602,3 @@ QString QProcess::nullDevice()
QT_END_NAMESPACE
#include "moc_qprocess.cpp"
#endif // QT_NO_PROCESS

View File

@ -46,11 +46,10 @@
#include <functional>
QT_REQUIRE_CONFIG(process);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PROCESS
#if !defined(Q_OS_WIN) || defined(Q_QDOC)
typedef qint64 Q_PID;
#else
@ -298,8 +297,6 @@ private:
friend class QProcessManager;
};
#endif // QT_NO_PROCESS
QT_END_NAMESPACE
#endif // QPROCESS_H

View File

@ -57,6 +57,9 @@
#include "QtCore/qhash.h"
#include "QtCore/qshareddata.h"
#include "private/qiodevice_p.h"
QT_REQUIRE_CONFIG(process);
#ifdef Q_OS_UNIX
#include <QtCore/private/qorderedmutexlocker_p.h>
#endif
@ -70,8 +73,6 @@ typedef int Q_PIPE;
#define INVALID_Q_PIPE -1
#endif
#ifndef QT_NO_PROCESS
QT_BEGIN_NAMESPACE
class QSocketNotifier;
@ -388,6 +389,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_PROCESS
#endif // QPROCESS_P_H

View File

@ -41,8 +41,6 @@
//#define QPROCESS_DEBUG
#include "qdebug.h"
#ifndef QT_NO_PROCESS
#if defined QPROCESS_DEBUG
#include "private/qtools_p.h"
#include <ctype.h>
@ -1045,5 +1043,3 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
}
QT_END_NAMESPACE
#endif // QT_NO_PROCESS

View File

@ -59,8 +59,6 @@
#define PIPE_REJECT_REMOTE_CLIENTS 0x08
#endif
#ifndef QT_NO_PROCESS
QT_BEGIN_NAMESPACE
//#define QPROCESS_DEBUG
@ -893,5 +891,3 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
}
QT_END_NAMESPACE
#endif // QT_NO_PROCESS

View File

@ -156,4 +156,4 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_PROCESS
#endif // QWINDOWSPIPEWRITER_P_H

View File

@ -300,7 +300,7 @@ static inline int qt_safe_close(int fd)
#define QT_CLOSE qt_safe_close
// - VxWorks & iOS/tvOS/watchOS don't have processes
#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
#if QT_CONFIG(process)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
@ -329,7 +329,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
EINTR_LOOP(ret, ::waitpid(pid, status, options));
return ret;
}
#endif // Q_OS_VXWORKS
#endif // QT_CONFIG(process)
#if !defined(_POSIX_MONOTONIC_CLOCK)
# define _POSIX_MONOTONIC_CLOCK -1

View File

@ -41,7 +41,9 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStandardPaths>
#include <QtCore/QProcess>
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@ -121,7 +123,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded());
if (debug)
qDebug("Launching %s", qPrintable(command));
#if defined(QT_NO_PROCESS)
#if !QT_CONFIG(process)
const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
#else
const bool ok = QProcess::startDetached(command);

View File

@ -42,7 +42,6 @@
#include <QtTest/private/qbenchmarkmetric_p.h>
#include <QtTest/private/qbenchmarktimemeasurers_p.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>

View File

@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
#if (defined(Q_OS_LINUX) || defined Q_OS_MACOS) && QT_CONFIG(process)
#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND

View File

@ -51,7 +51,6 @@
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/private/qtools_p.h>

View File

@ -51,7 +51,6 @@
#include <qmainwindow.h>
#include <qfont.h>
#include <qgroupbox.h>
#include <qprocess.h>
#include <qpixmapcache.h>
#include <qdialogbuttonbox.h>
#include <qscrollbar.h>

View File

@ -33,7 +33,9 @@
#include <qtextcodec.h>
#include <qfile.h>
#include <time.h>
#include <qprocess.h>
#if QT_CONFIG(process)
# include <qprocess.h>
#endif
#include <QThreadPool>
class tst_QTextCodec : public QObject
@ -2085,7 +2087,7 @@ void tst_QTextCodec::codecForUtfText()
#if defined(Q_OS_UNIX)
void tst_QTextCodec::toLocal8Bit()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess process;

View File

@ -29,7 +29,9 @@
#include <qdebug.h>
#include <qglobal.h>
#include <QtCore/QProcess>
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
#include <QtTest/QTest>
class tst_qmessagehandler : public QObject
@ -102,7 +104,7 @@ void tst_qmessagehandler::initTestCase()
QVERIFY2(!m_appDir.isEmpty(), qPrintable(
QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath())));
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
m_baseEnvironment = QProcess::systemEnvironment();
for (int i = 0; i < m_baseEnvironment.count(); ++i) {
if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) {
@ -110,7 +112,7 @@ void tst_qmessagehandler::initTestCase()
break;
}
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_qmessagehandler::cleanup()
@ -813,7 +815,7 @@ void tst_qmessagehandler::qMessagePattern_data()
void tst_qmessagehandler::qMessagePattern()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QFETCH(QString, pattern);
@ -855,7 +857,7 @@ void tst_qmessagehandler::qMessagePattern()
void tst_qmessagehandler::setMessagePattern()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
@ -892,7 +894,7 @@ void tst_qmessagehandler::setMessagePattern()
output.replace("\r\n", "\n");
#endif
QCOMPARE(QString::fromLatin1(output), QString::fromLatin1(expected));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
Q_DECLARE_METATYPE(QtMsgType)

View File

@ -56,12 +56,14 @@ SUBDIRS=\
qurlinternal \
qloggingregistry
!qtConfig(process): SUBDIRS -= \
qprocess \
qprocess-noapplication \
qprocessenvironment
win32:!qtConfig(private_tests): SUBDIRS -= \
qfilesystementry
winrt: SUBDIRS -= \
qprocess \
qprocess-noapplication \
qprocessenvironment \
qstorageinfo \
qwinoverlappedionotifier

View File

@ -852,7 +852,7 @@ void tst_QDir::entryList()
void tst_QDir::entryListTimedSort()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
const QString touchBinary = "/bin/touch";
if (!QFile::exists(touchBinary))
QSKIP("/bin/touch not found");
@ -886,7 +886,7 @@ void tst_QDir::entryListTimedSort()
QCOMPARE(actual.last(), aFileInfo.fileName());
#else
QSKIP("This test requires QProcess support.");
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QDir::entryListSimple_data()

View File

@ -50,7 +50,9 @@ QT_END_NAMESPACE
#if !defined(QT_NO_NETWORK)
#include <QHostInfo>
#endif
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#ifdef Q_OS_WIN
# include <qt_windows.h>
#else
@ -884,7 +886,7 @@ void tst_QFile::readAllBuffer()
QFile::remove(fileName);
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
class StdinReaderProcessGuard { // Ensure the stdin reader process is stopped on destruction.
Q_DISABLE_COPY(StdinReaderProcessGuard)
@ -908,11 +910,11 @@ public:
private:
QProcess *m_process;
};
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
void tst_QFile::readAllStdin()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QByteArray lotsOfData(1024, '@'); // 10 megs
@ -935,7 +937,7 @@ void tst_QFile::readAllStdin()
void tst_QFile::readLineStdin()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QByteArray lotsOfData(1024, '@'); // 10 megs
@ -976,7 +978,7 @@ void tst_QFile::readLineStdin()
void tst_QFile::readLineStdin_lineByLine()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
for (int i = 0; i < 2; ++i) {

View File

@ -72,7 +72,7 @@ void tst_QLockFile::initTestCase()
{
#if defined(Q_OS_ANDROID)
QSKIP("This test requires deploying and running external console applications");
#elif defined(QT_NO_PROCESS)
#elif !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
@ -80,7 +80,7 @@ void tst_QLockFile::initTestCase()
QString testdata_dir = QFileInfo(QFINDTESTDATA("qlockfiletesthelper")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
m_helperApp = "qlockfiletesthelper/qlockfile_test_helper";
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLockFile::lockUnlock()
@ -114,7 +114,7 @@ void tst_QLockFile::lockUnlock()
void tst_QLockFile::lockOutOtherProcess()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
// Lock
@ -138,7 +138,7 @@ void tst_QLockFile::lockOutOtherProcess()
QCOMPARE(ret, int(QLockFile::NoError));
// Lock doesn't survive process though (on clean exit)
QVERIFY(!QFile::exists(fileName));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
static QLockFile::LockError tryLockFromThread(const QString &fileName)
@ -254,7 +254,7 @@ void tst_QLockFile::staleLockFromCrashedProcess_data()
void tst_QLockFile::staleLockFromCrashedProcess()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QFETCH(int, staleLockTime);
@ -274,12 +274,12 @@ void tst_QLockFile::staleLockFromCrashedProcess()
QVERIFY(secondLock.tryLock());
#endif
QCOMPARE(int(secondLock.error()), int(QLockFile::NoError));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
{
#if defined(QT_NO_PROCESS)
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#elif defined(Q_OS_WINRT) || defined(QT_PLATFORM_UIKIT)
QSKIP("We cannot retrieve information about other processes on this platform.");
@ -298,12 +298,12 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
secondLock.setStaleLockTime(0);
QVERIFY(secondLock.tryLock());
QCOMPARE(int(secondLock.error()), int(QLockFile::NoError));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLockFile::staleShortLockFromBusyProcess()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
const QString fileName = dir.path() + "/staleLockFromBusyProcess";
@ -331,12 +331,12 @@ void tst_QLockFile::staleShortLockFromBusyProcess()
proc.waitForFinished();
QVERIFY(secondLock.tryLock());
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLockFile::staleLongLockFromBusyProcess()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
const QString fileName = dir.path() + "/staleLockFromBusyProcess";
@ -358,7 +358,7 @@ void tst_QLockFile::staleLongLockFromBusyProcess()
QVERIFY(!secondLock.removeStaleLockFile());
proc.waitForFinished();
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
static QString tryStaleLockFromThread(const QString &fileName)
@ -388,7 +388,7 @@ static QString tryStaleLockFromThread(const QString &fileName)
void tst_QLockFile::staleLockRace()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
// Multiple threads notice a stale lock at the same time
@ -406,7 +406,7 @@ void tst_QLockFile::staleLockRace()
synchronizer.waitForFinished();
foreach (const QFuture<QString> &future, synchronizer.futures())
QVERIFY2(future.result().isEmpty(), qPrintable(future.result()));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLockFile::noPermissions()

View File

@ -38,7 +38,6 @@ int main(int argc, char **argv)
if (argc < 3)
return 13;
#ifndef QT_NO_PROCESS
QProcess process;
QProcess::ProcessChannelMode mode = (QProcess::ProcessChannelMode)atoi(argv[1]);
@ -69,6 +68,5 @@ int main(int argc, char **argv)
if ((mode == QProcess::ForwardedErrorChannel || mode == QProcess::ForwardedChannels)
&& !process.readAllStandardError().isEmpty())
return 6;
#endif
return 0;
}

View File

@ -53,7 +53,6 @@ public slots:
void cleanupTestCase();
void init();
#ifndef QT_NO_PROCESS
private slots:
void getSetCheck();
void constructing();
@ -159,26 +158,18 @@ protected slots:
private:
qint64 bytesAvailable;
QTemporaryDir m_temporaryDir;
#endif //QT_NO_PROCESS
};
void tst_QProcess::initTestCase()
{
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
#else
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
// chdir to our testdata path and execute helper apps relative to that.
QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessNormal")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
#endif
}
void tst_QProcess::cleanupTestCase()
{
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
#endif
}
void tst_QProcess::init()
@ -186,8 +177,6 @@ void tst_QProcess::init()
bytesAvailable = 0;
}
#ifndef QT_NO_PROCESS
// Testing get/set functions
void tst_QProcess::getSetCheck()
{
@ -2406,7 +2395,5 @@ void tst_QProcess::processEventsInAReadyReadSlot()
QVERIFY(process.waitForFinished());
}
#endif //QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"

View File

@ -40,8 +40,9 @@
#include <QTemporaryDir>
#include <QTextStream>
#include <QTextCodec>
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#include "../../../network-settings.h"
@ -1493,7 +1494,7 @@ void tst_QTextStream::pos3LargeFile()
// ------------------------------------------------------------------------------
void tst_QTextStream::readStdin()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess stdinProcess;
@ -1520,7 +1521,7 @@ void tst_QTextStream::readStdin()
// ------------------------------------------------------------------------------
void tst_QTextStream::readAllFromStdin()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess stdinProcess;
@ -1541,7 +1542,7 @@ void tst_QTextStream::readAllFromStdin()
// ------------------------------------------------------------------------------
void tst_QTextStream::readLineFromStdin()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess stdinProcess;

View File

@ -41,8 +41,9 @@
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#include "qobject.h"
#ifdef QT_BUILD_INTERNAL
#include <private/qobject_p.h>
@ -281,7 +282,7 @@ static void playWithObjects()
void tst_QObject::initTestCase()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath();
QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir));
#endif
@ -3006,7 +3007,7 @@ void tst_QObject::dynamicProperties()
void tst_QObject::recursiveSignalEmission()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess proc;

View File

@ -28,7 +28,9 @@
#include <QDebug>
#include <QFile>
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#include <QSharedMemory>
#include <QTest>
#include <QThread>
@ -133,7 +135,7 @@ tst_QSharedMemory::~tst_QSharedMemory()
void tst_QSharedMemory::initTestCase()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary");
#endif
}
@ -455,7 +457,7 @@ void tst_QSharedMemory::emptyMemory()
#if !defined(Q_OS_WIN)
void tst_QSharedMemory::readOnly()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
rememberKey("readonly_segfault");
@ -736,7 +738,7 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer()
void tst_QSharedMemory::simpleProcessProducerConsumer_data()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QTest::addColumn<int>("processes");
int tries = 5;
for (int i = 0; i < tries; ++i) {
@ -751,7 +753,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer_data()
*/
void tst_QSharedMemory::simpleProcessProducerConsumer()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QFETCH(int, processes);

View File

@ -172,7 +172,7 @@ void tst_QSystemSemaphore::release()
void tst_QSystemSemaphore::basicProcesses()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QSystemSemaphore sem("store", 0, QSystemSemaphore::Create);
@ -208,7 +208,7 @@ void tst_QSystemSemaphore::processes_data()
void tst_QSystemSemaphore::processes()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
@ -237,7 +237,7 @@ void tst_QSystemSemaphore::processes()
#if !defined(Q_OS_WIN) && !defined(QT_POSIX_IPC)
void tst_QSystemSemaphore::undo()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
@ -262,7 +262,7 @@ void tst_QSystemSemaphore::undo()
void tst_QSystemSemaphore::initialValue()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);

View File

@ -36,7 +36,7 @@
void tst_QMimeDatabase::initTestCaseInternal()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
const QString mimeDirName = m_globalXdgDir + QStringLiteral("/mime");

View File

@ -858,7 +858,7 @@ void tst_QMimeDatabase::fromThreads()
QVERIFY(tp.waitForDone(60000));
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
enum {
UpdateMimeDatabaseTimeout = 120 * 1000 // 2min
@ -901,7 +901,7 @@ static bool waitAndRunUpdateMimeDatabase(const QString &path)
}
return runUpdateMimeDatabase(path);
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
static void checkHasMimeType(const QString &mimeType)
{
@ -936,7 +936,7 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
QSKIP("This test requires XDG_DATA_DIRS");
#endif
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
qmime_secondsBetweenChecks = 0;
@ -989,12 +989,12 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
QString::fromLatin1("application/octet-stream"));
QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QMimeDatabase::installNewLocalMimeType()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
qmime_secondsBetweenChecks = 0;
@ -1057,7 +1057,7 @@ void tst_QMimeDatabase::installNewLocalMimeType()
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
QString::fromLatin1("application/octet-stream"));
QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
#endif
#endif // QT_CONFIG(process)
}
QTEST_GUILESS_MAIN(tst_QMimeDatabase)

View File

@ -91,7 +91,7 @@ void tst_QUuid::initTestCase()
//"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
uuidB = QUuid(0x1ab6e93a, 0xb1cb, 0x4a87, 0xba, 0x47, 0xec, 0x7e, 0x99, 0x03, 0x9a, 0x7b);
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
// chdir to the directory containing our testdata, then refer to it with relative paths
QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessUniqueness")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
@ -338,7 +338,7 @@ void tst_QUuid::threadUniqueness()
void tst_QUuid::processUniqueness()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess process;

View File

@ -76,7 +76,7 @@ int Pointer::count = 0;
void tst_QThreadStorage::initTestCase()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
const QString crashOnExitDir = QFINDTESTDATA("crashonexit");
QVERIFY2(!crashOnExitDir.isEmpty(),
qPrintable(QString::fromLatin1("Could not find 'crashonexit' starting from '%1'")
@ -300,7 +300,7 @@ void tst_QThreadStorage::ensureCleanupOrder()
QVERIFY(First::order < Second::order);
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
static inline bool runCrashOnExit(const QString &binary, QString *errorMessage)
{
const int timeout = 60000;
@ -325,7 +325,7 @@ static inline bool runCrashOnExit(const QString &binary, QString *errorMessage)
void tst_QThreadStorage::crashOnExit()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QString errorMessage;

View File

@ -509,7 +509,7 @@ void tst_QCommandLineParser::testCpp11StyleInitialization()
void tst_QCommandLineParser::testVersionOption()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
#if defined(Q_OS_ANDROID)
@ -526,7 +526,7 @@ void tst_QCommandLineParser::testVersionOption()
output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
QCOMPARE(output, QString("qcommandlineparser_test_helper 1.0\n"));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
static const char expectedOptionsHelp[] =
@ -575,7 +575,7 @@ void tst_QCommandLineParser::testHelpOption_data()
void tst_QCommandLineParser::testHelpOption()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
#if defined(Q_OS_ANDROID)
@ -618,12 +618,12 @@ void tst_QCommandLineParser::testHelpOption()
expectedResizeHelp.replace("testhelper/", "testhelper\\");
#endif
QCOMPARE(output, QString(expectedResizeHelp));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QCommandLineParser::testQuoteEscaping()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#elif defined(Q_OS_ANDROID)
QSKIP("Deploying executable applications to file system on Android not supported.");
@ -644,7 +644,7 @@ void tst_QCommandLineParser::testQuoteEscaping()
QVERIFY2(output.contains("KEY1=\"VALUE1\""), qPrintable(output));
QVERIFY2(output.contains("QTBUG-15379=C:\\path\\'file.ext"), qPrintable(output));
QVERIFY2(output.contains("QTBUG-30628=C:\\temp\\'file'.ext"), qPrintable(output));
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
QTEST_APPLESS_MAIN(tst_QCommandLineParser)

View File

@ -35,7 +35,9 @@
#include <QScopedArrayPointer>
#include <qtextcodec.h>
#include <qdatetime.h>
#include <qprocess.h>
#if QT_CONFIG(process)
# include <qprocess.h>
#endif
#include <float.h>
#include <locale.h>
@ -152,7 +154,7 @@ tst_QLocale::tst_QLocale()
void tst_QLocale::initTestCase()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
const QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp");
QVERIFY2(!syslocaleapp_dir.isEmpty(),
qPrintable(QStringLiteral("Cannot find 'syslocaleapp' starting from ")
@ -165,7 +167,7 @@ void tst_QLocale::initTestCase()
QVERIFY2(fi.exists() && fi.isExecutable(),
qPrintable(QDir::toNativeSeparators(m_sysapp)
+ QStringLiteral(" does not exist or is not executable.")));
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QLocale::cleanupTestCase()
@ -420,7 +422,7 @@ void tst_QLocale::ctor()
#undef TEST_CTOR
}
#if !defined(QT_NO_PROCESS)
#if QT_CONFIG(process)
static inline bool runSysApp(const QString &binary,
const QStringList &env,
QString *output,
@ -472,7 +474,7 @@ static inline bool runSysAppTest(const QString &binary,
void tst_QLocale::emptyCtor()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
#define TEST_CTOR(req_lc, exp_str) \

View File

@ -31,7 +31,9 @@
#include <QtCore/QTemporaryFile>
#include <QtCore/QTemporaryDir>
#include <QtCore/QProcess>
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
#include <QtCore/QByteArray>
#include <QtCore/QString>
#include <QtCore/QFileInfo>
@ -66,7 +68,7 @@ static QString makespec()
QT_BEGIN_NAMESPACE
namespace QTest {
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
class QExternalProcess: public QProcess
{
protected:
@ -87,7 +89,7 @@ namespace QTest {
}
#endif
};
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
class QExternalTestPrivate
{
@ -554,7 +556,7 @@ namespace QTest {
bool QExternalTestPrivate::runQmake()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
if (temporaryDirPath.isEmpty())
qWarning() << "Temporary directory is expected to be non-empty";
@ -597,14 +599,14 @@ namespace QTest {
}
return ok && exitCode == 0;
#else // QT_NO_PROCESS
#else // QT_CONFIG(process)
return false;
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
bool QExternalTestPrivate::runMake(Target target)
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
return false;
#else
if (temporaryDirPath.isEmpty())
@ -663,7 +665,7 @@ namespace QTest {
std_err += make.readAllStandardError();
return ok;
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
bool QExternalTestPrivate::commonSetup(const QByteArray &body)

View File

@ -1410,7 +1410,7 @@ void tst_QDBusConnection::callVirtualObjectLocal()
void tst_QDBusConnection::pendingCallWhenDisconnected()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("Test requires QProcess");
#else
if (!QCoreApplication::instance())

View File

@ -709,7 +709,7 @@ void tst_QIcon::fromThemeCache()
QIcon::setThemeSearchPaths(QStringList());
QSKIP("gtk-update-icon-cache not run (binary not found)");
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QProcess process;
process.start(gtkUpdateIconCache,
QStringList() << QStringLiteral("-f") << QStringLiteral("-t") << (dir.path() + QLatin1String("/testcache")));
@ -719,7 +719,7 @@ void tst_QIcon::fromThemeCache()
QVERIFY(process.waitForFinished());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
QVERIFY(QFileInfo(cacheName).lastModified() >= QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified());
QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes
QVERIFY(!QIcon::fromTheme("button-open").isNull());

View File

@ -73,7 +73,7 @@ void tst_QClipboard::cleanupTestCase()
void tst_QClipboard::init()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
const QString testdataDir = QFileInfo(QFINDTESTDATA("copier")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
#endif
@ -218,7 +218,7 @@ void tst_QClipboard::testSignals()
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX)
static bool runHelper(const QString &program, const QStringList &arguments, QByteArray *errorMessage)
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QProcess process;
process.setReadChannelMode(QProcess::ForwardedChannels);
process.start(program, arguments);
@ -254,19 +254,19 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt
return false;
}
return true;
#else // QT_NO_PROCESS
#else // QT_CONFIG(process)
Q_UNUSED(program)
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
return false;
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
// Test that pasted text remains on the clipboard after a Qt application exits.
// This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits
void tst_QClipboard::copy_exit_paste()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
// ### It's still possible to test copy/paste - just keep the apps running
if (!PlatformClipboard::isAvailable())
QSKIP("Native clipboard not working in this setup");
@ -282,12 +282,12 @@ void tst_QClipboard::copy_exit_paste()
QStringList() << QStringLiteral("--text") << stringArgument,
&errorMessage),
errorMessage.constData());
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QClipboard::copyImage()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
if (!PlatformClipboard::isAvailable())
QSKIP("Native clipboard not working in this setup");
QImage image(100, 100, QImage::Format_ARGB32);
@ -303,7 +303,7 @@ void tst_QClipboard::copyImage()
QVERIFY2(runHelper(QStringLiteral("paster/paster"),
QStringList(QStringLiteral("--image")), &errorMessage),
errorMessage.constData());
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_QNX

View File

@ -486,7 +486,7 @@ void tst_QFont::styleName()
QString getPlatformGenericFont(const char* genericName)
{
#if defined(Q_OS_UNIX) && !defined(QT_NO_FONTCONFIG)
#if defined(Q_OS_UNIX) && !defined(QT_NO_FONTCONFIG) && QT_CONFIG(process)
QProcess p;
p.start(QLatin1String("fc-match"), (QStringList() << "-f%{family}" << genericName));
if (!p.waitForStarted())

View File

@ -4285,14 +4285,14 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket()
// Currently no stdin/out supported for Windows CE.
void tst_QNetworkReply::ioPutToFileFromProcess_data()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
putToFile_data();
#endif
}
void tst_QNetworkReply::ioPutToFileFromProcess()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
@ -4330,7 +4330,7 @@ void tst_QNetworkReply::ioPutToFileFromProcess()
QByteArray contents = file.readAll();
QCOMPARE(contents, data);
#endif // QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
void tst_QNetworkReply::ioPutToFtpFromFile_data()

View File

@ -897,7 +897,7 @@ QDebug operator<<(QDebug debug, const QList<QNetworkConfiguration> &list)
// at Discovered -state.
void tst_QNetworkSession::outOfProcessSession()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
updateConfigurations();

View File

@ -904,7 +904,7 @@ void tst_QLocalSocket::processConnection_data()
QTest::newRow("30 clients") << 30;
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
class ProcessOutputDumper
{
public:
@ -933,7 +933,7 @@ private:
*/
void tst_QLocalSocket::processConnection()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
#ifdef Q_OS_MAC

View File

@ -49,7 +49,9 @@
#include <qtcpsocket.h>
#include <qtcpserver.h>
#include <qhostaddress.h>
#include <qprocess.h>
#if QT_CONFIG(process)
# include <qprocess.h>
#endif
#include <qstringlist.h>
#include <qplatformdefs.h>
#include <qhostinfo.h>
@ -544,7 +546,7 @@ protected:
void tst_QTcpServer::addressReusable()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
#ifdef Q_OS_LINUX

View File

@ -54,7 +54,9 @@
#include <QHostInfo>
#include <QMap>
#include <QPointer>
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
@ -2403,7 +2405,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect_data()
void tst_QTcpSocket::suddenRemoteDisconnect()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QFETCH(QString, client);
@ -2459,7 +2461,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
#endif
QCOMPARE(clientProcess.readAll().constData(), "SUCCESS\n");
QCOMPARE(serverProcess.readAll().constData(), "SUCCESS\n");
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
//----------------------------------------------------------------------------------

View File

@ -956,7 +956,7 @@ void tst_QUdpSocket::writeToNonExistingPeer()
void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess serverProcess;
@ -1017,7 +1017,7 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No qprocess support", SkipAll);
#else
QProcess serverProcess;

View File

@ -961,7 +961,7 @@ void tst_NetworkSelfTest::supportsSsl()
#endif
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
static const QByteArray msgProcessError(const QProcess &process, const char *what)
{
QString result;
@ -978,7 +978,7 @@ static void ensureTermination(QProcess &process)
process.kill();
}
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
void tst_NetworkSelfTest::smbServer()
{
@ -996,7 +996,7 @@ void tst_NetworkSelfTest::smbServer()
QCOMPARE(ret, strlen(contents));
QVERIFY(memcmp(buf, contents, strlen(contents)) == 0);
#else
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
enum { sambaTimeOutSecs = 5 };
// try to use Samba
const QString progname = "smbclient";

View File

@ -57,6 +57,8 @@ cross_compile: SUBDIRS -= \
!qtConfig(accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux
!qtConfig(process): SUBDIRS -= qprocess_and_guieventloop
!mac: SUBDIRS -= \
macgui \
macnativeevents \
@ -66,8 +68,5 @@ cross_compile: SUBDIRS -= \
!embedded: SUBDIRS -= \
qdirectpainter
winrt: SUBDIRS -= \
qprocess_and_guieventloop
android: SUBDIRS += \
android

View File

@ -40,9 +40,7 @@ private slots:
void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
{
#if defined(QT_NO_PROCESS)
QSKIP("QProcess not supported");
#elif defined(Q_OS_ANDROID)
#if defined(Q_OS_ANDROID)
QSKIP("Not supported on Android");
#else

View File

@ -536,7 +536,7 @@ void tst_Selftests::runSubTest_data()
}
}
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
static QProcessEnvironment processEnvironment()
{
@ -820,11 +820,11 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
}
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
void tst_Selftests::runSubTest()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QFETCH(QString, subdir);
@ -833,7 +833,7 @@ void tst_Selftests::runSubTest()
QFETCH(bool, crashes);
doRunSubTest(subdir, loggers, arguments, crashes);
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}
// attribute must contain ="

View File

@ -743,7 +743,7 @@ void tst_Moc::initTestCase()
const QString testHeader = QFINDTESTDATA("backslash-newlines.h");
QVERIFY(!testHeader.isEmpty());
m_sourceDirectory = QFileInfo(testHeader).absolutePath();
#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_UNIX) && QT_CONFIG(process)
QProcess proc;
proc.start(qmake, QStringList() << "-query" << "QT_INSTALL_HEADERS");
QVERIFY(proc.waitForFinished());
@ -787,7 +787,7 @@ void tst_Moc::oldStyleCasts()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
proc.start(m_moc, QStringList(m_sourceDirectory + QStringLiteral("/oldstyle-casts.h")));
QVERIFY(proc.waitForFinished());
@ -817,7 +817,7 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
const QString header = m_sourceDirectory + QStringLiteral("/extraqualification.h");
proc.start(m_moc, QStringList(header));
@ -856,7 +856,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
proc.setWorkingDirectory(m_sourceDirectory + QStringLiteral("/task71021"));
proc.start(m_moc, QStringList("../Header"));
@ -1102,7 +1102,7 @@ void tst_Moc::warnOnMultipleInheritance()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
const QString header = m_sourceDirectory + QStringLiteral("/warn-on-multiple-qobject-subclasses.h");
@ -1125,7 +1125,7 @@ void tst_Moc::ignoreOptionClashes()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
const QString header = m_sourceDirectory + QStringLiteral("/interface-from-include.h");
@ -1166,7 +1166,7 @@ void tst_Moc::forgottenQInterface()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
const QString header = m_sourceDirectory + QStringLiteral("/forgotten-qinterface.h");
@ -1248,7 +1248,7 @@ void tst_Moc::frameworkSearchPath()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_UNIX) && QT_CONFIG(process)
QStringList args;
args << "-F" << m_sourceDirectory + QStringLiteral("/.")
<< m_sourceDirectory + QStringLiteral("/interface-from-framework.h")
@ -1292,7 +1292,7 @@ void tst_Moc::templateGtGt()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
proc.start(m_moc, QStringList(m_sourceDirectory + QStringLiteral("/template-gtgt.h")));
QVERIFY(proc.waitForFinished());
@ -1308,7 +1308,7 @@ void tst_Moc::templateGtGt()
void tst_Moc::defineMacroViaCmdline()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
@ -1328,7 +1328,7 @@ void tst_Moc::defineMacroViaCmdline()
void tst_Moc::defineMacroViaForcedInclude()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
@ -1348,7 +1348,7 @@ void tst_Moc::defineMacroViaForcedInclude()
void tst_Moc::defineMacroViaForcedIncludeRelative()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
QStringList args;
@ -1369,7 +1369,7 @@ void tst_Moc::defineMacroViaForcedIncludeRelative()
void tst_Moc::environmentIncludePaths_data()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QTest::addColumn<QString>("cmdline");
QTest::addColumn<QString>("varname");
@ -1383,7 +1383,7 @@ void tst_Moc::environmentIncludePaths_data()
void tst_Moc::environmentIncludePaths()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QFETCH(QString, cmdline);
QFETCH(QString, varname);
@ -1576,7 +1576,7 @@ void tst_Moc::warnOnPropertyWithoutREAD()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
const QString header = m_sourceDirectory + QStringLiteral("/warn-on-property-without-read.h");
proc.start(m_moc, QStringList(header));
@ -1687,7 +1687,7 @@ void tst_Moc::warnOnVirtualSignal()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
const QString header = m_sourceDirectory + QStringLiteral("/pure-virtual-signals.h");
proc.start(m_moc, QStringList(header));
@ -1819,7 +1819,7 @@ void tst_Moc::notifyError()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
const QString header = m_sourceDirectory + QStringLiteral("/error-on-wrong-notify.h");
proc.start(m_moc, QStringList(header));
@ -2165,6 +2165,7 @@ void tst_Moc::warnings()
expectedStdErr.replace(lineNumberRe, "(\\1):");
#endif
#if QT_CONFIG(process)
QProcess proc;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
@ -2187,6 +2188,9 @@ void tst_Moc::warnings()
if (expectedStdOut != "IGNORE_ALL_STDOUT")
QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut);
QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed().remove('\r'), expectedStdErr);
#else
QSKIP("Only tested if QProcess is available");
#endif
}
class tst_Moc::PrivateClass : public QObject {
@ -3407,7 +3411,7 @@ void tst_Moc::preprocessorOnly()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
proc.start(m_moc, QStringList() << "-E" << m_sourceDirectory + QStringLiteral("/pp-dollar-signs.h"));
QVERIFY(proc.waitForFinished());
@ -3428,7 +3432,7 @@ void tst_Moc::unterminatedFunctionMacro()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && QT_CONFIG(process)
QProcess proc;
proc.start(m_moc, QStringList() << "-E" << m_sourceDirectory + QStringLiteral("/unterminated-function-macro.h"));
QVERIFY(proc.waitForFinished());
@ -3731,7 +3735,7 @@ void tst_Moc::optionsFileError()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if !defined(QT_NO_PROCESS)
#if QT_CONFIG(process)
QFETCH(QString, optionsArgument);
QProcess p;
p.start(m_moc, QStringList(optionsArgument));

View File

@ -35,7 +35,9 @@
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QProcess>
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
#include <QtCore/private/qeventloop_p.h>
#include <QtGui/QFontDatabase>
@ -1432,7 +1434,7 @@ void tst_QApplication::testDeleteLaterProcessEvents()
*/
void tst_QApplication::desktopSettingsAware()
{
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QString path;
{
// We need an application object for QFINDTESTDATA to work
@ -2121,7 +2123,7 @@ void tst_QApplication::qtbug_12673()
QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application");
path += "modal";
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QProcess testProcess;
QStringList arguments;
testProcess.start(path, arguments);
@ -2254,7 +2256,7 @@ void tst_QApplication::settableStyleHints()
executed *after* the destruction of QApplication.
*/
Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
#endif
#ifndef QT_NO_FILESYSTEMWATCHER
@ -2279,7 +2281,7 @@ void tst_QApplication::globalStaticObjectDestruction()
int argc = 1;
QApplication app(argc, &argv0);
QVERIFY(tst_qapp_locale());
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QVERIFY(tst_qapp_process());
#endif
#ifndef QT_NO_FILESYSTEMWATCHER

View File

@ -606,7 +606,7 @@ void tst_QUndoGroup::addStackAndDie()
void tst_QUndoGroup::commandTextFormat()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No QProcess available");
#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);

View File

@ -3088,7 +3088,7 @@ void tst_QUndoStack::undoLimit()
void tst_QUndoStack::commandTextFormat()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("No QProcess available");
#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);

View File

@ -31,7 +31,9 @@
#include <QBuffer>
#include <QHostInfo>
#include <QSysInfo>
#include <QProcess>
#if QT_CONFIG(process)
# include <QProcess>
#endif
#include <QFileInfo>
#include <QDir>
#include <QTime>
@ -88,7 +90,7 @@ PlatformInfo PlatformInfo::localHostInfo()
#if QT_VERSION >= 0x050000
pi.insert(PI_QtBuildMode, QLibraryInfo::isDebugBuild() ? QLS("QtDebug") : QLS("QtRelease"));
#endif
#if defined(Q_OS_LINUX)
#if defined(Q_OS_LINUX) && QT_CONFIG(process)
pi.insert(PI_OSName, QLS("Linux"));
QProcess uname;
uname.start(QLS("uname"), QStringList() << QLS("-r"));
@ -104,7 +106,7 @@ PlatformInfo PlatformInfo::localHostInfo()
pi.insert(PI_OSName, QLS("Other"));
#endif
#ifndef QT_NO_PROCESS
#if QT_CONFIG(process)
QProcess git;
QString cmd;
QStringList args;
@ -140,7 +142,7 @@ PlatformInfo PlatformInfo::localHostInfo()
pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb));
}
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
return pi;
}

View File

@ -28,7 +28,9 @@
#include "qbaselinetest.h"
#include "baselineprotocol.h"
#include <QtCore/QProcess>
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
#include <QtCore/QDir>
#define MAXCMDLINEARGS 128
@ -126,7 +128,7 @@ void addClientProperty(const QString& key, const QString& value)
*/
void fetchCustomClientProperties()
{
#ifdef QT_NO_PROCESS
#if !QT_CONFIG(process)
QSKIP("This test requires QProcess support");
#else
QString script = "hostinfo.sh"; //### TBD: Windows implementation (hostinfo.bat)
@ -151,7 +153,7 @@ void fetchCustomClientProperties()
else
qDebug() << "Unparseable script output ignored:" << line;
}
#endif // !QT_NO_PROCESS
#endif // QT_CONFIG(process)
}

View File

@ -5,7 +5,7 @@ SUBDIRS = \
qfile \
qfileinfo \
qiodevice \
qprocess \
qtemporaryfile \
qtextstream
qtConfig(process): SUBDIRS += qprocess

View File

@ -33,15 +33,11 @@ class tst_QProcess : public QObject
{
Q_OBJECT
#if !defined(QT_NO_PROCESS)
private slots:
void echoTest_performance();
#endif // QT_NO_PROCESS
};
#if !defined(QT_NO_PROCESS)
void tst_QProcess::echoTest_performance()
{
QProcess process;
@ -87,7 +83,5 @@ void tst_QProcess::echoTest_performance()
QVERIFY(process.waitForFinished());
}
#endif // QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
#include "tst_bench_qprocess.moc"