From e85f43fd4ded62ab4b63185fba54f308d73306fd Mon Sep 17 00:00:00 2001 From: Christian Andersen Date: Sun, 27 Jan 2019 18:19:21 +0100 Subject: tst_QTimer: relax time requirement on remaining time Before this the remaining time in the two tests 'remainingTime' and 'basic_chrono' had to be within the interval [100,200]. This relaxes that to [50,200]. This test seems to be failing a lot when staging changes in gerrit. I can reproduce some of the problem when putting a lot of load on my system and running the tests, then remaining time is very random. Also removes the blacklist of remaingTime on Windows and macOS, as basic_chrono and remaningTime tests are basically the same. The tests also fails on Linux some times in gerrit. I was also thinking one could: - blacklist both tests - remove interval requirements; just check remaining time is [0,200] - remove the tests Task-number: QTBUG-61013 Change-Id: I5c8f0754d059598e023fe8e5d511f4a50bb4bac2 Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp') diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 8d194dafc1..cd78da725c 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -133,14 +133,14 @@ void tst_QTimer::remainingTime() QCOMPARE(timeoutSpy.count(), 0); int remainingTime = timer.remainingTime(); - QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime))); + QVERIFY2(remainingTime >= 50 && remainingTime <= 200, qPrintable(QString::number(remainingTime))); QVERIFY(timeoutSpy.wait()); QCOMPARE(timeoutSpy.count(), 1); // the timer is still active, so it should have a non-zero remaining time remainingTime = timer.remainingTime(); - QVERIFY2(remainingTime > 150, qPrintable(QString::number(remainingTime))); + QVERIFY2(remainingTime >= 50, qPrintable(QString::number(remainingTime))); } void tst_QTimer::remainingTimeDuringActivation_data() @@ -228,7 +228,7 @@ void tst_QTimer::basic_chrono() QCOMPARE(timeoutSpy.count(), 0); milliseconds rt = timer.remainingTimeAsDuration(); - QVERIFY2(qAbs(rt.count() - 150) < 50, qPrintable(QString::number(rt.count()))); + QVERIFY2(rt.count() >= 50 && rt.count() <= 200, qPrintable(QString::number(rt.count()))); timeoutSpy.clear(); timer.setSingleShot(true); -- cgit v1.2.3