forked from qt-creator/qt-creator
AutoTest: Fix constructing of source file path
Changes in Utils::FilePath need some adjustments to fix the expected behavior. Fixes: QTCREATORBUG-25979 Change-Id: Ife35a68458db9ae7c08637687a3fc9acd7d058e9 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -179,7 +179,7 @@ void GTestOutputReader::processOutputLine(const QByteArray &outputLine)
|
||||
testResult->setResult(type);
|
||||
testResult->setLine(match.captured(3).toInt());
|
||||
const Utils::FilePath file = constructSourceFilePath(m_buildDir, match.captured(2));
|
||||
if (!file.isEmpty())
|
||||
if (file.exists())
|
||||
testResult->setFileName(file);
|
||||
testResult->setDescription(match.captured(4));
|
||||
reportResult(testResult);
|
||||
@@ -247,7 +247,7 @@ void GTestOutputReader::handleDescriptionAndReportResult(TestResultPtr testResul
|
||||
testResult->setResult(ResultType::MessageLocation);
|
||||
testResult->setLine(innerMatch.captured(2).toInt());
|
||||
const Utils::FilePath file = constructSourceFilePath(m_buildDir, innerMatch.captured(1));
|
||||
if (!file.isEmpty())
|
||||
if (file.exists())
|
||||
testResult->setFileName(file);
|
||||
resultDescription << output;
|
||||
}
|
||||
|
@@ -39,11 +39,10 @@
|
||||
namespace Autotest {
|
||||
|
||||
Utils::FilePath TestOutputReader::constructSourceFilePath(const Utils::FilePath &path,
|
||||
const QString &filePath)
|
||||
const QString &file)
|
||||
{
|
||||
if (!filePath.isEmpty() && filePath.at(0) != '.')
|
||||
return Utils::FilePath::fromFileInfo(QFileInfo(filePath));
|
||||
return (path / filePath).canonicalPath();
|
||||
const Utils::FilePath filePath = path.resolvePath(file);
|
||||
return filePath.exists() ? filePath : Utils::FilePath();
|
||||
}
|
||||
|
||||
TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface,
|
||||
@@ -177,9 +176,8 @@ void TestOutputReader::checkForSanitizerOutput(const QByteArray &line)
|
||||
if (m_sanitizerOutputMode == SanitizerOutputMode::Ubsan) {
|
||||
const Utils::FilePath path = constructSourceFilePath(m_buildDir, match.captured(1));
|
||||
// path may be empty if not existing - so, provide at least what we have
|
||||
m_sanitizerResult->setFileName(path.isEmpty()
|
||||
? Utils::FilePath::fromString(match.captured(1))
|
||||
: path);
|
||||
m_sanitizerResult->setFileName(
|
||||
path.exists() ? path : Utils::FilePath::fromString(match.captured(1)));
|
||||
m_sanitizerResult->setLine(match.captured(2).toInt());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user