Fix construction of source file for test results

Change-Id: I9dff118aa8f8871812e1881f0c73220d56ab16d5
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-01-15 12:24:10 +01:00
parent 06e02480f4
commit dc4e955126

View File

@@ -210,9 +210,11 @@ void TestOutputReader::processOutput()
result = TestResult::resultFromString( result = TestResult::resultFromString(
attributes.value(QStringLiteral("type")).toString()); attributes.value(QStringLiteral("type")).toString());
file = decode(attributes.value(QStringLiteral("file")).toString()); file = decode(attributes.value(QStringLiteral("file")).toString());
if (!file.isEmpty()) if (!file.isEmpty()) {
file = constructSourceFilePath(m_testApplication->workingDirectory(), file, const QString base = QFileInfo(m_testApplication->program()).absolutePath();
file = constructSourceFilePath(base, file,
m_testApplication->program()); m_testApplication->program());
}
lineNumber = attributes.value(QStringLiteral("line")).toInt(); lineNumber = attributes.value(QStringLiteral("line")).toInt();
} else if (currentTag == QStringLiteral("BenchmarkResult")) { } else if (currentTag == QStringLiteral("BenchmarkResult")) {
const QXmlStreamAttributes &attributes = xmlReader.attributes(); const QXmlStreamAttributes &attributes = xmlReader.attributes();
@@ -400,8 +402,8 @@ void TestOutputReader::processGTestOutput()
int firstColon = description.indexOf(QLatin1Char(':')); int firstColon = description.indexOf(QLatin1Char(':'));
if (firstColon != -1) { if (firstColon != -1) {
int secondColon = description.indexOf(QLatin1Char(':'), firstColon + 1); int secondColon = description.indexOf(QLatin1Char(':'), firstColon + 1);
QString file = constructSourceFilePath(m_testApplication->workingDirectory(), const QString base = QFileInfo(m_testApplication->program()).absolutePath();
description.left(firstColon), QString file = constructSourceFilePath(base, description.left(firstColon),
m_testApplication->program()); m_testApplication->program());
QString line = description.mid(firstColon + 1, secondColon - firstColon - 1); QString line = description.mid(firstColon + 1, secondColon - firstColon - 1);
testResult->setFileName(file); testResult->setFileName(file);