diff options
-rw-r--r-- | src/tools/appman/appman.cpp | 4 | ||||
-rw-r--r-- | src/tools/testrunner/testrunner.cpp | 15 | ||||
-rw-r--r-- | src/tools/testrunner/testrunner.h | 2 | ||||
-rw-r--r-- | tests/manual/monitormodel/main.qml | 2 | ||||
-rw-r--r-- | util/bash/appman-prompt | 2 |
5 files changed, 18 insertions, 7 deletions
diff --git a/src/tools/appman/appman.cpp b/src/tools/appman/appman.cpp index ba0c620d..36b0ac45 100644 --- a/src/tools/appman/appman.cpp +++ b/src/tools/appman/appman.cpp @@ -103,7 +103,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) StartupTimer::instance()->checkpoint("after command line parse"); #if defined(AM_TESTRUNNER) - TestRunner::initialize(cfg.testRunnerArguments()); + TestRunner::initialize(cfg.mainQmlFile(), cfg.testRunnerArguments()); + qInfo().nospace().noquote() << "\nTEST: " << cfg.mainQmlFile() << " in " + << (cfg.forceMultiProcess() ? "multi" : "single") << "-process mode"; cfg.setForceVerbose(qEnvironmentVariableIsSet("VERBOSE_TEST")); qInfo() << "Verbose mode is" << (cfg.verbose() ? "on" : "off") << "(changed by (un)setting $VERBOSE_TEST)"; #endif diff --git a/src/tools/testrunner/testrunner.cpp b/src/tools/testrunner/testrunner.cpp index 9d4c4e9f..074f592b 100644 --- a/src/tools/testrunner/testrunner.cpp +++ b/src/tools/testrunner/testrunner.cpp @@ -47,6 +47,8 @@ #include <QQmlEngine> #include <QRegExp> #include <QRegularExpression> +#include <QDir> +#include <QFileInfo> #include <qlogging.h> #include <QtTest/qtestsystem.h> @@ -156,19 +158,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; diff --git a/src/tools/testrunner/testrunner.h b/src/tools/testrunner/testrunner.h index 5cc1a50d..69ef4dc3 100644 --- a/src/tools/testrunner/testrunner.h +++ b/src/tools/testrunner/testrunner.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE_AM class TestRunner { public: - static void initialize(const QStringList &testRunnerArguments); + static void initialize(const QString &testFile, const QStringList &testRunnerArguments); static int exec(QQmlEngine *engine); }; diff --git a/tests/manual/monitormodel/main.qml b/tests/manual/monitormodel/main.qml index 3ac2c727..9bd292ca 100644 --- a/tests/manual/monitormodel/main.qml +++ b/tests/manual/monitormodel/main.qml @@ -45,7 +45,7 @@ import QtQuick.Controls 2.4 import QtQuick.Layouts 1.11 import QtQuick.Window 2.11 -import QtApplicationManager.SystemUI 2.0 +import QtApplicationManager 2.0 Window { width: 1200 diff --git a/util/bash/appman-prompt b/util/bash/appman-prompt index cd85278f..c7615381 100644 --- a/util/bash/appman-prompt +++ b/util/bash/appman-prompt @@ -44,7 +44,7 @@ _appman() COMPREPLY=( $( compgen -f -- ${cur}) ) fi } -complete -o filenames -F _appman appman +complete -o filenames -F _appman appman appman-qmltestrunner _appman-controller() { |