summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 6f07538c8d..04ce504189 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -68,6 +68,7 @@ private slots:
private:
QString m_appDir;
+ QStringList m_baseEnvironment;
};
static QtMsgType s_type;
@@ -99,6 +100,14 @@ void tst_qmessagehandler::initTestCase()
m_appDir = QFINDTESTDATA("app");
QVERIFY2(!m_appDir.isEmpty(), qPrintable(
QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath())));
+
+ m_baseEnvironment = QProcess::systemEnvironment();
+ for (int i = 0; i < m_baseEnvironment.count(); ++i) {
+ if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) {
+ m_baseEnvironment.removeAt(i);
+ break;
+ }
+ }
}
void tst_qmessagehandler::cleanup()
@@ -638,7 +647,7 @@ void tst_qmessagehandler::qMessagePattern()
//
// test QT_MESSAGE_PATTERN
//
- QStringList environment = QProcess::systemEnvironment();
+ QStringList environment = m_baseEnvironment;
// %{file} is tricky because of shadow builds
environment.prepend("QT_MESSAGE_PATTERN=\"%{type} %{appname} %{line} %{function} %{message}\"");
process.setEnvironment(environment);
@@ -660,7 +669,7 @@ void tst_qmessagehandler::qMessagePattern()
QVERIFY(output.contains("critical tst_qlogging 58 main qCritical"));
QVERIFY(output.contains("debug tst_qlogging 62 main qDebug2"));
- environment = QProcess::systemEnvironment();
+ environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{message}\"");
process.setEnvironment(environment);
@@ -708,7 +717,7 @@ void tst_qmessagehandler::qMessagePatternIf()
QProcess process;
const QString appExe = m_appDir + "/app";
- QStringList environment = QProcess::systemEnvironment();
+ QStringList environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}\"");
process.setEnvironment(environment);
process.start(appExe);
@@ -732,7 +741,7 @@ void tst_qmessagehandler::qMessagePatternIf()
//
// Tests some errors
//
- environment = QProcess::systemEnvironment();
+ environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{endif} %{if-warning}\"");
process.setEnvironment(environment);
@@ -749,7 +758,7 @@ void tst_qmessagehandler::qMessagePatternIf()
QVERIFY(output.contains("QT_MESSAGE_PATTERN: missing %{endif}"));
- environment = QProcess::systemEnvironment();
+ environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"A %{if-debug}DEBUG%{if-warning}WARNING%{endif} %{message} \"");
process.setEnvironment(environment);