AutoTest: Fix extraction of failure location

It seems the failure location output is slightly different when
using an MSVC compiler.

Change-Id: I8f07debac505a0429f4ea1644d076ffcc3304f25
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2016-06-15 14:30:16 +02:00
parent d7dc7159b2
commit e10189efb3

View File

@@ -55,6 +55,7 @@ void GTestOutputReader::processOutput()
static QRegExp testSetFail(QStringLiteral("^\\[ FAILED \\] (.*) \\((.*)\\)$")); static QRegExp testSetFail(QStringLiteral("^\\[ FAILED \\] (.*) \\((.*)\\)$"));
static QRegExp disabledTests(QStringLiteral("^ YOU HAVE (\\d+) DISABLED TESTS?$")); static QRegExp disabledTests(QStringLiteral("^ YOU HAVE (\\d+) DISABLED TESTS?$"));
static QRegExp failureLocation(QStringLiteral("^(.*):(\\d+): Failure$")); static QRegExp failureLocation(QStringLiteral("^(.*):(\\d+): Failure$"));
static QRegExp errorLocation(QStringLiteral("^(.*)\\((\\d+)\\): error:.*$"));
static QRegExp iterations(QStringLiteral("^Repeating all tests \\(iteration (\\d+)\\) . . .$")); static QRegExp iterations(QStringLiteral("^Repeating all tests \\(iteration (\\d+)\\) . . .$"));
while (m_testApplication->canReadLine()) { while (m_testApplication->canReadLine()) {
@@ -148,13 +149,19 @@ void GTestOutputReader::processOutput()
testResult->setDescription(m_description); testResult->setDescription(m_description);
foreach (const QString &output, m_description.split(QLatin1Char('\n'))) { foreach (const QString &output, m_description.split(QLatin1Char('\n'))) {
if (failureLocation.exactMatch(output)) { QRegExp *match = 0;
QString file = constructSourceFilePath(m_buildDir, failureLocation.cap(1)); if (failureLocation.exactMatch(output))
if (file.isEmpty()) match = &failureLocation;
continue; else if (errorLocation.exactMatch(output))
testResult->setFileName(file); match = &errorLocation;
testResult->setLine(failureLocation.cap(2).toInt());
break; if (match) {
QString file = constructSourceFilePath(m_buildDir, match->cap(1));
if (!file.isEmpty()) {
testResult->setFileName(file);
testResult->setLine(match->cap(2).toInt());
break;
}
} }
} }
m_futureInterface.reportResult(TestResultPtr(testResult)); m_futureInterface.reportResult(TestResultPtr(testResult));