From e10189efb3127583912937a46581748b84d7708b Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 15 Jun 2016 14:30:16 +0200 Subject: [PATCH] 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 Reviewed-by: Christian Stenger --- .../autotest/gtest/gtestoutputreader.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/plugins/autotest/gtest/gtestoutputreader.cpp b/src/plugins/autotest/gtest/gtestoutputreader.cpp index eca5e4b76b9..2d40f8e6dcf 100644 --- a/src/plugins/autotest/gtest/gtestoutputreader.cpp +++ b/src/plugins/autotest/gtest/gtestoutputreader.cpp @@ -55,6 +55,7 @@ void GTestOutputReader::processOutput() static QRegExp testSetFail(QStringLiteral("^\\[ FAILED \\] (.*) \\((.*)\\)$")); static QRegExp disabledTests(QStringLiteral("^ YOU HAVE (\\d+) DISABLED TESTS?$")); static QRegExp failureLocation(QStringLiteral("^(.*):(\\d+): Failure$")); + static QRegExp errorLocation(QStringLiteral("^(.*)\\((\\d+)\\): error:.*$")); static QRegExp iterations(QStringLiteral("^Repeating all tests \\(iteration (\\d+)\\) . . .$")); while (m_testApplication->canReadLine()) { @@ -148,13 +149,19 @@ void GTestOutputReader::processOutput() testResult->setDescription(m_description); foreach (const QString &output, m_description.split(QLatin1Char('\n'))) { - if (failureLocation.exactMatch(output)) { - QString file = constructSourceFilePath(m_buildDir, failureLocation.cap(1)); - if (file.isEmpty()) - continue; - testResult->setFileName(file); - testResult->setLine(failureLocation.cap(2).toInt()); - break; + QRegExp *match = 0; + if (failureLocation.exactMatch(output)) + match = &failureLocation; + else if (errorLocation.exactMatch(output)) + match = &errorLocation; + + 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));