From e00c73911ae0127f986e056984eff02b099325f4 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 25 Oct 2018 15:08:13 +0200 Subject: Reduce run time of tst_QRegularExpression::threadSafety MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test was taking so much time that it regularly timed out on WinRT and when running in qemu. Reduce it from around 40 to 7 seconds on a powerful desktop. Now it either runs for two full seconds for each test function or until it has done 50 iterations. Fixes: QTBUG-71405 Change-Id: If752c1e65d3b19009b883f64edc96d020df479d1 Reviewed-by: Oliver Wolff Reviewed-by: Jędrzej Nowacki Reviewed-by: Timur Pocheptsov --- .../auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 18098f16bf..c23ee3b0ba 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -2135,11 +2135,12 @@ void tst_QRegularExpression::threadSafety() QFETCH(QString, pattern); QFETCH(QString, subject); + QElapsedTimer time; + time.start(); static const int THREAD_SAFETY_ITERATIONS = 50; - const int threadCount = qMax(QThread::idealThreadCount(), 4); - for (int threadSafetyIteration = 0; threadSafetyIteration < THREAD_SAFETY_ITERATIONS; ++threadSafetyIteration) { + for (int threadSafetyIteration = 0; threadSafetyIteration < THREAD_SAFETY_ITERATIONS && time.elapsed() < 2000; ++threadSafetyIteration) { QRegularExpression re(pattern); QVector threads; -- cgit v1.2.3