summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-04-20 13:22:01 +0200
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-06-09 07:43:51 +0300
commiteeccdfbd54359d26690fdb53610cd122a12db09f (patch)
tree670ecdd5249f3b37e9b20e2aefac67cd0d761e5d
parentf092ad0a2ef4e7c6b8230a5289c25725ff47bcdd (diff)
downloadqt-creator-eeccdfbd54359d26690fdb53610cd122a12db09f.tar.gz
Fix getting source file name on OSX
If the current executable is an app bundle the source file location is given as relative path from the app bundles location instead of the "real" executable somewhere inside the app bundle. Change-Id: I37ad2daae5a7ebde65c0e76a8a9a7837401bc749 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--plugins/autotest/testxmloutputreader.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/autotest/testxmloutputreader.cpp b/plugins/autotest/testxmloutputreader.cpp
index 8d0fa72235..ae6c223f93 100644
--- a/plugins/autotest/testxmloutputreader.cpp
+++ b/plugins/autotest/testxmloutputreader.cpp
@@ -20,6 +20,8 @@
#include "testxmloutputreader.h"
#include "testresult.h"
+#include <utils/hostosinfo.h>
+
#include <QRegExp>
#include <QProcess>
#include <QFileInfo>
@@ -47,6 +49,17 @@ static QString decode(const QString& original)
return result;
}
+static QString constructSourceFilePath(const QString &path, const QString &filePath,
+ const QString &app)
+{
+ if (Utils::HostOsInfo::isMacHost() && !app.isEmpty()) {
+ const QString fileName(QFileInfo(app).fileName());
+ return QFileInfo(path.left(path.lastIndexOf(fileName + QLatin1String(".app"))), filePath)
+ .canonicalFilePath();
+ }
+ return QFileInfo(path, filePath).canonicalFilePath();
+}
+
static bool xmlStartsWith(const QString &code, const QString &start, QString &result)
{
if (code.startsWith(start)) {
@@ -229,7 +242,8 @@ void TestXmlOutputReader::processOutput()
if (line.endsWith(QLatin1String("/>"))) {
TestResult testResult(className, testCase, dataTag, result, description);
if (!file.isEmpty())
- file = QFileInfo(m_testApplication->workingDirectory(), file).canonicalFilePath();
+ file = constructSourceFilePath(m_testApplication->workingDirectory(), file,
+ m_testApplication->program());
testResult.setFileName(file);
testResult.setLine(lineNumber);
testResultCreated(testResult);
@@ -244,7 +258,8 @@ void TestXmlOutputReader::processOutput()
if (line == QLatin1String("</Message>") || line == QLatin1String("</Incident>")) {
TestResult testResult(className, testCase, dataTag, result, description);
if (!file.isEmpty())
- file = QFileInfo(m_testApplication->workingDirectory(), file).canonicalFilePath();
+ file = constructSourceFilePath(m_testApplication->workingDirectory(), file,
+ m_testApplication->program());
testResult.setFileName(file);
testResult.setLine(lineNumber);
testResultCreated(testResult);