Improved stability of tst_qsemaphore (especially on mac)
authorRohan McGovern <rohan.mcgovern@nokia.com>
Mon, 6 Feb 2012 04:17:08 +0000 (14:17 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 8 Feb 2012 01:10:51 +0000 (02:10 +0100)
commit3ae3aa0e51711ea4051c82ed7911ccc744f44268
treed553eaaf12f625b490335ab12a44dbc149a625de
parentf50a84008eb24d164df4e375084df457e9c85ce7
Improved stability of tst_qsemaphore (especially on mac)

Timers are not entirely precise; if we ask for a timeout of
10000 milliseconds, we might time out in 9999 instead.
Also, we know the expected elapsed time in each case, so do a fuzzy
comparison against that time.

Previously the test was verifying that the elapsed time was greater than
or equal to the timeout in the case where a timeout was expected, which
means the test would not detect bugs which incorrectly caused the
timeout to occur later than it should.

(cherry picked from qt4 commit 9a2573dc13b3e8df6cd15bef64370ea407480fc7)

Change-Id: I91d0c81f989ab43a3c48f6abbb4c5b28e2b35402
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
tests/auto/corelib/thread/qsemaphore/qsemaphore.pro
tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp