From a72b38b8c9f26c375ee0e6e348d4c3a32af16c25 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 27 Jun 2017 11:04:21 +0200 Subject: AutoTest: Improve finding executables for cmake based projects Depending on the structure of a project we might end up inside a library and will not find the correct executable for running a test. This patch improves finding the correct executable, but depending on the complexity of the project it will not be able to fix all circumstances. Task-number: QTCREATORBUG-17882 Change-Id: I847bb40426bc1b874c2dc6a2a6880b11fe048bda Reviewed-by: David Schulz --- src/plugins/autotest/gtest/gtesttreeitem.cpp | 12 ++++++++++++ src/plugins/autotest/gtest/gtesttreeitem.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp index dc53bd21dd..cd201cb9a4 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.cpp +++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp @@ -327,5 +327,17 @@ QString GTestTreeItem::nameSuffix() const return suffix; } +QSet GTestTreeItem::internalTargets() const +{ + QSet result; + const auto cppMM = CppTools::CppModelManager::instance(); + const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject()); + for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) { + if (projectPart->projectFile == proFile()) + result.insert(projectPart->buildSystemTarget); + } + return result; +} + } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/gtest/gtesttreeitem.h b/src/plugins/autotest/gtest/gtesttreeitem.h index 67973771dd..60eb37b7f2 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.h +++ b/src/plugins/autotest/gtest/gtesttreeitem.h @@ -67,6 +67,7 @@ public: GTestTreeItem::TestStates state, const QString &proFile) const; QString nameSuffix() const; + QSet internalTargets() const override; private: GTestTreeItem::TestStates m_state; -- cgit v1.2.3