AutoTest: Fix gathering Boost test cases

When multiple test executables are defined inside a
single project file all or selected tests did just use
the first defined target which in turn led to execute
only the test cases of one of the executables or none
at all.
Take all targets into account and make Run All and
Run Selected work correctly for this scenario.

Fixes: QTCREATORBUG-23091
Change-Id: Idf0dd99f9a8782072cbc5792c937232673fee445
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2019-10-22 08:38:28 +02:00
parent 6df9e8f8be
commit 1b655f76ad

View File

@@ -203,12 +203,14 @@ QList<TestConfiguration *> BoostTestTreeItem::getAllTestConfigurations() const
}); });
for (auto it = testsPerProjectfile.begin(), end = testsPerProjectfile.end(); it != end; ++it) { for (auto it = testsPerProjectfile.begin(), end = testsPerProjectfile.end(); it != end; ++it) {
BoostTestConfiguration *config = new BoostTestConfiguration; for (const QString &target : qAsConst(it.value().internalTargets)) {
config->setProject(project); BoostTestConfiguration *config = new BoostTestConfiguration;
config->setProjectFile(it.key()); config->setProject(project);
config->setTestCaseCount(it.value().testCases); config->setProjectFile(it.key());
config->setInternalTargets(it.value().internalTargets); config->setTestCaseCount(it.value().testCases);
result.append(config); config->setInternalTarget(target);
result.append(config);
}
} }
return result; return result;
} }
@@ -245,12 +247,14 @@ QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() co
auto end = testCasesForProjectFile.cend(); auto end = testCasesForProjectFile.cend();
for (auto it = testCasesForProjectFile.cbegin(); it != end; ++it) { for (auto it = testCasesForProjectFile.cbegin(); it != end; ++it) {
BoostTestConfiguration *config = new BoostTestConfiguration; for (const QString &target : it.value().internalTargets) {
config->setProject(project); BoostTestConfiguration *config = new BoostTestConfiguration;
config->setProjectFile(it.key()); config->setProject(project);
config->setTestCases(it.value().testCases); config->setProjectFile(it.key());
config->setInternalTargets(it.value().internalTargets); config->setTestCases(it.value().testCases);
result.append(config); config->setInternalTarget(target);
result.append(config);
}
} }
return result; return result;
} }