summaryrefslogtreecommitdiffstats
path: root/src/tools/testrunner/testrunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/testrunner/testrunner.cpp')
-rw-r--r--src/tools/testrunner/testrunner.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tools/testrunner/testrunner.cpp b/src/tools/testrunner/testrunner.cpp
index 33f03a69..ce10cefd 100644
--- a/src/tools/testrunner/testrunner.cpp
+++ b/src/tools/testrunner/testrunner.cpp
@@ -4,7 +4,7 @@
** Copyright (C) 2018 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the Luxoft Application Manager.
+** This file is part of the Qt Application Manager.
**
** $QT_BEGIN_LICENSE:LGPL-QTAS$
** Commercial License Usage
@@ -47,6 +47,8 @@
#include <QQmlEngine>
#include <QRegExp>
#include <QRegularExpression>
+#include <QDir>
+#include <QFileInfo>
#include <qlogging.h>
#include <QtTest/qtestsystem.h>
@@ -168,19 +170,26 @@ static QObject *amTest(QQmlEngine *engine, QJSEngine *jsEngine)
return AmTest::instance();
}
-void TestRunner::initialize(const QStringList &testRunnerArguments)
+void TestRunner::initialize(const QString &testFile, const QStringList &testRunnerArguments)
{
Q_ASSERT(!testRunnerArguments.isEmpty());
+ const QString name = QFileInfo(testRunnerArguments.at(0)).fileName() + "::" + QDir().relativeFilePath(testFile);
+ static const char *programName = strdup(name.toLocal8Bit().constData());
+ QuickTestResult::setProgramName(programName);
+
// Convert all the arguments back into a char * array.
// These need to be alive as long as the program is running!
static QVector<char *> testArgV;
for (const auto &arg : testRunnerArguments)
testArgV << strdup(arg.toLocal8Bit().constData());
- atexit([]() { std::for_each(testArgV.constBegin(), testArgV.constEnd(), free); });
+
+ atexit([]() {
+ free(const_cast<char*>(programName));
+ std::for_each(testArgV.constBegin(), testArgV.constEnd(), free);
+ });
QuickTestResult::setCurrentAppname(testArgV.constFirst());
- QuickTestResult::setProgramName(testArgV.constFirst());
// Allocate a QuickTestResult to create QBenchmarkGlobalData, otherwise the benchmark options don't work
QuickTestResult result;