aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test/init.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-11-30 22:42:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-08 14:26:22 +0300
commitfb34688841668e6e4c939395c8387feabe8ddfdf (patch)
tree5e0da2e74cee981337f9cd19d148e9824d7d3c36 /libbuild2/test/init.cxx
parent121a075bc2558003990377843393ca27d784f50f (diff)
Add support for config.test.runner
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).
//