aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/blackbox')
-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();