aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/test/init.cxx')
-rw-r--r--libbuild2/test/init.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/libbuild2/test/init.cxx b/libbuild2/test/init.cxx
index 47a73ba..dadbd20 100644
--- a/libbuild2/test/init.cxx
+++ b/libbuild2/test/init.cxx
@@ -62,6 +62,10 @@ namespace build2
//
vp.insert<string> ("config.test.timeout"),
+ // Test command runner path and options (see the manual for semantics).
+ //
+ vp.insert<strings> ("config.test.runner"),
+
// The test variable is a name which can be a path (with the
// true/false special values) or a target name.
//
@@ -69,6 +73,12 @@ namespace build2
vp.insert<strings> ("test.options"),
vp.insert<strings> ("test.arguments"),
+ // Test command runner path and options extracted from
+ // config.test.runner.
+ //
+ vp.insert<process_path> ("test.runner.path"),
+ vp.insert<strings> ("test.runner.options"),
+
// Prerequisite-specific.
//
// test.stdin and test.stdout can be used to mark a prerequisite as a
@@ -223,6 +233,46 @@ namespace build2
m.operation_timeout = parse_timeout (t, ot);
}
+ // config.test.runner
+ //
+ {
+ value& pv (rs.assign (m.test_runner_path));
+ value& ov (rs.assign (m.test_runner_options));
+
+ if (lookup l = lookup_config (rs, m.config_test_runner))
+ {
+ const strings& args (cast<strings> (l));
+
+ // Extract the runner process path.
+ //
+ {
+ const string& s (args.empty () ? empty_string : args.front ());
+
+ path p;
+ try { p = path (s); } catch (const invalid_path&) {}
+
+ if (p.empty ())
+ fail << "invalid runner path '" << s << "' in "
+ << m.config_test_runner;
+
+ pv = run_search (p, false /* init */);
+ m.runner_path = &pv.as<process_path> ();
+ }
+
+ // Extract the runner options.
+ //
+ {
+ ov = strings (++args.begin (), args.end ());
+ m.runner_options = &ov.as<strings> ();
+ }
+ }
+ else
+ {
+ pv = nullptr;
+ ov = nullptr;
+ }
+ }
+
//@@ TODO: Need ability to specify extra diff options (e.g.,
// --strip-trailing-cr, now hardcoded).
//