diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-10-25 15:08:13 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-11-19 11:45:38 +0000 |
commit | e00c73911ae0127f986e056984eff02b099325f4 (patch) | |
tree | d2ec290db934ef0355915bf2385ee21ed3326167 /tests/auto/corelib | |
parent | ca3ac2e1c7548f2e66561fb0afe93494416ebf9c (diff) |
Reduce run time of tst_QRegularExpression::threadSafety
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 <oliver.wolff@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<MatcherThread *> threads; |