forked from qt-creator/qt-creator
AutoTest: Fix parsing of file/line information for gtest...
...this was wrong in cases where we have additional output before this information. Change-Id: I6f55c48815217da98078d40e5a0f1f4ce4ad8a77 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
@@ -322,6 +322,7 @@ void GTestOutputReader::processOutput()
|
|||||||
static QRegExp testSetSuccess(QStringLiteral("^\\[ OK \\] (.*) \\((.*)\\)$"));
|
static QRegExp testSetSuccess(QStringLiteral("^\\[ OK \\] (.*) \\((.*)\\)$"));
|
||||||
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$"));
|
||||||
|
|
||||||
while (m_testApplication->canReadLine()) {
|
while (m_testApplication->canReadLine()) {
|
||||||
if (m_futureInterface.isCanceled())
|
if (m_futureInterface.isCanceled())
|
||||||
@@ -401,15 +402,18 @@ void GTestOutputReader::processOutput()
|
|||||||
testResult->setResult(Result::Fail);
|
testResult->setResult(Result::Fail);
|
||||||
m_description.chop(1);
|
m_description.chop(1);
|
||||||
testResult->setDescription(m_description);
|
testResult->setDescription(m_description);
|
||||||
int firstColon = m_description.indexOf(QLatin1Char(':'));
|
|
||||||
if (firstColon != -1) {
|
|
||||||
int secondColon = m_description.indexOf(QLatin1Char(':'), firstColon + 1);
|
|
||||||
const QString base = QFileInfo(m_testApplication->program()).absolutePath();
|
const QString base = QFileInfo(m_testApplication->program()).absolutePath();
|
||||||
QString file = constructSourceFilePath(base, m_description.left(firstColon),
|
foreach (const QString &output, m_description.split(QLatin1Char('\n'))) {
|
||||||
|
if (failureLocation.exactMatch(output)) {
|
||||||
|
QString file = constructSourceFilePath(base, failureLocation.cap(1),
|
||||||
m_testApplication->program());
|
m_testApplication->program());
|
||||||
QString line = m_description.mid(firstColon + 1, secondColon - firstColon - 1);
|
if (file.isEmpty())
|
||||||
|
continue;
|
||||||
testResult->setFileName(file);
|
testResult->setFileName(file);
|
||||||
testResult->setLine(line.toInt());
|
testResult->setLine(failureLocation.cap(2).toInt());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_futureInterface.reportResult(testResult);
|
m_futureInterface.reportResult(testResult);
|
||||||
m_description.clear();
|
m_description.clear();
|
||||||
|
Reference in New Issue
Block a user