diff options
author | Christian Stenger <christian.stenger@qt.io> | 2017-06-26 10:25:46 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2017-06-26 13:34:16 +0000 |
commit | 6ab1da8b78d9bac8ffb0ba8ced6dfef42511d521 (patch) | |
tree | ce959df949e9c1f94f6af51575120f11671c9636 /src/plugins/autotest | |
parent | 89b3ab727463618bb42b11c1b30e27ff4b384e2c (diff) | |
download | qt-creator-6ab1da8b78d9bac8ffb0ba8ced6dfef42511d521.tar.gz |
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 <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r-- | src/plugins/autotest/testconfiguration.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 52723a5b64..8440348d7d 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<StandardRunnable>(); // 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>()) { StandardRunnable stdRunnable = runnable.as<StandardRunnable>(); 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(); |