summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-02-16 14:20:27 (GMT)
committermread <qt-info@nokia.com>2011-03-09 12:46:28 (GMT)
commit7b3d400cafe71cd9d290cc3f485ca67741cdcb33 (patch)
treeebae33683ff5911ed25778134c145dd8d68acfe1 /tests
parent586ba876034f46be1fe1c916f84f51392e60f3ef (diff)
downloadQt-7b3d400cafe71cd9d290cc3f485ca67741cdcb33.zip
Qt-7b3d400cafe71cd9d290cc3f485ca67741cdcb33.tar.gz
Qt-7b3d400cafe71cd9d290cc3f485ca67741cdcb33.tar.bz2
Extra debug info for failures in tst_qSemaphore tryAcquireWithTimeout()
There was one non-repeatable failure of tryAcquireWithTimeout() on Symbian. Added extra debug info to try to find out why, if it ever happens again. Task-number: QTBUG-13990 Reviewed-by: Shane Kearns
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsemaphore/tst_qsemaphore.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/qsemaphore/tst_qsemaphore.cpp
index ba2175a..9fc6de1 100644
--- a/tests/auto/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/qsemaphore/tst_qsemaphore.cpp
@@ -244,6 +244,8 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QSemaphore semaphore;
QTime time;
+#define QVERIFYGE(a,b) {int e = a; if (a<b) qDebug() << #a << "=" << e << " !>= " << #b << "=" << b; QVERIFY(e>=b);}
+#define QVERIFYLE(a,b) {int e = a; if (b<a) qDebug() << #a << "=" << e << " !<= " << #b << "=" << b; QVERIFY(e<=b);}
QCOMPARE(semaphore.available(), 0);
@@ -251,69 +253,69 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QCOMPARE(semaphore.available(), 1);
time.start();
QVERIFY(!semaphore.tryAcquire(2, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 1);
semaphore.release();
QCOMPARE(semaphore.available(), 2);
time.start();
QVERIFY(!semaphore.tryAcquire(3, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 2);
semaphore.release(10);
QCOMPARE(semaphore.available(), 12);
time.start();
QVERIFY(!semaphore.tryAcquire(100, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 12);
semaphore.release(10);
QCOMPARE(semaphore.available(), 22);
time.start();
QVERIFY(!semaphore.tryAcquire(100, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 22);
time.start();
QVERIFY(semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 21);
time.start();
QVERIFY(semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 20);
time.start();
QVERIFY(semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 10);
time.start();
QVERIFY(semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
// should not be able to acquire more
time.start();
QVERIFY(!semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
}