Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit b068738

Browse files
authored
Merge pull request #2050 from aliak00/benchmark-runner
Fix paths in benchmark runner merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents fca2892 + 4491303 commit b068738

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

benchmark/runbench.d

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ struct Config
1717
uint repeat = 10;
1818
}
1919

20-
string runCmd(string cmd, bool verbose)
20+
string runCmd(string cmd, bool verbose, in char[] workDir = null)
2121
{
2222
import std.exception : enforce;
23-
import std.process : executeShell;
23+
import std.process : executeShell, Config;
2424

2525
if (verbose) writeln(cmd);
26-
auto res = executeShell(cmd);
26+
auto res = executeShell(cmd, null, Config.none, size_t.max, workDir);
2727
enforce(res.status == 0, res.output);
2828
return res.output;
2929
}
@@ -72,13 +72,15 @@ void runTests(Config cfg)
7272

7373
import std.parallelism : parallel;
7474
immutable bindir = absolutePath("bin", cwd);
75+
immutable objdir = absolutePath("obj", cwd);
7576

7677
foreach(ref src; sources.parallel(1))
7778
{
7879
writeln("COMPILING ", src);
7980
version (Windows) enum exe = "exe"; else enum exe = "";
8081
auto bin = buildPath(bindir, src.relativePath(cwd).setExtension(exe));
81-
auto cmd = std.string.format("%s %s -op -odobj -of%s %s", cfg.dmd, cfg.dflags, bin, src);
82+
auto obj = buildPath(objdir, src.relativePath(cwd).setExtension(exe));
83+
auto cmd = std.string.format("%s %s -op -od%s -of%s %s", cfg.dmd, cfg.dflags, obj, bin, src);
8284
if (auto ex = src in extra_sources)
8385
cmd ~= " -I" ~ src[0..$-2] ~ ".extra" ~ *ex;
8486
runCmd(cmd, cfg.verbose);
@@ -109,7 +111,7 @@ void runTests(Config cfg)
109111
foreach (_; 0 .. cfg.repeat)
110112
{
111113
sw.reset;
112-
auto output = runCmd(cmd, cfg.verbose);
114+
auto output = runCmd(cmd, cfg.verbose, cwd);
113115
auto dur = cast(Duration)sw.peek;
114116

115117
auto parts = dur.split!("seconds", "msecs");

0 commit comments

Comments
 (0)