Run high level tests on Windows.
This commit is contained in:
parent
b32b329d15
commit
f301e479a4
|
@ -153,3 +153,4 @@ test_script:
|
|||
- echo %PATH%
|
||||
- '%DC% --version'
|
||||
- dub test --arch=%Darch% --compiler=%DC% --config=%CONFIG%
|
||||
- for %%i in (tests\*.d) do echo %%i && dub --single %%i --arch=%Darch% --compiler=%DC% --override-config eventcore/%CONFIG% || exit /B 1
|
||||
|
|
|
@ -4,39 +4,42 @@
|
|||
+/
|
||||
module test;
|
||||
|
||||
import eventcore.core;
|
||||
import std.stdio : writefln;
|
||||
import core.stdc.signal;
|
||||
import core.sys.posix.signal : SIGUSR1;
|
||||
import core.time : Duration, msecs;
|
||||
|
||||
bool s_done;
|
||||
version (Linux) {
|
||||
import eventcore.core;
|
||||
import core.stdc.signal;
|
||||
import core.sys.posix.signal : SIGUSR1;
|
||||
import core.time : Duration, msecs;
|
||||
|
||||
void main()
|
||||
{
|
||||
version (OSX) writefln("Signals are not yet supported on macOS. Skipping test.");
|
||||
else {
|
||||
bool s_done;
|
||||
|
||||
auto id = eventDriver.signals.listen(SIGUSR1, (id, status, sig) {
|
||||
assert(!s_done);
|
||||
assert(status == SignalStatus.ok);
|
||||
assert(sig == () @trusted { return SIGUSR1; } ());
|
||||
eventDriver.signals.releaseRef(id);
|
||||
s_done = true;
|
||||
});
|
||||
void main()
|
||||
{
|
||||
auto id = eventDriver.signals.listen(SIGUSR1, (id, status, sig) {
|
||||
assert(!s_done);
|
||||
assert(status == SignalStatus.ok);
|
||||
assert(sig == () @trusted { return SIGUSR1; } ());
|
||||
eventDriver.signals.releaseRef(id);
|
||||
s_done = true;
|
||||
});
|
||||
|
||||
auto tm = eventDriver.timers.create();
|
||||
eventDriver.timers.set(tm, 500.msecs, 0.msecs);
|
||||
eventDriver.timers.wait(tm, (tm) {
|
||||
() @trusted { raise(SIGUSR1); } ();
|
||||
});
|
||||
|
||||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
auto tm = eventDriver.timers.create();
|
||||
eventDriver.timers.set(tm, 500.msecs, 0.msecs);
|
||||
eventDriver.timers.wait(tm, (tm) {
|
||||
() @trusted { raise(SIGUSR1); } ();
|
||||
});
|
||||
|
||||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
while (er == ExitReason.idle);
|
||||
assert(er == ExitReason.outOfWaiters);
|
||||
assert(s_done);
|
||||
s_done = false;
|
||||
}
|
||||
} else {
|
||||
void main()
|
||||
{
|
||||
writefln("Signals are not yet supported on macOS/Windows. Skipping test.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,7 @@ bool s_done;
|
|||
|
||||
void main()
|
||||
{
|
||||
version (OSX) {
|
||||
import std.stdio;
|
||||
writeln("This doesn't work on macOS. Skipping this test until it is determined that this special case should stay supported.");
|
||||
return;
|
||||
} else {
|
||||
version (Linux) {
|
||||
|
||||
static ubyte[] pack1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
|
@ -68,5 +64,9 @@ void main()
|
|||
assert(s_done);
|
||||
s_done = false;
|
||||
|
||||
} else {
|
||||
import std.stdio;
|
||||
writeln("This doesn't work on macOS/Windows. Skipping this test until it is determined that this special case should stay supported.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,11 @@ void main()
|
|||
static ubyte[] pack1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
static ubyte[] pack2 = [4, 3, 2, 1, 0];
|
||||
|
||||
// Windows can not provide "immediate" semantics using the overlapped
|
||||
// I/O API that is used
|
||||
version (Windows) enum mode_immediate = IOMode.once;
|
||||
else enum mode_immediate = IOMode.immediate;
|
||||
|
||||
auto baddr = new InternetAddress(0x7F000001, 40001);
|
||||
auto anyaddr = new InternetAddress(0x7F000001, 0);
|
||||
s_baseSocket = createDatagramSocket(baddr);
|
||||
|
@ -55,14 +60,14 @@ void main()
|
|||
destroy(s_connectedSocket);
|
||||
s_done = true;
|
||||
log("done.");
|
||||
})(s_rbuf, IOMode.immediate);
|
||||
})(s_rbuf, mode_immediate);
|
||||
});
|
||||
})(s_rbuf, IOMode.once);
|
||||
s_connectedSocket.send!((status, bytes) {
|
||||
log("send1: %s %s", status, bytes);
|
||||
assert(status == IOStatus.ok);
|
||||
assert(bytes == 10);
|
||||
})(pack1, IOMode.immediate);
|
||||
})(pack1, mode_immediate);
|
||||
|
||||
ExitReason er;
|
||||
do er = eventDriver.core.processEvents(Duration.max);
|
||||
|
|
Loading…
Reference in a new issue