forked from qt-creator/qt-creator
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:
@@ -327,5 +327,17 @@ QString GTestTreeItem::nameSuffix() const
|
|||||||
return suffix;
|
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 Internal
|
||||||
} // namespace Autotest
|
} // namespace Autotest
|
||||||
|
@@ -67,6 +67,7 @@ public:
|
|||||||
GTestTreeItem::TestStates state,
|
GTestTreeItem::TestStates state,
|
||||||
const QString &proFile) const;
|
const QString &proFile) const;
|
||||||
QString nameSuffix() const;
|
QString nameSuffix() const;
|
||||||
|
QSet<QString> internalTargets() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GTestTreeItem::TestStates m_state;
|
GTestTreeItem::TestStates m_state;
|
||||||
|
Reference in New Issue
Block a user