From fb34688841668e6e4c939395c8387feabe8ddfdf Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Nov 2020 22:42:40 +0300 Subject: Add support for config.test.runner --- libbuild2/test/init.cxx | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'libbuild2/test/init.cxx') 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 ("config.test.timeout"), + // Test command runner path and options (see the manual for semantics). + // + vp.insert ("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 ("test.options"), vp.insert ("test.arguments"), + // Test command runner path and options extracted from + // config.test.runner. + // + vp.insert ("test.runner.path"), + vp.insert ("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 (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 (); + } + + // Extract the runner options. + // + { + ov = strings (++args.begin (), args.end ()); + m.runner_options = &ov.as (); + } + } + else + { + pv = nullptr; + ov = nullptr; + } + } + //@@ TODO: Need ability to specify extra diff options (e.g., // --strip-trailing-cr, now hardcoded). // -- cgit v1.1