Adjust all tests to rely on automatic event loop exiting.
This commit is contained in:
parent
d99eb1be34
commit
b20dd9b398
|
@ -39,8 +39,8 @@ void main()
|
|||
assert(change.kind == FileChangeKind.removed);
|
||||
assert(change.directory == ".");
|
||||
assert(change.name == testFilename);
|
||||
eventDriver.watchers.releaseRef(id);
|
||||
s_done = true;
|
||||
eventDriver.core.exit();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -63,7 +63,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
|
||||
|
|
|
@ -21,13 +21,12 @@ void main()
|
|||
catch (Exception e) assert(false, e.msg);
|
||||
}
|
||||
s_done = true;
|
||||
eventDriver.core.exit();
|
||||
});
|
||||
|
||||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ void test(bool notify_all)
|
|||
assert(!s_done);
|
||||
s_done = true;
|
||||
eventDriver.timers.cancelWait(tm);
|
||||
eventDriver.core.exit();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -51,7 +50,7 @@ void test(bool notify_all)
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,6 @@ void main()
|
|||
auto f = eventDriver.files.open("test.txt", FileOpenMode.createTrunc);
|
||||
assert(eventDriver.files.getSize(f) == 0);
|
||||
auto data = cast(const(ubyte)[])"Hello, World!";
|
||||
auto tm = eventDriver.timers.create();
|
||||
eventDriver.timers.set(tm, 500.msecs, 0.msecs);
|
||||
eventDriver.timers.wait(tm, (tm) {
|
||||
assert(false, "File operation stalled.");
|
||||
});
|
||||
|
||||
eventDriver.files.write(f, 0, data[0 .. 7], IOMode.all, (f, status, nbytes) {
|
||||
assert(status == IOStatus.ok);
|
||||
|
@ -48,7 +43,6 @@ void main()
|
|||
} ();
|
||||
eventDriver.files.releaseRef(f);
|
||||
s_done = true;
|
||||
eventDriver.core.exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -57,7 +51,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ void main()
|
|||
assert(!s_done);
|
||||
assert(status == SignalStatus.ok);
|
||||
assert(sig == () @trusted { return SIGUSR1; } ());
|
||||
eventDriver.signals.releaseRef(id);
|
||||
s_done = true;
|
||||
eventDriver.core.exit();
|
||||
});
|
||||
|
||||
auto tm = eventDriver.timers.create();
|
||||
|
@ -34,7 +34,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@ void main()
|
|||
destroy(server);
|
||||
destroy(client);
|
||||
s_done = true;
|
||||
|
||||
// FIXME: this shouldn't ne necessary:
|
||||
eventDriver.core.exit();
|
||||
})(s_rbuf, IOMode.immediate);
|
||||
})(s_rbuf[0 .. 0], IOMode.once);
|
||||
});
|
||||
|
@ -67,7 +64,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@ void main()
|
|||
destroy(server);
|
||||
destroy(client);
|
||||
s_done = true;
|
||||
|
||||
// FIXME: this shouldn't ne necessary:
|
||||
eventDriver.core.exit();
|
||||
})(s_rbuf, IOMode.once);
|
||||
})(s_rbuf, IOMode.once);
|
||||
});
|
||||
|
@ -62,7 +59,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
|
@ -34,10 +34,11 @@ void main()
|
|||
s_cnt++;
|
||||
assert(dur > 100.msecs * s_cnt);
|
||||
assert(dur < 100.msecs * s_cnt + 20.msecs);
|
||||
assert(s_cnt <= 3);
|
||||
|
||||
if (s_cnt == 3) {
|
||||
s_done = true;
|
||||
eventDriver.core.exit();
|
||||
eventDriver.timers.stop(timer);
|
||||
} else eventDriver.timers.wait(tm, &secondTier);
|
||||
} catch (Exception e) {
|
||||
assert(false, e.msg);
|
||||
|
@ -52,7 +53,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
|
@ -55,9 +55,6 @@ void main()
|
|||
destroy(s_connectedSocket);
|
||||
s_done = true;
|
||||
log("done.");
|
||||
|
||||
// FIXME: this shouldn't be necessary:
|
||||
eventDriver.core.exit();
|
||||
})(s_rbuf, IOMode.immediate);
|
||||
});
|
||||
})(s_rbuf, IOMode.once);
|
||||
|
@ -70,7 +67,7 @@ void main()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,9 +118,6 @@ void testStream()
|
|||
destroy(server);
|
||||
destroy(client);
|
||||
s_done = true;
|
||||
|
||||
// FIXME: this shouldn't ne necessary:
|
||||
eventDriver.core.exit();
|
||||
})(s_rbuf, IOMode.once);
|
||||
})(s_rbuf, IOMode.once);
|
||||
});
|
||||
|
@ -137,7 +134,7 @@ void testStream()
|
|||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
//assert(er == ExitReason.outOfWaiters); // FIXME: see above
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue