forked from qt-creator/qt-creator
AutoTest: Make scan thread limit customizable
Allow users to specify the tread limit used when scanning for tests. By default we continue to use a fourth of the available logical CPUs. Task-number: QTCREATORBUG-29301 Change-Id: Ic92a4d0908093c0664aa1ba924e0c17dfd0082f9 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "autotestconstants.h"
|
#include "autotestconstants.h"
|
||||||
#include "autotesttr.h"
|
#include "autotesttr.h"
|
||||||
|
#include "testsettings.h"
|
||||||
#include "testtreemodel.h"
|
#include "testtreemodel.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
@@ -360,7 +361,11 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
|
|||||||
|
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
|
||||||
QList<GroupItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
int limit = TestSettings::instance()->scanThreadLimit();
|
||||||
|
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) {
|
for (const FilePath &file : filteredFiles) {
|
||||||
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
||||||
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
||||||
|
@@ -28,6 +28,12 @@ TestSettings::TestSettings()
|
|||||||
|
|
||||||
setSettingsGroup(Constants::SETTINGSGROUP);
|
setSettingsGroup(Constants::SETTINGSGROUP);
|
||||||
|
|
||||||
|
scanThreadLimit.setSettingsKey("ScanThreadLimit");
|
||||||
|
scanThreadLimit.setDefaultValue(0);
|
||||||
|
scanThreadLimit.setRange(0, QThread::idealThreadCount());
|
||||||
|
scanThreadLimit.setSpecialValueText("Automatic");
|
||||||
|
scanThreadLimit.setToolTip(Tr::tr("Number of worker threads used when scanning for tests."));
|
||||||
|
|
||||||
timeout.setSettingsKey("Timeout");
|
timeout.setSettingsKey("Timeout");
|
||||||
timeout.setDefaultValue(defaultTimeout);
|
timeout.setDefaultValue(defaultTimeout);
|
||||||
timeout.setRange(5000, 36'000'000); // 36 Mio ms = 36'000 s = 10 h
|
timeout.setRange(5000, 36'000'000); // 36 Mio ms = 36'000 s = 10 h
|
||||||
|
@@ -32,6 +32,7 @@ public:
|
|||||||
void toSettings(QSettings *s) const;
|
void toSettings(QSettings *s) const;
|
||||||
void fromSettings(QSettings *s);
|
void fromSettings(QSettings *s);
|
||||||
|
|
||||||
|
Utils::IntegerAspect scanThreadLimit{this};
|
||||||
Utils::IntegerAspect timeout{this};
|
Utils::IntegerAspect timeout{this};
|
||||||
Utils::BoolAspect omitInternalMsg{this};
|
Utils::BoolAspect omitInternalMsg{this};
|
||||||
Utils::BoolAspect omitRunConfigWarn{this};
|
Utils::BoolAspect omitRunConfigWarn{this};
|
||||||
|
@@ -51,6 +51,8 @@ TestSettingsWidget::TestSettingsWidget()
|
|||||||
{
|
{
|
||||||
auto timeoutLabel = new QLabel(Tr::tr("Timeout:"));
|
auto timeoutLabel = new QLabel(Tr::tr("Timeout:"));
|
||||||
timeoutLabel->setToolTip(Tr::tr("Timeout used when executing each test case."));
|
timeoutLabel->setToolTip(Tr::tr("Timeout used when executing each test case."));
|
||||||
|
auto scanThreadLabel = new QLabel(Tr::tr("Scan threads:"));
|
||||||
|
scanThreadLabel->setToolTip("Number of worker threads used when scanning for tests.");
|
||||||
|
|
||||||
m_frameworkTreeWidget = new QTreeWidget;
|
m_frameworkTreeWidget = new QTreeWidget;
|
||||||
m_frameworkTreeWidget->setRootIsDecorated(false);
|
m_frameworkTreeWidget->setRootIsDecorated(false);
|
||||||
@@ -83,6 +85,7 @@ TestSettingsWidget::TestSettingsWidget()
|
|||||||
Group generalGroup {
|
Group generalGroup {
|
||||||
title(Tr::tr("General")),
|
title(Tr::tr("General")),
|
||||||
Column {
|
Column {
|
||||||
|
Row { scanThreadLabel, s.scanThreadLimit, st },
|
||||||
s.omitInternalMsg,
|
s.omitInternalMsg,
|
||||||
s.omitRunConfigWarn,
|
s.omitRunConfigWarn,
|
||||||
s.limitResultOutput,
|
s.limitResultOutput,
|
||||||
|
Reference in New Issue
Block a user