From c74ce47cc9dcc37f41cce2f87b7773afc16461f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 5 Jul 2019 09:31:18 +0200 Subject: [PATCH 1/4] Update to DMD 2.087.1 and LDC 1.6.0. --- .travis.yml | 7 +++++-- README.md | 8 ++++++-- appveyor.yml | 16 ++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47221e4..9b24429 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,17 @@ d: # this way the overall test time gets cut down (GDC/LDC are a lot # slower tham DMD, so they should be started early), while still # catching most DMD version related build failures early - - dmd-2.086.0 + - dmd-2.087.1 - dmd-2.078.3 + - ldc-1.16.0 + - ldc-1.15.0 + - ldc-1.14.0 - ldc-1.13.0 - ldc-1.12.0 - ldc-1.11.0 - ldc-1.10.0 - ldc-1.9.0 - - ldc-1.8.0 + - dmd-2.086.1 - dmd-2.085.1 - dmd-2.084.1 - dmd-2.083.1 diff --git a/README.md b/README.md index ea9e9c5..c7b36a4 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ Supported compilers The following compilers are tested and supported: -- DMD 2.086.0 +- DMD 2.087.1 +- DMD 2.086.1 - DMD 2.085.1 - DMD 2.084.1 - DMD 2.083.1 @@ -34,7 +35,7 @@ The following compilers are tested and supported: - DMD 2.081.2 - DMD 2.080.1 - DMD 2.079.0 -- DMD 2.078.3 +- LDC 1.16.0 - LDC 1.15.0 - LDC 1.14.0 - LDC 1.13.0 @@ -42,6 +43,9 @@ The following compilers are tested and supported: - LDC 1.11.0 - LDC 1.10.0 - LDC 1.9.0 + +Supported up to 1.6.2: +- DMD 2.078.3 - LDC 1.8.0 Supported up to 1.4.7: diff --git a/appveyor.yml b/appveyor.yml index 0b0bcd9..99ea29f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,14 +2,17 @@ platform: x64 environment: matrix: - DC: dmd - DVersion: 2.086.0 + DVersion: 2.087.1 arch: x64 - DC: dmd - DVersion: 2.086.0 + DVersion: 2.087.1 arch: x86 - DC: dmd - DVersion: 2.086.0 + DVersion: 2.087.1 arch: x86_mscoff + - DC: dmd + DVersion: 2.086.1 + arch: x64 - DC: dmd DVersion: 2.085.1 arch: x64 @@ -31,8 +34,8 @@ environment: - DC: dmd DVersion: 2.079.0 arch: x86_mscoff - - DC: dmd - DVersion: 2.078.3 + - DC: ldc + DVersion: 1.16.0 arch: x64 - DC: ldc DVersion: 1.15.0 @@ -55,9 +58,6 @@ environment: - DC: ldc DVersion: 1.9.0 arch: x64 - - DC: ldc - DVersion: 1.8.0 - arch: x64 skip_tags: false From 3e619560af87eca6d25c5aaf1428dc5afdce6f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 5 Jul 2019 10:45:07 +0200 Subject: [PATCH 2/4] Add watchdog and log output to vibe.core.process test. --- tests/vibe.core.process.d | 268 ++++++++++++++++++++------------------ 1 file changed, 140 insertions(+), 128 deletions(-) diff --git a/tests/vibe.core.process.d b/tests/vibe.core.process.d index d47c9d7..a773b0c 100644 --- a/tests/vibe.core.process.d +++ b/tests/vibe.core.process.d @@ -9,201 +9,213 @@ import core.thread; import vibe.core.log; import vibe.core.core; import vibe.core.process; +import std.algorithm; import std.array; import std.range; -import std.algorithm; void testEcho() { - foreach (i; 0..100) { - auto procPipes = pipeProcess(["echo", "foo bar"], Redirect.stdout); + foreach (i; 0..100) { + auto procPipes = pipeProcess(["echo", "foo bar"], Redirect.stdout); - assert(!procPipes.process.exited); + assert(!procPipes.process.exited); - auto output = procPipes.stdout.collectOutput(); + auto output = procPipes.stdout.collectOutput(); - assert(procPipes.process.wait() == 0); - assert(procPipes.process.exited); + assert(procPipes.process.wait() == 0); + assert(procPipes.process.exited); - assert(output == "foo bar\n"); - } + assert(output == "foo bar\n"); + } } void testCat() { - auto procPipes = pipeProcess(["cat"]); + auto procPipes = pipeProcess(["cat"]); - string output; - auto outputTask = runTask({ - output = procPipes.stdout.collectOutput(); - }); + string output; + auto outputTask = runTask({ + output = procPipes.stdout.collectOutput(); + }); - auto inputs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] - .map!(s => s ~ "\n") - .repeat(4000).join.array; - foreach (input; inputs) { - procPipes.stdin.write(input); - } + auto inputs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + .map!(s => s ~ "\n") + .repeat(4000).join.array; + foreach (input; inputs) { + procPipes.stdin.write(input); + } - procPipes.stdin.close(); - assert(procPipes.process.wait() == 0); + procPipes.stdin.close(); + assert(procPipes.process.wait() == 0); - outputTask.join(); + outputTask.join(); - assert(output == inputs.join()); + assert(output == inputs.join()); } void testStderr() { - auto program = q{ - foreach (line; stdin.byLine()) - stderr.writeln(line); - }; - auto procPipes = pipeProcess(["rdmd", "--eval", program], Redirect.stdin | Redirect.stderr); + auto program = q{ + foreach (line; stdin.byLine()) + stderr.writeln(line); + }; + auto procPipes = pipeProcess(["rdmd", "--eval", program], Redirect.stdin | Redirect.stderr); - // Wait for rdmd to compile - sleep(3.seconds); + // Wait for rdmd to compile + sleep(3.seconds); - string output; - auto outputTask = runTask({ - output = procPipes.stderr.collectOutput(); - }); + string output; + auto outputTask = runTask({ + output = procPipes.stderr.collectOutput(); + }); - auto inputs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] - .map!(s => s ~ "\n") - .repeat(4000).join.array; - foreach (input; inputs) { - procPipes.stdin.write(input); - } + auto inputs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + .map!(s => s ~ "\n") + .repeat(4000).join.array; + foreach (input; inputs) { + procPipes.stdin.write(input); + } - procPipes.stdin.close(); - assert(procPipes.process.wait() == 0); + procPipes.stdin.close(); + assert(procPipes.process.wait() == 0); - outputTask.join(); + outputTask.join(); - assert(output == inputs.join); + assert(output == inputs.join); } void testRandomDeath() { - auto program = q{ - import core.thread; - import std.random; - Thread.sleep(dur!"msecs"(uniform(0, 1000))); - }; - // Prime rdmd - execute(["rdmd", "--eval", program]); + 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 process = spawnProcess(["rdmd", "--eval", program]); + foreach (i; 0..20) { + auto process = spawnProcess(["rdmd", "--eval", program]); - assert(!process.exited); + assert(!process.exited); - sleep(800.msecs); - try { - process.kill(); - } catch (Exception e) {} - process.wait(); + sleep(800.msecs); + try { + process.kill(); + } catch (Exception e) { + } + process.wait(); - assert(process.exited); - } + assert(process.exited); + } } void testIgnoreSigterm() { - auto program = q{ - import core.thread; - import core.sys.posix.signal; + auto program = q{ + import core.thread; + import core.sys.posix.signal; - signal(SIGINT, SIG_IGN); - signal(SIGTERM, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGTERM, SIG_IGN); - foreach (line; stdin.byLine()) { - writeln(line); - stdout.flush(); - } + foreach (line; stdin.byLine()) { + writeln(line); + stdout.flush(); + } - // Zombie - while (true) Thread.sleep(100.dur!"msecs"); - }; - auto procPipes = pipeProcess( - ["rdmd", "--eval", program], - Redirect.stdin | Redirect.stdout | Redirect.stderrToStdout); + // Zombie + while (true) Thread.sleep(100.dur!"msecs"); + }; + auto procPipes = pipeProcess( + ["rdmd", "--eval", program], + Redirect.stdin | Redirect.stdout | Redirect.stderrToStdout); - string output; - auto outputTask = runTask({ - output = procPipes.stdout.collectOutput(); - }); + string output; + auto outputTask = runTask({ + output = procPipes.stdout.collectOutput(); + }); - assert(!procPipes.process.exited); + assert(!procPipes.process.exited); - // Give the program some time to compile and install the signal handler - sleep(4.seconds); + // Give the program some time to compile and install the signal handler + sleep(4.seconds); - procPipes.process.kill(); - procPipes.stdin.write("foo\n"); + procPipes.process.kill(); + procPipes.stdin.write("foo\n"); - assert(!procPipes.process.exited); + assert(!procPipes.process.exited); - assert(procPipes.process.waitOrForceKill(2.seconds) == 9); + assert(procPipes.process.waitOrForceKill(2.seconds) == 9); - assert(procPipes.process.exited); + assert(procPipes.process.exited); - outputTask.join(); + outputTask.join(); - assert(output == "foo\n"); + assert(output == "foo\n"); } void testSimpleShell() { - auto res = executeShell("echo foo"); + auto res = executeShell("echo foo"); - assert(res.status == 0); - assert(res.output == "foo\n"); + assert(res.status == 0); + assert(res.output == "foo\n"); } void testLineEndings() { - auto program = q{ - write("linux\n"); - write("os9\r"); - write("win\r\n"); - }; - auto res = execute(["rdmd", "--eval", program]); + auto program = q{ + write("linux\n"); + write("os9\r"); + write("win\r\n"); + }; + auto res = execute(["rdmd", "--eval", program]); - assert(res.status == 0); - assert(res.output == "linux\nos9\rwin\r\n"); + assert(res.status == 0); + assert(res.output == "linux\nos9\rwin\r\n"); } void main() { - // rdmd --eval is only supported in versions >= 2.080 - static if (__VERSION__ >= 2080) { - runTask({ - auto tasks = [ - &testEcho, - &testCat, - &testStderr, - &testRandomDeath, - &testIgnoreSigterm, - &testSimpleShell, - &testLineEndings, - ].map!(fn => runTask({ - try { - fn(); - } catch (Exception e) { - logError("%s", e); - throw e; - } - })); + import core.stdc.stdlib : abort; + import core.time; + import std.meta : AliasSeq; - foreach (task; tasks) { - task.join(); - } + // rdmd --eval is only supported in versions >= 2.080 + static if (__VERSION__ >= 2080) { + runTask({ + alias Tasks = AliasSeq!( + testEcho, + testCat, + testStderr, + testRandomDeath, + testIgnoreSigterm, + testSimpleShell, + testLineEndings + ); - exitEventLoop(); - }); + static foreach (alias task; Tasks) {{ + auto t = runTask({ + logInfo("Running test %s...", __traits(identifier, task)); + auto tm = setTimer(60.seconds, { + logError("Test %s timed out!", __traits(identifier, task)); + abort(); + }); + try { + task(); + } catch (Exception e) { + logError("Test %s failed: %s", __traits(identifier, task), e); + abort(); + } + tm.stop(); + }); + t.join(); + }} - runEventLoop(); - } + exitEventLoop(); + }); + + runEventLoop(); + } } From 771dc872c29018df5c955a561bfaebc9c4da8b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 23 Aug 2019 09:54:22 +0200 Subject: [PATCH 3/4] Restrict the set of tested compiler versions to the latest 4 + the oldest supported. --- .travis.yml | 7 ------- README.md | 7 ------- appveyor.yml | 21 --------------------- 3 files changed, 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b24429..2b09fd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,17 +11,10 @@ d: - ldc-1.15.0 - ldc-1.14.0 - ldc-1.13.0 - - ldc-1.12.0 - - ldc-1.11.0 - - ldc-1.10.0 - ldc-1.9.0 - dmd-2.086.1 - dmd-2.085.1 - dmd-2.084.1 - - dmd-2.083.1 - - dmd-2.082.1 - - dmd-2.081.2 - - dmd-2.080.1 - dmd-2.079.0 - dmd-beta diff --git a/README.md b/README.md index c7b36a4..eafab7c 100644 --- a/README.md +++ b/README.md @@ -30,18 +30,11 @@ The following compilers are tested and supported: - DMD 2.086.1 - DMD 2.085.1 - DMD 2.084.1 -- DMD 2.083.1 -- DMD 2.082.1 -- DMD 2.081.2 -- DMD 2.080.1 - DMD 2.079.0 - LDC 1.16.0 - LDC 1.15.0 - LDC 1.14.0 - LDC 1.13.0 -- LDC 1.12.0 -- LDC 1.11.0 -- LDC 1.10.0 - LDC 1.9.0 Supported up to 1.6.2: diff --git a/appveyor.yml b/appveyor.yml index 99ea29f..0cd3448 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,18 +19,6 @@ environment: - DC: dmd DVersion: 2.084.1 arch: x86 - - DC: dmd - DVersion: 2.083.1 - arch: x86_mscoff - - DC: dmd - DVersion: 2.082.1 - arch: x86_mscoff - - DC: dmd - DVersion: 2.081.2 - arch: x86_mscoff - - DC: dmd - DVersion: 2.080.1 - arch: x86_mscoff - DC: dmd DVersion: 2.079.0 arch: x86_mscoff @@ -46,15 +34,6 @@ environment: - DC: ldc DVersion: 1.13.0 arch: x64 - - DC: ldc - DVersion: 1.12.0 - arch: x64 - - DC: ldc - DVersion: 1.11.0 - arch: x64 - - DC: ldc - DVersion: 1.10.0 - arch: x64 - DC: ldc DVersion: 1.9.0 arch: x64 From d549829c8820069328c830fcf01e54d070aea30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sat, 24 Aug 2019 10:19:29 +0200 Subject: [PATCH 4/4] Fix process test. --- tests/vibe.core.process.d | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/vibe.core.process.d b/tests/vibe.core.process.d index a773b0c..be1bf10 100644 --- a/tests/vibe.core.process.d +++ b/tests/vibe.core.process.d @@ -18,8 +18,6 @@ void testEcho() foreach (i; 0..100) { auto procPipes = pipeProcess(["echo", "foo bar"], Redirect.stdout); - assert(!procPipes.process.exited); - auto output = procPipes.stdout.collectOutput(); assert(procPipes.process.wait() == 0); @@ -146,7 +144,7 @@ void testIgnoreSigterm() assert(!procPipes.process.exited); - assert(procPipes.process.waitOrForceKill(2.seconds) == 9); + assert(procPipes.process.waitOrForceKill(2.seconds) == -9); assert(procPipes.process.exited);