Relax timer test constraints and don't gag assertions.

Attempts to fix the flaky tests on macOS.
This commit is contained in:
Sönke Ludwig 2017-12-16 18:53:58 +01:00
parent 135217066f
commit 2c6b69590d
2 changed files with 17 additions and 9 deletions

View file

@ -19,13 +19,18 @@ void main()
auto tm = eventDriver.timers.create();
eventDriver.timers.wait(tm, (tm) nothrow @safe {
scope (failure) assert(false);
Duration dur;
{
scope (failure) assert(false);
dur = Clock.currTime(UTC()) - s_startTime;
}
auto dur = Clock.currTime(UTC()) - s_startTime;
assert(dur > 200.msecs);
assert(dur < 220.msecs);
assert(dur < 260.msecs);
s_startTime += dur;
s_startTime = Clock.currTime(UTC());
eventDriver.timers.set(tm, 100.msecs, 100.msecs);
void secondTier(TimerID timer) nothrow @safe {

View file

@ -22,12 +22,15 @@ void main()
// first timer: one-shot 200ms
auto tm = eventDriver.timers.create();
eventDriver.timers.wait(tm, (tm) nothrow @safe {
scope (failure) assert(false);
writefln("First timer");
Duration dur;
{
scope (failure) assert(false);
writefln("First timer");
dur = Clock.currTime(UTC()) - s_startTime;
}
auto dur = Clock.currTime(UTC()) - s_startTime;
assert(dur > 200.msecs);
assert(dur < 220.msecs);
assert(dur >= 200.msecs);
assert(dur < 250.msecs);
timer1fired = true;
});