Skip to content

Commit b58ba5c

Browse files
committed
[convert test/dynLib-monolith.sh to dynLib-monolith.script.d for Windows support]
1 parent 49643e9 commit b58ba5c

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

test/dynLib-monolith.script.d

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/+ dub.json: {
2+
"name": "dynlib-monolith-script"
3+
} +/
4+
module dynlib_monolith_script;
5+
6+
import std.algorithm, std.path, std.process, std.stdio;
7+
8+
int main()
9+
{
10+
const dc = environment.get("DC", "dmd");
11+
if (!dc.startsWith("ldc"))
12+
{
13+
writeln("Skipping test, needs LDC");
14+
return 0;
15+
}
16+
17+
// enforce a full build (2 static libs, 1 dynamic one) and collect -v output
18+
enum projDir = dirName(__FILE_FULL_PATH__).buildPath("dynLib-monolith");
19+
const res = execute([environment.get("DUB", "dub"), "build", "-f", "-v", "--root", projDir]);
20+
21+
int errorOut(string msg)
22+
{
23+
writeln("Error: " ~ msg);
24+
writeln("===========================================================");
25+
writeln(res.output);
26+
writeln("===========================================================");
27+
return 1;
28+
}
29+
30+
if (res.status != 0)
31+
return errorOut("The dub invocation failed:");
32+
33+
version (Windows) enum needle = " -fvisibility=hidden -dllimport=defaultLibsOnly";
34+
else enum needle = " -fvisibility=hidden";
35+
if (res.output.count(needle) != 3)
36+
return errorOut("Cannot find exactly 3 occurrences of '" ~ needle ~ "' in the verbose dub output:");
37+
38+
return 0;
39+
}

test/dynLib-monolith.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)