Run high level tests on Windows.

This commit is contained in:
Sönke Ludwig 2020-03-15 18:53:18 +01:00
parent b32b329d15
commit f301e479a4
4 changed files with 44 additions and 35 deletions

View file

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

View file

@ -4,19 +4,18 @@
+/
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;
void main()
{
auto id = eventDriver.signals.listen(SIGUSR1, (id, status, sig) {
assert(!s_done);
assert(status == SignalStatus.ok);
@ -37,6 +36,10 @@ void main()
assert(er == ExitReason.outOfWaiters);
assert(s_done);
s_done = false;
}
} else {
void main()
{
writefln("Signals are not yet supported on macOS/Windows. Skipping test.");
}
}

View file

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

View file

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