AutoTest: Use LoopRepeat for test scanner

In this way we don't construct a giant recipe
(~7000 tasks for Creator project) but simply repeat
the task execution many times.

Change-Id: I06758e2afa721f73e28adb42e6fccee0f955e01f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-12 20:01:48 +01:00
parent f3d11bf0b8
commit bd83ea8b8c

View File

@@ -375,21 +375,27 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
if (limit == 0)
limit = std::max(QThread::idealThreadCount() / 4, 1);
qCDebug(LOG) << "Using" << limit << "threads for scan.";
QList<GroupItem> tasks{parallelLimit(limit)};
for (const FilePath &file : filteredFiles) {
const auto onSetup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
const Storage<QSet<FilePath>::const_iterator> storage;
const auto onSetup = [this, codeParsers, storage](Async<TestParseResultPtr> &async) {
async.setConcurrentCallData(parseFileForTests, codeParsers, **storage);
async.setPriority(QThread::LowestPriority);
async.setFutureSynchronizer(&m_futureSynchronizer);
++*storage;
};
const auto onDone = [this](const Async<TestParseResultPtr> &async) {
const QList<TestParseResultPtr> results = async.results();
for (const TestParseResultPtr &result : results)
emit testParseResultReady(result);
};
tasks.append(AsyncTask<TestParseResultPtr>(onSetup, onDone, CallDoneIf::Success));
}
m_taskTree.reset(new TaskTree{tasks});
const Group root {
parallelLimit(limit),
storage,
onGroupSetup([storage, filteredFiles] { *storage = filteredFiles.cbegin(); }),
LoopRepeat(filteredFiles.size()),
AsyncTask<TestParseResultPtr>(onSetup, onDone, CallDoneIf::Success)
};
m_taskTree.reset(new TaskTree(root));
connect(m_taskTree.get(), &TaskTree::started, this, &TestCodeParser::parsingStarted);
connect(m_taskTree.get(), &TaskTree::done, this, [this](DoneWith result) {
m_taskTree.release()->deleteLater();