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>
This commit is contained in:
Robin Burchell 2014-08-19 10:26:15 +02:00
parent dfc8f8b5d4
commit 69b256285b

View File

@ -383,8 +383,7 @@ void tst_QSqlThread::simpleThreading()
t1.start(); t1.start();
t2.start(); t2.start();
while (threadFinishedCount < 2) QTRY_VERIFY(threadFinishedCount >= 2);
QTest::qWait(100);
} }
// This test creates two threads that clone their db connection and read // This test creates two threads that clone their db connection and read
@ -409,8 +408,7 @@ void tst_QSqlThread::readWriteThreading()
producer.start(); producer.start();
consumer.start(); consumer.start();
while (threadFinishedCount < 2) QTRY_VERIFY(threadFinishedCount >= 2);
QTest::qWait(100);
} }
// run with n threads in parallel. Change this constant to hammer the poor DB server even more // 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(); reader->start();
} }
while (threadFinishedCount < maxThreadCount) QTRY_VERIFY(threadFinishedCount >= maxThreadCount);
QTest::qWait(100);
#endif #endif
} }
@ -459,8 +456,7 @@ void tst_QSqlThread::readWriteFromSingleConnection()
writer->start(); writer->start();
} }
while (threadFinishedCount < maxThreadCount * 2) QTRY_VERIFY(threadFinishedCount >= maxThreadCount * 2);
QTest::qWait(100);
#endif #endif
} }
@ -485,8 +481,7 @@ void tst_QSqlThread::preparedReadWriteFromSingleConnection()
writer->start(); writer->start();
} }
while (threadFinishedCount < maxThreadCount * 2) QTRY_VERIFY(threadFinishedCount >= maxThreadCount * 2);
QTest::qWait(100);
#endif #endif
} }