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 <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2017-06-27 11:04:21 +02:00
parent 56db0df2e6
commit a72b38b8c9
2 changed files with 13 additions and 0 deletions

View File

@@ -327,5 +327,17 @@ QString GTestTreeItem::nameSuffix() const
return suffix;
}
QSet<QString> GTestTreeItem::internalTargets() const
{
QSet<QString> 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

View File

@@ -67,6 +67,7 @@ public:
GTestTreeItem::TestStates state,
const QString &proFile) const;
QString nameSuffix() const;
QSet<QString> internalTargets() const override;
private:
GTestTreeItem::TestStates m_state;