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