aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-12 22:23:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-12 22:23:08 +0300
commitc030e580940929c8f395de73507f943b9c35e0ec (patch)
tree68a8ebe2160b83ba58093fc4e445190cc0506180
parent93d4cf5825910445c6dcd2a038b43b7996236010 (diff)
Fix inability to run program by relative path in testscript
-rw-r--r--build2/test/script/runner.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx
index 000b605..13f7f8a 100644
--- a/build2/test/script/runner.cxx
+++ b/build2/test/script/runner.cxx
@@ -1594,7 +1594,7 @@ namespace build2
catch (const system_error& e)
{
fail (ll) << "unable to execute " << c.program << " builtin: "
- << e << endf;
+ << e;
}
}
else
@@ -1603,6 +1603,27 @@ namespace build2
//
cstrings args (process_args ());
+ // Resolve the relative not simple program path against the scope's
+ // working directory. The simple one will be left for the process
+ // path search machinery.
+ //
+ path p;
+
+ try
+ {
+ p = path (args[0]);
+
+ if (p.relative () && !p.simple ())
+ {
+ p = sp.wd_path / p;
+ args[0] = p.string ().c_str ();
+ }
+ }
+ catch (const invalid_path& e)
+ {
+ fail (ll) << "invalid program path " << e.path;
+ }
+
try
{
process_path pp (process::path_search (args[0]));