AutoTest: Reuse LoopList

Instead of LoopRepeat + container capture.

Change-Id: Icb243d7ac902eed95503d7d1a5ac007f4f6c705d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-25 14:15:21 +01:00
parent e826e3ad7e
commit 507933467f

View File

@@ -364,12 +364,11 @@ void TestRunner::runTestsHelper()
std::unique_ptr<TestOutputReader> m_outputReader; std::unique_ptr<TestOutputReader> m_outputReader;
}; };
const QList<ITestConfiguration *> selectedTests = m_selectedTests; const LoopList iterator(m_selectedTests);
const LoopRepeat repeater(selectedTests.size());
const Storage<TestStorage> storage; const Storage<TestStorage> storage;
const auto onSetup = [this, selectedTests, repeater, storage](Process &process) { const auto onSetup = [this, iterator, storage](Process &process) {
ITestConfiguration *config = selectedTests.at(repeater.iteration()); ITestConfiguration *config = *iterator;
QTC_ASSERT(config, return SetupResult::StopWithError); QTC_ASSERT(config, return SetupResult::StopWithError);
if (!config->project()) if (!config->project())
return SetupResult::StopWithSuccess; return SetupResult::StopWithSuccess;
@@ -425,8 +424,8 @@ void TestRunner::runTestsHelper()
qCDebug(runnerLog) << "Environment:" << process.environment().toStringList(); qCDebug(runnerLog) << "Environment:" << process.environment().toStringList();
return SetupResult::Continue; return SetupResult::Continue;
}; };
const auto onDone = [this, selectedTests, repeater, storage](const Process &process) { const auto onDone = [this, iterator, storage](const Process &process) {
ITestConfiguration *config = selectedTests.at(repeater.iteration()); ITestConfiguration *config = *iterator;
TestStorage *testStorage = storage.activeStorage(); TestStorage *testStorage = storage.activeStorage();
QTC_ASSERT(testStorage, return); QTC_ASSERT(testStorage, return);
if (process.result() == ProcessResult::StartFailed) { if (process.result() == ProcessResult::StartFailed) {
@@ -463,7 +462,7 @@ void TestRunner::runTestsHelper()
const Group root { const Group root {
finishAllAndSuccess, finishAllAndSuccess,
repeater, iterator,
Group { Group {
storage, storage,
ProcessTask(onSetup, onDone) ProcessTask(onSetup, onDone)