From 65980326a11310718d846b7d90a2bdbe336acba1 Mon Sep 17 00:00:00 2001 From: Benjamin Schaaf Date: Sun, 5 May 2019 18:02:26 +1000 Subject: [PATCH] Add timeouts to avoid the compile time effects of rdmd on tests passing --- tests/vibe.core.process.d | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/vibe.core.process.d b/tests/vibe.core.process.d index c4a1188..eb184d9 100644 --- a/tests/vibe.core.process.d +++ b/tests/vibe.core.process.d @@ -61,6 +61,9 @@ void testStderr() }; auto procPipes = pipeProcess(["rdmd", "--eval", program], Redirect.stdin | Redirect.stderr); + // Wait for rdmd to compile + sleep(1.seconds); + string output; auto outputTask = runTask({ output = procPipes.stderr.collectOutput(); @@ -83,12 +86,15 @@ void testStderr() void testRandomDeath() { + auto program = q{ + import core.thread; + import std.random; + Thread.sleep(dur!"msecs"(uniform(0, 1000))); + }; + // Prime rdmd + execute(["rdmd", "--eval", program]); + foreach (i; 0..20) { - auto program = q{ - import core.thread; - import std.random; - Thread.sleep(dur!"msecs"(uniform(0, 1000))); - }; auto process = spawnProcess(["rdmd", "--eval", program]); assert(!process.exited); @@ -131,8 +137,8 @@ void testIgnoreSigterm() assert(!procPipes.process.exited); - // Give the program some time to install the signal handler - sleep(1.seconds); + // Give the program some time to compile and install the signal handler + sleep(2.seconds); procPipes.process.kill(); procPipes.stdin.write("foo\n");