diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-06-13 11:28:37 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-06-13 11:29:01 +0200 |
commit | c5b4937a8c7bf02741f40dd8cac43f499fa0fc9b (patch) | |
tree | 7e38934126f52c3705eb84e0dba4a8971e2a15f9 /tests/auto/blackbox | |
parent | 67b2af7814c1c322eea3fca46da80b1040b87ba3 (diff) | |
parent | c230637f52f54db2bde1632041489505a03ab7ae (diff) |
Merge remote-tracking branch 'origin/1.2'
Change-Id: Ic33a2440fae27b4ada5b950f3a411916e8ac17f7
Diffstat (limited to 'tests/auto/blackbox')
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 13 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 5ffb43961..cd8a0145d 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -38,6 +38,7 @@ #include <tools/profile.h> #include <QLocale> +#include <QRegExp> #include <QTemporaryFile> #include <QScriptEngine> #include <QScriptValue> @@ -102,6 +103,8 @@ int TestBlackbox::runQbs(const QbsRunParameters ¶ms) m_qbsStderr = process.readAllStandardError(); m_qbsStdout = process.readAllStandardOutput(); + sanitizeOutput(&m_qbsStderr); + sanitizeOutput(&m_qbsStdout); if ((process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) && !params.expectFailure) { if (!m_qbsStderr.isEmpty()) @@ -177,6 +180,12 @@ QByteArray TestBlackbox::unifiedLineEndings(const QByteArray &ba) } } +void TestBlackbox::sanitizeOutput(QByteArray *ba) +{ + if (HostOsInfo::isWindowsHost()) + ba->replace('\r', ""); +} + void TestBlackbox::initTestCase() { QVERIFY(regularFileExists(qbsExecutableFilePath)); @@ -1557,7 +1566,7 @@ void TestBlackbox::erroneousFiles_data() { QTest::addColumn<QString>("errorMessage"); QTest::newRow("nonexistentWorkingDir") - << "The working directory '/does/not/exist' for process 'ls' is invalid."; + << "The working directory '/does/not/exist' for process '.*ls' is invalid."; } void TestBlackbox::erroneousFiles() @@ -1568,7 +1577,7 @@ void TestBlackbox::erroneousFiles() params.expectFailure = true; QVERIFY(runQbs(params) != 0); QString err = QString::fromLocal8Bit(m_qbsStderr); - if (!err.contains(errorMessage)) { + if (!err.contains(QRegExp(errorMessage))) { qDebug() << "Output: " << err; qDebug() << "Expected: " << errorMessage; QFAIL("Unexpected error message."); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index fc9ae76b5..c80e2e046 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -91,6 +91,7 @@ protected: void touch(const QString &fn); static void waitForNewTimestamp(); static QByteArray unifiedLineEndings(const QByteArray &ba); + static void sanitizeOutput(QByteArray *ba); public slots: void initTestCase(); |