forked from qt-creator/qt-creator
AutoTest: Create tree item for each failure
Introduce special location item for this purpose. Task-number: QTCREATORBUG-20967 Change-Id: Icb6c6ec8ff9d2e4e8e3d13834427bae50d74bd2a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -144,7 +144,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
|
||||
TestResultPtr testResult = createDefaultResult();
|
||||
testResult->setResult(Result::Fail);
|
||||
m_description.chop(1);
|
||||
testResult->setDescription(m_description);
|
||||
QStringList resultDescription;
|
||||
|
||||
for (const QString &output : m_description.split('\n')) {
|
||||
QRegExp *match = nullptr;
|
||||
@@ -152,17 +152,23 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
|
||||
match = &failureLocation;
|
||||
else if (errorLocation.exactMatch(output))
|
||||
match = &errorLocation;
|
||||
|
||||
if (match) {
|
||||
testResult->setLine(match->cap(2).toInt());
|
||||
|
||||
QString file = constructSourceFilePath(m_buildDir, match->cap(1));
|
||||
if (!file.isEmpty())
|
||||
testResult->setFileName(file);
|
||||
|
||||
break;
|
||||
if (!match) {
|
||||
resultDescription << output;
|
||||
continue;
|
||||
}
|
||||
testResult->setDescription(resultDescription.join('\n'));
|
||||
reportResult(testResult);
|
||||
resultDescription.clear();
|
||||
|
||||
testResult = createDefaultResult();
|
||||
testResult->setResult(Result::MessageLocation);
|
||||
testResult->setLine(match->cap(2).toInt());
|
||||
QString file = constructSourceFilePath(m_buildDir, match->cap(1));
|
||||
if (!file.isEmpty())
|
||||
testResult->setFileName(file);
|
||||
resultDescription << output;
|
||||
}
|
||||
testResult->setDescription(resultDescription.join('\n'));
|
||||
reportResult(testResult);
|
||||
m_description.clear();
|
||||
testResult = createDefaultResult();
|
||||
|
||||
Reference in New Issue
Block a user