diff options
author | Christian Stenger <[email protected]> | 2016-03-03 13:24:11 +0100 |
---|---|---|
committer | Christian Stenger <[email protected]> | 2016-03-07 14:20:57 +0000 |
commit | cacc5bfb9be2b8cfd175ccb1fd6ab953b46b7772 (patch) | |
tree | 6c952be4fbaab61b082a41d729b976414fd2c131 /src/plugins/autotest/testconfiguration.cpp | |
parent | 6ca2bb3c73fba1e581a22f7aada1fd811f023faf (diff) |
AutoTest: Fix basic CMake support...
...at least for C++ based auto tests.
Qt Quick Tests are out of scope for this issue as this
would need too much additional tweaking for several parts
of the plugin.
Task-number: QTCREATORBUG-15813
Change-Id: I440a8b1f8e6deb9e6acf2e82d0831fb002c10390
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/autotest/testconfiguration.cpp')
-rw-r--r-- | src/plugins/autotest/testconfiguration.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index ffacd05d1af..ba4597b36dc 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -69,11 +69,20 @@ void completeBasicProjectInformation(Project *project, const QString &proFile, Q CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); QList<CppTools::ProjectPart::Ptr> projParts = cppMM->projectInfo(project).projectParts(); - foreach (const CppTools::ProjectPart::Ptr &part, projParts) { - if (part->projectFile == proFile) { - *displayName = part->displayName; - *targetProject = part->project; - return; + if (displayName->isEmpty()) { + foreach (const CppTools::ProjectPart::Ptr &part, projParts) { + if (part->projectFile == proFile) { + *displayName = part->displayName; + *targetProject = part->project; + return; + } + } + } else { // for CMake based projects we've got the displayname already + foreach (const CppTools::ProjectPart::Ptr &part, projParts) { + if (part->displayName == *displayName) { + *targetProject = part->project; + return; + } } } } @@ -96,7 +105,7 @@ void TestConfiguration::completeTestInformation() QString targetFile; QString targetName; QString workDir; - QString displayName; + QString displayName = m_displayName; QString buildDir; Project *targetProject = 0; Utils::Environment env; @@ -111,12 +120,23 @@ void TestConfiguration::completeTestInformation() return; BuildTargetInfoList appTargets = target->applicationTargets(); - foreach (const BuildTargetInfo &bti, appTargets.list) { - // some project manager store line/column information as well inside ProjectPart - if (bti.isValid() && m_proFile.startsWith(bti.projectFilePath.toString())) { - targetFile = Utils::HostOsInfo::withExecutableSuffix(bti.targetFilePath.toString()); - targetName = bti.targetName; - break; + if (m_displayName.isEmpty()) { + foreach (const BuildTargetInfo &bti, appTargets.list) { + // some project manager store line/column information as well inside ProjectPart + if (bti.isValid() && m_proFile.startsWith(bti.projectFilePath.toString())) { + targetFile = Utils::HostOsInfo::withExecutableSuffix(bti.targetFilePath.toString()); + targetName = bti.targetName; + break; + } + } + } else { // CMake based projects have no specific pro file, but target name matches displayname + foreach (const BuildTargetInfo &bti, appTargets.list) { + if (bti.isValid() && m_displayName == bti.targetName) { + // for CMake base projects targetFilePath has executable suffix already + targetFile = bti.targetFilePath.toString(); + targetName = m_displayName; + break; + } } } |