From 6ab1da8b78d9bac8ffb0ba8ced6dfef42511d521 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 26 Jun 2017 10:25:46 +0200 Subject: [PATCH] AutoTest: Fix finding runconfig for multiple build targets As we are still constructing build system target to compare with on the test runner's side instead of getting the complete information from the run configuration we ended up using the wrong one in several circumstances. Avoid this by using the executable information we already got. Task-number: QTCREATORBUG-17783 Change-Id: I40431bef228f7070109297873c472fea410dbd16 Reviewed-by: David Schulz --- src/plugins/autotest/testconfiguration.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 52723a5b642..8440348d7d2 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -86,7 +86,12 @@ void TestConfiguration::completeTestInformation(int runMode) && targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString()); }); }); - const Utils::FileName executable = targetInfo.targetFilePath; // empty if BTI is default created + QString executable = targetInfo.targetFilePath.toString(); // empty if BTI default created + if (Utils::HostOsInfo::isWindowsHost() && !executable.isEmpty() + && !executable.toLower().endsWith(".exe")) { + executable = Utils::HostOsInfo::withExecutableSuffix(executable); + } + for (RunConfiguration *runConfig : target->runConfigurations()) { if (!isLocal(runConfig)) // TODO add device support continue; @@ -99,13 +104,18 @@ void TestConfiguration::completeTestInformation(int runMode) StandardRunnable stdRunnable = runnable.as(); // TODO this might pick up the wrong executable m_executableFile = stdRunnable.executable; + if (Utils::HostOsInfo::isWindowsHost() && !m_executableFile.isEmpty() + && !m_executableFile.toLower().endsWith(".exe")) { + m_executableFile = Utils::HostOsInfo::withExecutableSuffix(m_executableFile); + } m_displayName = runConfig->displayName(); m_workingDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory); m_environment = stdRunnable.environment; m_project = project; if (runMode == TestRunner::Debug) m_runConfig = new TestRunConfiguration(runConfig->target(), this); - break; + if (m_executableFile == executable) // we can find a better runConfig if no match + break; } } // RunConfiguration for this target could be explicitly removed or not created at all @@ -117,12 +127,7 @@ void TestConfiguration::completeTestInformation(int runMode) if (runnable.is()) { StandardRunnable stdRunnable = runnable.as(); m_environment = stdRunnable.environment; - // when guessing we might have no extension - const QString &exeString = executable.toString(); - if (Utils::HostOsInfo::isWindowsHost() && !exeString.toLower().endsWith(".exe")) - m_executableFile = Utils::HostOsInfo::withExecutableSuffix(exeString); - else - m_executableFile = exeString; + m_executableFile = executable; m_project = project; m_guessedConfiguration = true; m_guessedFrom = rc->displayName();