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 <thiago.macieira@intel.com>
This commit is contained in:
Christian Andersen 2019-01-27 18:19:21 +01:00
parent 315969725d
commit e85f43fd4d
2 changed files with 3 additions and 6 deletions

View File

@ -1,3 +0,0 @@
[remainingTime]
windows
osx

View File

@ -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);