summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-11-23 12:25:17 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-02-27 15:44:46 +0000
commit44af54419eaceb27bb729717d6363917fd6bb819 (patch)
treeb111875dd8cb8ff653cb0e27cfa766933ca6d589 /tests/auto/corelib/tools
parent85b30fda7ceccecfd3938703979b3431bdedc9a2 (diff)
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>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp12
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp12
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp18
3 files changed, 23 insertions, 19 deletions
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index a54ad3d9c9..10398f1a99 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -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)
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 42bfb3603d..06b0fe8d51 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -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) \
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index 7bebe5e9e0..e8f56fc1d3 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -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)