summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc
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/tools/moc
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/tools/moc')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index ecf6c7e992..e746800c9f 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -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));