aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-06-13 11:28:37 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-06-13 11:29:01 +0200
commitc5b4937a8c7bf02741f40dd8cac43f499fa0fc9b (patch)
tree7e38934126f52c3705eb84e0dba4a8971e2a15f9 /tests
parent67b2af7814c1c322eea3fca46da80b1040b87ba3 (diff)
parentc230637f52f54db2bde1632041489505a03ab7ae (diff)
Merge remote-tracking branch 'origin/1.2'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp13
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
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 &params)
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();