forked from qt-creator/qt-creator
Use Utils::runAsync instead of QtConcurrent::run
QtConcurrent has the issue that it uses a globally shared thread pool, with no finer granularity for simulataneous tasks. Create an explicit event loop for the test runner for that. Change-Id: Idcf2f125e111d94a5a60e5b136fd875225326e14 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
committed by
Christian Stenger
parent
9a3efd4950
commit
06e02480f4
@@ -800,7 +800,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFuture<void> future = QtConcurrent::run(&performParse, list, this);
|
QFuture<void> future = Utils::runAsync<void>(&performParse, list, this);
|
||||||
Core::FutureProgress *progress
|
Core::FutureProgress *progress
|
||||||
= Core::ProgressManager::addTask(future, isFullParse ? tr("Scanning for Tests")
|
= Core::ProgressManager::addTask(future, isFullParse ? tr("Scanning for Tests")
|
||||||
: tr("Refreshing Tests List"),
|
: tr("Refreshing Tests List"),
|
||||||
|
@@ -109,6 +109,7 @@ static void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
const QList<TestConfiguration *> selectedTests, const int timeout,
|
const QList<TestConfiguration *> selectedTests, const int timeout,
|
||||||
const QString metricsOption)
|
const QString metricsOption)
|
||||||
{
|
{
|
||||||
|
QEventLoop eventLoop;
|
||||||
int testCaseCount = 0;
|
int testCaseCount = 0;
|
||||||
foreach (TestConfiguration *config, selectedTests) {
|
foreach (TestConfiguration *config, selectedTests) {
|
||||||
config->completeTestInformation();
|
config->completeTestInformation();
|
||||||
@@ -198,7 +199,7 @@ static void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
emitTestResultCreated(new FaultyTestResult(Result::MessageFatal,
|
emitTestResultCreated(new FaultyTestResult(Result::MessageFatal,
|
||||||
QObject::tr("Test run canceled by user.")));
|
QObject::tr("Test run canceled by user.")));
|
||||||
}
|
}
|
||||||
qApp->processEvents();
|
eventLoop.processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,8 +275,8 @@ void TestRunner::runTests()
|
|||||||
TestResultsPane::instance(), &TestResultsPane::addTestResult,
|
TestResultsPane::instance(), &TestResultsPane::addTestResult,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
QFuture<void> future = QtConcurrent::run(&performTestRun, m_selectedTests, settings->timeout,
|
QFuture<void> future = Utils::runAsync<void>(&performTestRun, m_selectedTests, settings->timeout,
|
||||||
metricsOption);
|
metricsOption);
|
||||||
|
|
||||||
Core::FutureProgress *progress = Core::ProgressManager::addTask(future, tr("Running Tests"),
|
Core::FutureProgress *progress = Core::ProgressManager::addTask(future, tr("Running Tests"),
|
||||||
Autotest::Constants::TASK_INDEX);
|
Autotest::Constants::TASK_INDEX);
|
||||||
|
Reference in New Issue
Block a user