AutoTest: Simplify determination of RunConfiguration

Since bc698d4ce6 the build system targets / build keys are
unique on their own.
Simplify the completion of test configurations and improve
readability.

Change-Id: I258e8a35a4740dd58b1365498ca399258092e0e3
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2018-04-13 09:22:26 +02:00
parent 83c6a4916c
commit d9dfddac73
4 changed files with 5 additions and 11 deletions

View File

@@ -409,7 +409,7 @@ QSet<QString> GTestTreeItem::internalTargets() const
&& Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) { && Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) {
return pf.path == file; return pf.path == file;
})) { })) {
result.insert(projectPart->buildSystemTarget + '|' + projectPart->projectFile); result.insert(projectPart->buildSystemTarget);
if (projectPart->buildTargetType != CppTools::ProjectPart::Executable) if (projectPart->buildTargetType != CppTools::ProjectPart::Executable)
result.unite(TestTreeItem::dependingInternalTargets(cppMM, file)); result.unite(TestTreeItem::dependingInternalTargets(cppMM, file));
} }

View File

@@ -382,7 +382,7 @@ QSet<QString> QuickTestTreeItem::internalTargets() const
if (projectPart->buildTargetType != CppTools::ProjectPart::Executable) if (projectPart->buildTargetType != CppTools::ProjectPart::Executable)
continue; continue;
if (projectPart->projectFile == proFile()) { if (projectPart->projectFile == proFile()) {
result.insert(projectPart->buildSystemTarget + '|' + projectPart->projectFile); result.insert(projectPart->buildSystemTarget);
break; break;
} }
} }

View File

@@ -148,13 +148,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
BuildTargetInfo targetInfo BuildTargetInfo targetInfo
= Utils::findOrDefault(target->applicationTargets().list, = Utils::findOrDefault(target->applicationTargets().list,
[&buildSystemTargets] (const BuildTargetInfo &bti) { [&buildSystemTargets] (const BuildTargetInfo &bti) {
return Utils::anyOf(buildSystemTargets, [&bti](const QString &b) { return buildSystemTargets.contains(bti.buildKey);
const QStringList targWithProjectFile = b.split('|');
if (targWithProjectFile.size() != 2) // some build targets might miss the project file
return false;
return !bti.targetFilePath.isEmpty() && targWithProjectFile.at(0) == bti.buildKey
&& targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString());
});
}); });
// we might end up with an empty targetFilePath - e.g. when having a library we just link to // we might end up with an empty targetFilePath - e.g. when having a library we just link to
// there would be no BuildTargetInfo that could match // there would be no BuildTargetInfo that could match

View File

@@ -307,7 +307,7 @@ QSet<QString> TestTreeItem::internalTargets() const
return TestTreeItem::dependingInternalTargets(cppMM, m_filePath); return TestTreeItem::dependingInternalTargets(cppMM, m_filePath);
QSet<QString> targets; QSet<QString> targets;
for (const CppTools::ProjectPart::Ptr part : projectParts) { for (const CppTools::ProjectPart::Ptr part : projectParts) {
targets.insert(part->buildSystemTarget + '|' + part->projectFile); targets.insert(part->buildSystemTarget);
if (part->buildTargetType != CppTools::ProjectPart::Executable) if (part->buildTargetType != CppTools::ProjectPart::Executable)
targets.unite(TestTreeItem::dependingInternalTargets(cppMM, m_filePath)); targets.unite(TestTreeItem::dependingInternalTargets(cppMM, m_filePath));
} }
@@ -374,7 +374,7 @@ QSet<QString> TestTreeItem::dependingInternalTargets(CppTools::CppModelManager *
wasHeader ? file : correspondingFile); wasHeader ? file : correspondingFile);
for (const Utils::FileName &fn : dependingFiles) { for (const Utils::FileName &fn : dependingFiles) {
for (const CppTools::ProjectPart::Ptr part : cppMM->projectPart(fn)) for (const CppTools::ProjectPart::Ptr part : cppMM->projectPart(fn))
result.insert(part->buildSystemTarget + '|' + part->projectFile); result.insert(part->buildSystemTarget);
} }
return result; return result;
} }