From 274bb27cf3b8a5d888bafa069925e230bf5ae90c Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 13 Jan 2023 07:35:56 +0100 Subject: [PATCH 1/2] AutoTest: Redo handling of data tags with spaces This basically reverts commit 7684571e108f5d as it broke running the test inside the debugger. Change-Id: Iacd46e2b9fb5af813fbf17156fd847375d750480 Reviewed-by: David Schulz --- src/plugins/autotest/qtest/qttestconfiguration.cpp | 13 ++++++++++++- src/plugins/autotest/qtest/qttesttreeitem.cpp | 14 ++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/plugins/autotest/qtest/qttestconfiguration.cpp b/src/plugins/autotest/qtest/qttestconfiguration.cpp index 529821644ce..6a316b06579 100644 --- a/src/plugins/autotest/qtest/qttestconfiguration.cpp +++ b/src/plugins/autotest/qtest/qttestconfiguration.cpp @@ -10,11 +10,22 @@ #include "../itestframework.h" #include "../testsettings.h" +#include #include namespace Autotest { namespace Internal { +static QStringList quoteIfNeeded(const QStringList &testCases, bool debugMode) +{ + if (debugMode) + return testCases; + + return Utils::transform(testCases, [](const QString &testCase){ + return testCase.contains(' ') ? '"' + testCase + '"' : testCase; + }); +} + TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface &fi, Utils::QtcProcess *app) const { @@ -39,7 +50,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co if (qtSettings->useXMLOutput.value()) arguments << "-xml"; if (!testCases().isEmpty()) - arguments << testCases(); + arguments << quoteIfNeeded(testCases(), isDebugRunMode()); const QString &metricsOption = QtTestSettings::metricsTypeToOption(MetricsType(qtSettings->metrics.value())); if (!metricsOption.isEmpty()) diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp index dcada43181f..222680d4cf1 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.cpp +++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp @@ -15,13 +15,6 @@ namespace Autotest { namespace Internal { -static QString functionWithDataTagAsArg(const QString &func, const QString &dataTag) -{ - if (dataTag.contains(' ')) - return '"' + func + ':' + dataTag + '"'; - return func + ':' + dataTag; -} - QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name, const Utils::FilePath &filePath, TestTreeItem::Type type) : TestTreeItem(testFramework, name, filePath, type) @@ -147,8 +140,9 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const const TestTreeItem *parent = function ? function->parentItem() : nullptr; if (!parent) return nullptr; + const QString functionWithTag = function->name() + ':' + name(); config = new QtTestConfiguration(framework()); - config->setTestCases(QStringList(functionWithDataTagAsArg(function->name(), name()))); + config->setTestCases(QStringList(functionWithTag)); config->setProjectFile(parent->proFile()); config->setProject(project); break; @@ -191,7 +185,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item, const QString funcName = grandChild->name(); grandChild->forFirstLevelChildren([&testCases, &funcName](ITestTreeItem *dataTag) { if (dataTag->checked() == Qt::Checked) - testCases << functionWithDataTagAsArg(funcName, dataTag->name()); + testCases << funcName + ':' + dataTag->name(); }); } }); @@ -223,7 +217,7 @@ static void collectFailedTestInfo(TestTreeItem *item, QListforFirstLevelChildren([&testCases, func](ITestTreeItem *dataTag) { if (dataTag->data(0, FailedRole).toBool()) - testCases << functionWithDataTagAsArg(func->name(), dataTag->name()); + testCases << func->name() + ':' + dataTag->name(); }); } }); From 9256340e5bed3a57b8f4cdca36659348211697ad Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 13 Jan 2023 15:43:10 +0100 Subject: [PATCH 2/2] CMake: Fix missing path to Ninja from Qt installers In the configure environment for MSVC toolchains. The MSVC toolchain actually overwrites the PATH environment (triggered via kit()->addToBuildEnvironment(result)), which it shouldn't. But this is a minimal fix for Qt Creator 9.0 that also is in line with what BuildConfiguration::baseEnvironment() does. Fixes: QTCREATORBUG-28685 Change-Id: I0cb8e3c84419403672175bd581c16d90902e23ba Reviewed-by: David Schulz --- src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 1823462382c..3c0e89fcbdb 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -2168,8 +2168,8 @@ Environment CMakeBuildConfiguration::baseConfigureEnvironment() const ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit()); result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment(); } - addToEnvironment(result); kit()->addToBuildEnvironment(result); + addToEnvironment(result); result.modify(project()->additionalEnvironment()); return result; }