Remove timer checks from testQuitLock
This test sets up two timers: - a 100ms recurring timer - a series of 10 200ms single-shot timers. After quitLock lets exec() return it then uses a signal spy to check if the 100ms timer fired at least 17/20 of the times it should. However there is no guarantee that the 100ms timer will fire more often than the 200ms timer. If the native timer callbacks happen at 500ms intervals then Qt will fire both timers (once) at that interval. In practice this seems to happen on macOS CI under system load and/or with the test app napping. The primary goal for the test is to verify that exec() returns when it should; we can remove the timer signal spy. Remove testQuitLock from BLACKLIST. Timely timer: 524429311.389913 runLoopTimerCallback 524429311.389979 200ms fire 524429311.389997 100ms fire 524429311.490056 runLoopTimerCallback 524429311.490130 100ms fire 524429311.589752 runLoopTimerCallback 524429311.589929 200ms fire 524429311.589976 100ms fire Delayed timer: 524429428.690887 runLoopTimerCallback 524429428.691002 100ms fire 524429428.691143 200ms fire 524429433.692103 runLoopTimerCallback 524429433.692205 100ms fire 524429433.692331 200ms fire Change-Id: Iff4faaa1de3741cf4e217949d5ed17d4e70c6af2 Task-number: QTBUG-61499 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
1497e5853b
commit
d044b0b1e3
@ -637,11 +637,6 @@ void tst_QEventLoop::testQuitLock()
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
|
||||
QTimer timer;
|
||||
timer.setInterval(100);
|
||||
QSignalSpy timerSpy(&timer, &QTimer::timeout);
|
||||
timer.start();
|
||||
|
||||
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));
|
||||
|
||||
QCOMPARE(privateClass->quitLockRef.load(), 0);
|
||||
@ -655,9 +650,6 @@ void tst_QEventLoop::testQuitLock()
|
||||
|
||||
QCOMPARE(privateClass->quitLockRef.load(), 0);
|
||||
|
||||
// The job takes long enough that the timer times out several times.
|
||||
QVERIFY(timerSpy.count() > 3);
|
||||
timerSpy.clear();
|
||||
|
||||
job1 = new JobObject(&eventLoop, this);
|
||||
job1->start(200);
|
||||
@ -670,11 +662,6 @@ void tst_QEventLoop::testQuitLock()
|
||||
}
|
||||
|
||||
eventLoop.exec();
|
||||
|
||||
qDebug() << timerSpy.count();
|
||||
// The timer times out more if it has more subjobs to do.
|
||||
// We run 10 jobs in sequence here of about 200ms each.
|
||||
QVERIFY(timerSpy.count() > 17);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QEventLoop)
|
||||
|
Loading…
Reference in New Issue
Block a user