summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-03-01 10:37:58 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-01 12:16:57 +0100
commit5cd56df0f2ac09572a90a07ffa1cda02d5d2d2f8 (patch)
tree98d498291291a9589e8aa3a3bda59c2f1da26f61 /tests/auto/tools
parentfe092d1a6da74c6473ee4e563498821a1e162955 (diff)
qmake-test: Fix jom/nmake handling on Windows.
The test fails if MAKEFLAGS is set up for jom since the test always uses nmake. Remove MAKEFLAGS from the process environment. Change-Id: Idaed3cc964832b83c282a59fc5257572c520b882 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/qmake/testcompiler.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp
index 97c640b28f..4e5dc26eac 100644
--- a/tests/auto/tools/qmake/testcompiler.cpp
+++ b/tests/auto/tools/qmake/testcompiler.cpp
@@ -132,13 +132,34 @@ bool TestCompiler::errorOut()
return false;
}
+// Return the system environment, remove MAKEFLAGS variable in
+// case the CI uses jom passing flags incompatible to nmake
+// or vice versa.
+static inline QStringList systemEnvironment()
+{
+#ifdef Q_OS_WIN
+ static QStringList result;
+ if (result.isEmpty()) {
+ foreach (const QString &variable, QProcess::systemEnvironment()) {
+ if (variable.startsWith(QStringLiteral("MAKEFLAGS="), Qt::CaseInsensitive)) {
+ qWarning("Removing environment setting '%s'", qPrintable(variable));
+ } else {
+ result.push_back(variable);
+ }
+ }
+ }
+#else
+ static const QStringList result = QProcess::systemEnvironment();
+#endif // ifdef Q_OS_WIN
+ return result;
+}
+
bool TestCompiler::runCommand( QString cmdline, bool expectFail )
{
testOutput_.append("Running command: " + cmdline);
QProcess child;
- if (!environment_.empty())
- child.setEnvironment(QProcess::systemEnvironment() + environment_);
+ child.setEnvironment(systemEnvironment() + environment_);
child.start(cmdline);
if (!child.waitForStarted(-1)) {