AutoTest: Use Utils::FilePath for files and directories

Still some missing bits as some QString members had different meanings
depending on their context.

Change-Id: Ib48eab54498974a26bbd5123cbffeefee5f7e79c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-05-26 15:50:03 +02:00
parent e8286088b1
commit 5525f2b112
70 changed files with 376 additions and 371 deletions

View File

@@ -38,8 +38,16 @@
namespace Autotest {
Utils::FilePath TestOutputReader::constructSourceFilePath(const Utils::FilePath &path,
const QString &filePath)
{
if (!filePath.isEmpty() && filePath.at(0) != '.')
return Utils::FilePath::fromFileInfo(QFileInfo(filePath));
return (path / filePath).canonicalPath();
}
TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface,
QProcess *testApplication, const QString &buildDirectory)
QProcess *testApplication, const Utils::FilePath &buildDirectory)
: m_futureInterface(futureInterface)
, m_testApplication(testApplication)
, m_buildDir(buildDirectory)
@@ -167,9 +175,11 @@ void TestOutputReader::checkForSanitizerOutput(const QByteArray &line)
m_sanitizerLines.append("Sanitizer Issue");
m_sanitizerLines.append(lineStr);
if (m_sanitizerOutputMode == SanitizerOutputMode::Ubsan) {
const QString path = QFileInfo(m_buildDir, match.captured(1)).canonicalFilePath();
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() ? match.captured(1) : path);
m_sanitizerResult->setFileName(path.isEmpty()
? Utils::FilePath::fromString(match.captured(1))
: path);
m_sanitizerResult->setLine(match.captured(2).toInt());
}
}