Skip to content

Commit

Permalink
Merge pull request #2129 from vibe-d/test_latest_compilers_on_0.7
Browse files Browse the repository at this point in the history
Test on DMD 2.079.0 and LDC 1.8.0.
  • Loading branch information
s-ludwig authored Apr 25, 2018
2 parents b1e46af + b594d17 commit 2fb165b
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 28 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ 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.075.0
- dmd-2.079.0
- dmd-2.068.2
- ldc-1.8.0
- ldc-1.3.0
- ldc-1.2.0
- ldc-1.1.1
- ldc-1.0.0
- dmd-2.075.0
- dmd-2.074.1
- dmd-2.073.2
- dmd-2.072.2
Expand All @@ -46,6 +48,8 @@ matrix:
env: VIBED_DRIVER=libasync BUILD_EXAMPLE=0 RUN_TEST=0
allow_failures:
- d: dmd-beta
- d: dmd-2.072.2 # incompatible dub version
- d: ldc-1.1.1 # buggy dub version
- d: ldc-1.3.0
env: VIBED_DRIVER=libasync BUILD_EXAMPLE=0 RUN_TEST=0
- d: dmd-2.068.2
Expand Down
43 changes: 31 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@ platform: x64
environment:
matrix:
- DC: dmd
DVersion: 2.076.0
DVersion: 2.079.0
arch: x64
config: win32
- DC: dmd
DVersion: 2.076.0
DVersion: 2.079.0
arch: x86
config: win32
- DC: dmd
DVersion: 2.076.0
DVersion: 2.079.0
arch: x86_mscoff
config: win32
- DC: dmd
DVersion: 2.076.0
DVersion: 2.079.0
arch: x86
config: libevent
- DC: dmd
DVersion: 2.076.0
DVersion: 2.079.0
arch: x86
config: libasync
- DC: dmd
DVersion: 2.079.0
arch: x86_mscoff
config: win32
- DC: dmd
DVersion: 2.076.0
arch: x86_mscoff
Expand Down Expand Up @@ -49,6 +53,10 @@ environment:
DVersion: 2.070.0
arch: x64
config: win32
- DC: ldc
DVersion: 1.8.0
arch: x64
config: win32
- DC: ldc
DVersion: 1.3.0
arch: x64
Expand Down Expand Up @@ -100,15 +108,22 @@ install:
}
$env:toolchain = "msvc";
$version = $env:DVersion;
Invoke-WebRequest "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-win64-msvc.zip" -OutFile "c:\ldc.zip";
echo "finished.";
pushd c:\\;
7z x ldc.zip > $null;
popd;
if($version -eq "1.3.0" -Or $version -eq "1.4.0" -Or $version -eq "1.5.0" -Or $version -eq "1.6.0") {
Invoke-WebRequest "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-win64-msvc.zip" -OutFile "c:\ldc.zip";
echo "finished.";
pushd c:\\;
7z x ldc.zip > $null;
popd;
} else {
Invoke-WebRequest "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-windows-$($env:arch).7z" -OutFile "c:\ldc.7z";
pushd c:\\;
7z x ldc.7z > $null;
popd;
}
}
}
- ps: SetUpDCompiler
- powershell -Command Invoke-WebRequest https://code.dlang.org/files/dub-1.2.1-windows-x86.zip -OutFile dub.zip
- powershell -Command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest "https://github.com/dlang/dub/releases/download/v1.7.2/dub-1.7.2-windows-x86.zip" -OutFile dub.zip
- 7z x dub.zip -odub > nul
- set PATH=%CD%\%binpath%;%CD%\dub;%PATH%
- dub --version
Expand All @@ -131,7 +146,11 @@ before_build:
}
elseif($env:DC -eq "ldc"){
$version = $env:DVersion;
$env:PATH += ";C:\ldc2-$($version)-win64-msvc\bin";
if($version -eq "1.3.0" -Or $version -eq "1.4.0" -Or $version -eq "1.5.0" -Or $version -eq "1.6.0") {
$env:PATH += ";C:\ldc2-$($version)-win64-msvc\bin";
} else {
$env:PATH += ";C:\ldc2-$($version)-windows-$($env:arch)\bin";
}
$env:DC = "ldc2";
}
- ps: $env:compilersetup = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall";
Expand Down
1 change: 1 addition & 0 deletions source/vibe/core/drivers/utils.d
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ version (Windows) {
} else alias SystemSocketException = ErrnoException;

version (linux) {
import core.sys.posix.sys.socket;
static if (!is(typeof(SO_REUSEPORT))) {
enum { SO_REUSEPORT = 15 }
}
Expand Down
11 changes: 6 additions & 5 deletions source/vibe/data/serialization.d
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ private template deserializeValueImpl(Serializer, alias Policy) {
return cast(T) deserializeValue!(Unqual!T, ATTRIBUTES)(ser);
}

T deserializeValue(T, ATTRIBUTES...)(ref Serializer ser) if(isMutable!T)
T deserializeValue(T, ATTRIBUTES...)(ref Serializer ser) if(isMutable!T)
{
import std.typecons : BitFlags, Nullable;

Expand Down Expand Up @@ -1285,7 +1285,8 @@ unittest { // basic serialization behavior
test(12.0f, "V(f)(12)");
assert(serialize!TestSerializer(null) == "null");
test(["hello", "world"], "A(AAya)[2][AE(Aya,0)(V(Aya)(hello))AE(Aya,0)AE(Aya,1)(V(Aya)(world))AE(Aya,1)]A(AAya)");
test(["hello": "world"], "D(HAyaAya){DE(Aya,hello)(V(Aya)(world))DE(Aya,hello)}D(HAyaAya)");
string mangleOfAA = (string[string]).mangleof;
test(["hello": "world"], "D(" ~ mangleOfAA ~ "){DE(Aya,hello)(V(Aya)(world))DE(Aya,hello)}D(" ~ mangleOfAA ~ ")");
test(cast(int*)null, "null");
int i = 42;
test(&i, "V(i)(42)");
Expand Down Expand Up @@ -1438,14 +1439,14 @@ unittest // Make sure serializing through properties still works
unittest // Immutable data deserialization
{
import vibe.data.json;

static struct S {
int a;
}
static class C {
immutable(S)[] arr;
}

auto c = new C;
c.arr ~= S(10);
auto d = c.serializeToJson().deserializeJson!(immutable C);
Expand Down Expand Up @@ -1559,7 +1560,7 @@ unittest {
auto ser_red = "V(Aya)(red)";
assert(serializeWithPolicy!(TestSerializer, P)(E.RED) == ser_red, serializeWithPolicy!(TestSerializer, P)(E.RED));
assert(deserializeWithPolicy!(TestSerializer, P, E)(ser_red) == E.RED);

import vibe.data.json : Json, JsonSerializer;
assert(serializeWithPolicy!(JsonSerializer, P)(E.RED) == Json("red"));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/vibe.core.net.1726/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import vibe.core.log;
shared static this()
{
bool done = false;
auto buf = new ubyte[512*1024*1024];
auto buf = new ubyte[256*1024*1024];

listenTCP(11375,(conn) {
bool read_ex = false;
Expand Down Expand Up @@ -37,7 +37,7 @@ shared static this()
assert(read_ex, "No read exception thrown");
assert(write_ex, "No write exception thrown");
exitEventLoop();
});
}, "127.0.0.1");

runTask({
try {
Expand Down
4 changes: 2 additions & 2 deletions tests/vibe.http.server.1721/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ shared static this()
{
auto s1 = new HTTPServerSettings;
s1.options &= ~HTTPServerOption.errorStackTraces;
s1.bindAddresses = ["::1"];
s1.bindAddresses = ["127.0.0.1"];
s1.port = 11721;
listenHTTP(s1, &handler);

runTask({
scope (exit) exitEventLoop();

try {
auto conn = connectTCP("::1", 11721);
auto conn = connectTCP("127.0.0.1", 11721);
conn.write("GET / HTTP/1.0\r\n\r\n");
string res = cast(string)conn.readLine();
assert(res == "HTTP/1.0 200 OK", res);
Expand Down
8 changes: 4 additions & 4 deletions tests/vibe.http.server.host-header/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ shared static this()
{
auto s1 = new HTTPServerSettings;
s1.options &= ~HTTPServerOption.errorStackTraces;
s1.bindAddresses = ["::1"];
s1.bindAddresses = ["127.0.0.1"];
s1.port = 11388;
listenHTTP(s1, &handler);

runTask({
scope (failure) assert(false);

auto conn = connectTCP("::1", 11388);
conn.write("GET / HTTP/1.1\r\nHost: [::1]\r\n\r\n");
auto conn = connectTCP("127.0.0.1", 11388);
conn.write("GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n");
string res = cast(string)conn.readLine();
assert(res == "HTTP/1.1 200 OK", res);
while (conn.readLine().length > 0) {}
Expand All @@ -36,7 +36,7 @@ shared static this()
assert(!conn.connected && conn.empty);
logInfo("1.1 without Host header OK.");

conn = connectTCP("::1", 11388);
conn = connectTCP("127.0.0.1", 11388);
conn.write("GET / HTTP/1.0\r\n\r\n");
res = cast(string)conn.readLine();
assert(res == "HTTP/1.0 200 OK", res);
Expand Down
8 changes: 6 additions & 2 deletions travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ if [ ${BUILD_EXAMPLE=1} -eq 1 ]; then
fi
if [ ${RUN_TEST=1} -eq 1 ]; then
for ex in `\ls -1 tests/`; do
echo "[INFO] Running test $ex"
(cd tests/$ex && dub --compiler=$DC && dub clean)
if [ $ex == "vibe.http.server.1388" ]; then
echo "[WARNING] Skipping test $ex due to TravisCI incompatibility".
else
echo "[INFO] Running test $ex"
(cd tests/$ex && dub --compiler=$DC && dub clean)
fi
done
fi

Expand Down

0 comments on commit 2fb165b

Please sign in to comment.