Run high level tests on Windows.
This commit is contained in:
parent
b32b329d15
commit
f301e479a4
|
@ -153,3 +153,4 @@ test_script:
|
||||||
- echo %PATH%
|
- echo %PATH%
|
||||||
- '%DC% --version'
|
- '%DC% --version'
|
||||||
- dub test --arch=%Darch% --compiler=%DC% --config=%CONFIG%
|
- 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;
|
module test;
|
||||||
|
|
||||||
import eventcore.core;
|
|
||||||
import std.stdio : writefln;
|
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()
|
bool s_done;
|
||||||
{
|
|
||||||
version (OSX) writefln("Signals are not yet supported on macOS. Skipping test.");
|
|
||||||
else {
|
|
||||||
|
|
||||||
auto id = eventDriver.signals.listen(SIGUSR1, (id, status, sig) {
|
void main()
|
||||||
assert(!s_done);
|
{
|
||||||
assert(status == SignalStatus.ok);
|
auto id = eventDriver.signals.listen(SIGUSR1, (id, status, sig) {
|
||||||
assert(sig == () @trusted { return SIGUSR1; } ());
|
assert(!s_done);
|
||||||
eventDriver.signals.releaseRef(id);
|
assert(status == SignalStatus.ok);
|
||||||
s_done = true;
|
assert(sig == () @trusted { return SIGUSR1; } ());
|
||||||
});
|
eventDriver.signals.releaseRef(id);
|
||||||
|
s_done = true;
|
||||||
|
});
|
||||||
|
|
||||||
auto tm = eventDriver.timers.create();
|
auto tm = eventDriver.timers.create();
|
||||||
eventDriver.timers.set(tm, 500.msecs, 0.msecs);
|
eventDriver.timers.set(tm, 500.msecs, 0.msecs);
|
||||||
eventDriver.timers.wait(tm, (tm) {
|
eventDriver.timers.wait(tm, (tm) {
|
||||||
() @trusted { raise(SIGUSR1); } ();
|
() @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;
|
|
||||||
|
|
||||||
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
version (OSX) {
|
version (Linux) {
|
||||||
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 {
|
|
||||||
|
|
||||||
static ubyte[] pack1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
static ubyte[] pack1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||||
|
|
||||||
|
@ -68,5 +64,9 @@ void main()
|
||||||
assert(s_done);
|
assert(s_done);
|
||||||
s_done = false;
|
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[] pack1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||||
static ubyte[] pack2 = [4, 3, 2, 1, 0];
|
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 baddr = new InternetAddress(0x7F000001, 40001);
|
||||||
auto anyaddr = new InternetAddress(0x7F000001, 0);
|
auto anyaddr = new InternetAddress(0x7F000001, 0);
|
||||||
s_baseSocket = createDatagramSocket(baddr);
|
s_baseSocket = createDatagramSocket(baddr);
|
||||||
|
@ -55,14 +60,14 @@ void main()
|
||||||
destroy(s_connectedSocket);
|
destroy(s_connectedSocket);
|
||||||
s_done = true;
|
s_done = true;
|
||||||
log("done.");
|
log("done.");
|
||||||
})(s_rbuf, IOMode.immediate);
|
})(s_rbuf, mode_immediate);
|
||||||
});
|
});
|
||||||
})(s_rbuf, IOMode.once);
|
})(s_rbuf, IOMode.once);
|
||||||
s_connectedSocket.send!((status, bytes) {
|
s_connectedSocket.send!((status, bytes) {
|
||||||
log("send1: %s %s", status, bytes);
|
log("send1: %s %s", status, bytes);
|
||||||
assert(status == IOStatus.ok);
|
assert(status == IOStatus.ok);
|
||||||
assert(bytes == 10);
|
assert(bytes == 10);
|
||||||
})(pack1, IOMode.immediate);
|
})(pack1, mode_immediate);
|
||||||
|
|
||||||
ExitReason er;
|
ExitReason er;
|
||||||
do er = eventDriver.core.processEvents(Duration.max);
|
do er = eventDriver.core.processEvents(Duration.max);
|
||||||
|
|
Loading…
Reference in a new issue