Skip to content

Commit

Permalink
run.d: Recompile dmd if necessary
Browse files Browse the repository at this point in the history
Call `build.d` during startup to ensure that the tested compiler exists
and is up to date.
  • Loading branch information
MoonlightSentinel committed Sep 28, 2020
1 parent 9bf41e9 commit 66a942b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/run.d
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,20 @@ Options:
/// Verify that the compiler has been built.
void verifyCompilerExists(string[string] env)
{
if (!env["DMD"].exists)
enum BUILD_D = buildPath(scriptDir, "..", "src", "build.d");
const scope cmd = [ `rdmd`, BUILD_D ];

// Only forward relevant flags and translate if necessary
const scope buildEnv = [
"BUILD": env["BUILD"],
"MODEL": env["DMD_MODEL"], // MODEL refers to compiled tests
];

log("run: %-(%s %)", cmd);

if (spawnProcess(cmd, buildEnv).wait())
{
stderr.writefln("%s doesn't exist, try building dmd with:\nmake -fposix.mak -j8 -C%s", env["DMD"], scriptDir.dirName.relativePath);
log("Failed to build dmd");
quitSilently(1);
}
}
Expand Down

0 comments on commit 66a942b

Please sign in to comment.