Skip to content

Commit

Permalink
[convert test/dynLib-monolith.sh to dynLib-monolith.script.d for Wind…
Browse files Browse the repository at this point in the history
…ows support]
  • Loading branch information
kinke committed Aug 19, 2023
1 parent 49643e9 commit fee329f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
40 changes: 40 additions & 0 deletions test/dynLib-monolith.script.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/+ dub.json: {
"name": "dynlib-monolith-script"
} +/
module dynlib_monolith_script;

import std.algorithm, std.path, std.process, std.stdio;

int main()
{
const dc = environment.get("DC", "dmd");
if (!dc.startsWith("ldc"))
{
writeln("Skipping test, needs LDC");
return 0;
}

// enforce a full build (2 static libs, 1 dynamic one) and collect -v output
enum projDir = dirName(__FILE_FULL_PATH__).buildPath("dynLib-monolith");
const res = execute([environment.get("DUB", "dub"), "build", "-f", "-v", "--root", projDir]);

if (res.status != 0)
{
writeln("The dub invocation failed:");
writeln();
writeln(res.output);
return 1;
}

version (Windows) enum needle = " -fvisibility=hidden -dllimport=defaultLibsOnly";
else enum needle = " -fvisibility=hidden";
if (res.output.count(needle) != 3)
{
writeln("Didn't find 3 occurrences of '" ~ needle ~ "' in the verbose dub output:");
writeln();
writeln(res.output);
return 1;
}

return 0;
}
16 changes: 0 additions & 16 deletions test/dynLib-monolith.sh

This file was deleted.

0 comments on commit fee329f

Please sign in to comment.