From 1b655f76ad61cc17483d00b8ece06e08afaeaf01 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 22 Oct 2019 08:38:28 +0200 Subject: [PATCH] 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 --- .../autotest/boost/boosttesttreeitem.cpp | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/plugins/autotest/boost/boosttesttreeitem.cpp b/src/plugins/autotest/boost/boosttesttreeitem.cpp index e2e58c28aff..98a27c04977 100644 --- a/src/plugins/autotest/boost/boosttesttreeitem.cpp +++ b/src/plugins/autotest/boost/boosttesttreeitem.cpp @@ -203,12 +203,14 @@ QList BoostTestTreeItem::getAllTestConfigurations() const }); for (auto it = testsPerProjectfile.begin(), end = testsPerProjectfile.end(); it != end; ++it) { - BoostTestConfiguration *config = new BoostTestConfiguration; - config->setProject(project); - config->setProjectFile(it.key()); - config->setTestCaseCount(it.value().testCases); - config->setInternalTargets(it.value().internalTargets); - result.append(config); + for (const QString &target : qAsConst(it.value().internalTargets)) { + BoostTestConfiguration *config = new BoostTestConfiguration; + config->setProject(project); + config->setProjectFile(it.key()); + config->setTestCaseCount(it.value().testCases); + config->setInternalTarget(target); + result.append(config); + } } return result; } @@ -245,12 +247,14 @@ QList BoostTestTreeItem::getSelectedTestConfigurations() co auto end = testCasesForProjectFile.cend(); for (auto it = testCasesForProjectFile.cbegin(); it != end; ++it) { - BoostTestConfiguration *config = new BoostTestConfiguration; - config->setProject(project); - config->setProjectFile(it.key()); - config->setTestCases(it.value().testCases); - config->setInternalTargets(it.value().internalTargets); - result.append(config); + for (const QString &target : it.value().internalTargets) { + BoostTestConfiguration *config = new BoostTestConfiguration; + config->setProject(project); + config->setProjectFile(it.key()); + config->setTestCases(it.value().testCases); + config->setInternalTarget(target); + result.append(config); + } } return result; }