diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2014-08-19 10:26:15 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2014-08-20 21:45:01 +0200 |
commit | 69b256285b5c5d7d650c6abb19ac05a51e29d0d8 (patch) | |
tree | 92355f05dab1d190b0ecb2e80f04261c27053f32 /tests/auto/sql/kernel | |
parent | dfc8f8b5d4a02f33c7f9063c2a28450902a9d863 (diff) |
tst_qsqlthread: Move manual qWait calls into QTRY_VERIFY
Reduces the average runtime of this test for me by ~600ms, but due to the
threading variance the exact reduction is hard to tell.
Change-Id: I96a9f949ae2381f69d9364e6637db0db4bd3b165
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/sql/kernel')
-rw-r--r-- | tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp index 61b4305d13..fc6122ebeb 100644 --- a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp @@ -383,8 +383,7 @@ void tst_QSqlThread::simpleThreading() t1.start(); t2.start(); - while (threadFinishedCount < 2) - QTest::qWait(100); + QTRY_VERIFY(threadFinishedCount >= 2); } // This test creates two threads that clone their db connection and read @@ -409,8 +408,7 @@ void tst_QSqlThread::readWriteThreading() producer.start(); consumer.start(); - while (threadFinishedCount < 2) - QTest::qWait(100); + QTRY_VERIFY(threadFinishedCount >= 2); } // run with n threads in parallel. Change this constant to hammer the poor DB server even more @@ -433,8 +431,7 @@ void tst_QSqlThread::readFromSingleConnection() reader->start(); } - while (threadFinishedCount < maxThreadCount) - QTest::qWait(100); + QTRY_VERIFY(threadFinishedCount >= maxThreadCount); #endif } @@ -459,8 +456,7 @@ void tst_QSqlThread::readWriteFromSingleConnection() writer->start(); } - while (threadFinishedCount < maxThreadCount * 2) - QTest::qWait(100); + QTRY_VERIFY(threadFinishedCount >= maxThreadCount * 2); #endif } @@ -485,8 +481,7 @@ void tst_QSqlThread::preparedReadWriteFromSingleConnection() writer->start(); } - while (threadFinishedCount < maxThreadCount * 2) - QTest::qWait(100); + QTRY_VERIFY(threadFinishedCount >= maxThreadCount * 2); #endif } |