QThread-test: Fix test on Windows (timer inaccuracy).
- Tolerate WaitTime - 1 (799ms when expecting 800ms). - Remove commented-out code. Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Change-Id: Ibe246d47ab7667692386b0f9333150c195948282 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
c4e36728bc
commit
f54916697a
@ -1074,17 +1074,14 @@ void tst_QThread::wait2()
|
|||||||
thread.start();
|
thread.start();
|
||||||
timer.start();
|
timer.start();
|
||||||
QVERIFY(!thread.wait(Waiting_Thread::WaitTime));
|
QVERIFY(!thread.wait(Waiting_Thread::WaitTime));
|
||||||
qint64 elapsed = timer.elapsed();
|
qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 1).
|
||||||
|
QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed)));
|
||||||
QVERIFY(elapsed >= Waiting_Thread::WaitTime);
|
|
||||||
//QVERIFY(elapsed < Waiting_Thread::WaitTime * 1.4);
|
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
thread.cond1.wakeOne();
|
thread.cond1.wakeOne();
|
||||||
QVERIFY(thread.wait(/*Waiting_Thread::WaitTime * 1.4*/));
|
QVERIFY(thread.wait(/*Waiting_Thread::WaitTime * 1.4*/));
|
||||||
elapsed = timer.elapsed();
|
elapsed = timer.elapsed();
|
||||||
QVERIFY(elapsed >= Waiting_Thread::WaitTime);
|
QVERIFY2(elapsed - Waiting_Thread::WaitTime >= -1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed)));
|
||||||
//QVERIFY(elapsed < Waiting_Thread::WaitTime * 1.4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1116,9 +1113,7 @@ void tst_QThread::wait3_slowDestructor()
|
|||||||
timer.start();
|
timer.start();
|
||||||
QVERIFY(!thread.wait(Waiting_Thread::WaitTime));
|
QVERIFY(!thread.wait(Waiting_Thread::WaitTime));
|
||||||
qint64 elapsed = timer.elapsed();
|
qint64 elapsed = timer.elapsed();
|
||||||
|
QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed)));
|
||||||
QVERIFY(elapsed >= Waiting_Thread::WaitTime);
|
|
||||||
//QVERIFY(elapsed < Waiting_Thread::WaitTime * 1.4);
|
|
||||||
|
|
||||||
slow.cond.wakeOne();
|
slow.cond.wakeOne();
|
||||||
//now the thread should finish quickly
|
//now the thread should finish quickly
|
||||||
|
Loading…
Reference in New Issue
Block a user