Don't allow QThreadPool test to hang on failure.
authorJason McDonald <jason.mcdonald@nokia.com>
Wed, 28 Dec 2011 06:52:24 +0000 (16:52 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 29 Dec 2011 00:39:04 +0000 (01:39 +0100)
Use QTRY_VERIFY() to fail after a reasonable timeout rather than putting
the test into an infinite loop.

Change-Id: Ie0917556e15999a94cc0587f3f4c11c0d743a228
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
tests/auto/corelib/concurrent/qthreadpool/tst_qthreadpool.cpp

index ff26d5d..ab67160 100644 (file)
@@ -205,9 +205,7 @@ void tst_QThreadPool::runTask()
     QThreadPool manager;
     ran = false;
     manager.start(new TestTask());
-    // Hang if task is not runned.
-    while (ran == false)
-        QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers
+    QTRY_VERIFY(ran);
 }
 
 /*
@@ -217,8 +215,7 @@ void tst_QThreadPool::singleton()
 {
     ran = false;
     QThreadPool::globalInstance()->start(new TestTask());
-    while (ran == false)
-        QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers
+    QTRY_VERIFY(ran);
 }
 
 int *value = 0;