Merge pull request #275 from marler8997/rdmd_test_relative

Make rdmd_test.exe work with relative --compiler binary
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2017-12-18 08:40:18 +01:00 committed by GitHub
commit 193492c746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,7 @@ string rdmdApp; // path/to/rdmd.exe (once built)
string compiler = "dmd"; // e.g. dmd/gdmd/ldmd
string model = "64"; // build architecture for dmd
string[] rdmdArgs; // path to rdmd + common arguments (compiler, model)
bool verbose = false;
void main(string[] args)
{
@ -56,6 +57,7 @@ void main(string[] args)
"rdmd", &rdmd,
"concurrency", &concurrencyTest,
"m|model", &model,
"v|verbose", &verbose,
);
enforce(rdmd.exists, "Path to rdmd does not exist: %s".format(rdmd));
@ -63,6 +65,10 @@ void main(string[] args)
rdmdApp = tempDir().buildPath("rdmd_app_") ~ binExt;
if (rdmdApp.exists) std.file.remove(rdmdApp);
// compiler needs to be an absolute path because we change directories
if (compiler.canFind!isDirSeparator)
compiler = buildNormalizedPath(compiler.absolutePath());
auto res = execute([compiler, modelSwitch, "-of" ~ rdmdApp, rdmd]);
enforce(res.status == 0, res.output);
@ -78,6 +84,14 @@ void main(string[] args)
@property string compilerSwitch() { return "--compiler=" ~ compiler; }
@property string modelSwitch() { return "-m" ~ model; }
auto execute(T...)(T args)
{
import std.stdio : writefln;
if (verbose)
writefln("[execute] %s", args[0]);
return std.process.execute(args);
}
void runTests()
{
/* Test help string output when no arguments passed. */