summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-09-17 11:17:03 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-09-17 11:35:08 +0000
commitb74ec903a700729fbbfe0dbef98ba8ef0788a0ab (patch)
treeb6e6dde77f7729d48d866e80de1b48f6cfdb4187
parent18be09f55af08ba3ffc4bb1a68b2f34f5e32238c (diff)
downloadqt-creator-b74ec903a700729fbbfe0dbef98ba8ef0788a0ab.tar.gz
AutoTest: Fix construction of file paths for catch results
Using Catch2 on Windows with CMake lead to not having file information as the file information was generated differently. Change-Id: I3e0951b517a4a8a86f1ffa1009c1a2815565f3b3 Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/autotest/catch/catchoutputreader.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp
index 68d4f0b260..7837cce3f9 100644
--- a/src/plugins/autotest/catch/catchoutputreader.cpp
+++ b/src/plugins/autotest/catch/catchoutputreader.cpp
@@ -27,6 +27,7 @@
#include "../testtreeitem.h"
+#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -172,10 +173,12 @@ TestResultPtr CatchOutputReader::createDefaultResult() const
result = new CatchResult(id(), m_testCaseInfo.first().name);
result->setDescription(m_testCaseInfo.last().name);
result->setLine(m_testCaseInfo.last().line);
- const QString &relativePathFromBuildDir = m_testCaseInfo.last().filename;
- if (!relativePathFromBuildDir.isEmpty()) {
- const QFileInfo fileInfo(m_buildDir + '/' + relativePathFromBuildDir);
- result->setFileName(fileInfo.canonicalFilePath());
+ const QFileInfo fileInfo(m_testCaseInfo.last().filename);
+ const Utils::FilePath filePath = Utils::FilePath::fromFileInfo(fileInfo);
+ if (!filePath.isEmpty()) {
+ result->setFileName(fileInfo.isAbsolute()
+ ? filePath.toString()
+ : QFileInfo(m_buildDir + '/' + filePath.toString()).canonicalFilePath());
}
} else {
result = new CatchResult(id(), QString());