mirror of
https://github.com/dlang/tools.git
synced 2025-04-25 20:51:00 +03:00
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:
commit
193492c746
1 changed files with 14 additions and 0 deletions
14
rdmd_test.d
14
rdmd_test.d
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue