diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-07-19 14:16:26 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-07-19 12:29:53 +0000 |
commit | 4585889467b6124f2e9ccca3d1c0da15e2bf790c (patch) | |
tree | c80362cc0cf503cbb404e8de9fdc5f1f1e616f9d /tests/auto | |
parent | 0e9ea9451174aeeb78f41f0cc213373e8ce76e5a (diff) |
Fix race condition in the processEvents test
This test verifies processEvents(WaitForMoreEvents)
behavior by first processing all pending events (in
a loop) and then verifying that a following processEvents
call actually waits.
But there is no guarantee that the OS won’t introduce
more events after the first loop has completed. This
does indeed seem to happen on recent versions of macOS.
Change the test to not require that the processEvents
call blocked and de-blacklist.
Task-number: QTBUG-61131
Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 9 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qguieventloop/BLACKLIST | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index aff04afe08..0b4f76ef70 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -216,12 +216,11 @@ void tst_QEventLoop::processEvents() awakeSpy.clear(); QVERIFY(eventLoop.processEvents(QEventLoop::WaitForMoreEvents)); - // Verify that the eventloop has blocked and woken up. Some eventloops - // may block and wake up multiple times. - QVERIFY(aboutToBlockSpy.count() > 0); - QVERIFY(awakeSpy.count() > 0); // We should get one awake for each aboutToBlock, plus one awake when - // processEvents is entered. + // processEvents is entered. There is no guarantee that that the + // processEvents call actually blocked, since the OS may introduce + // native events at any time. + QVERIFY(awakeSpy.count() > 0); QVERIFY(awakeSpy.count() >= aboutToBlockSpy.count()); killTimer(timerId); diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST index 2303d9380e..03acb2f5b0 100644 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventloop/BLACKLIST @@ -1,4 +1,2 @@ -[processEvents] -osx-10.12 [testQuitLock] osx-10.12 |