diff --git a/appveyor.yml b/appveyor.yml index 0ef724f..8f73b8f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/tests/0-signal.d b/tests/0-signal.d index 22252e8..0239843 100644 --- a/tests/0-signal.d +++ b/tests/0-signal.d @@ -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."); } } diff --git a/tests/0-tcp-readwait.d b/tests/0-tcp-readwait.d index e668280..de9aed6 100644 --- a/tests/0-tcp-readwait.d +++ b/tests/0-tcp-readwait.d @@ -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; } } diff --git a/tests/0-udp.d b/tests/0-udp.d index 0369237..f761bfb 100644 --- a/tests/0-udp.d +++ b/tests/0-udp.d @@ -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);