From 1a46a0a1c3b0b463e13c46550998a3df1db0fdbe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 9 Jan 2017 15:40:05 +0200 Subject: Implement test.target variable The plan is to use it for the portable path conversions. --- build2/test/init.cxx | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'build2/test/init.cxx') diff --git a/build2/test/init.cxx b/build2/test/init.cxx index af83aea..f592568 100644 --- a/build2/test/init.cxx +++ b/build2/test/init.cxx @@ -37,25 +37,38 @@ namespace build2 // Enter module variables. Do it during boot in case they get assigned // in bootstrap.build. // + auto& vp (var_pool); + + // Note: none are overridable. + // + // The test variable is a name which can be a path (with the + // true/false special values) or a target name. + // + vp.insert ("test", variable_visibility::target); + vp.insert ("test.input", variable_visibility::project); + vp.insert ("test.output", variable_visibility::project); + vp.insert ("test.roundtrip", variable_visibility::project); + vp.insert ("test.options", variable_visibility::project); + vp.insert ("test.arguments", variable_visibility::project); + + // These are only used in testscript. + // + vp.insert ("test.redirects", variable_visibility::project); + vp.insert ("test.cleanups", variable_visibility::project); + + // Test target platform. + // + // Unless already set, default test.target to build.host. Note that it + // can still be overriden by the user, e.g., in root.build. + // { - auto& v (var_pool); + value& v ( + rs.assign ( + vp.insert ( + "test.target", variable_visibility::project))); - // Note: none are overridable. - // - // The test variable is a name which can be a path (with the - // true/false special values) or a target name. - // - v.insert ("test", variable_visibility::target); - v.insert ("test.input", variable_visibility::project); - v.insert ("test.output", variable_visibility::project); - v.insert ("test.roundtrip", variable_visibility::project); - v.insert ("test.options", variable_visibility::project); - v.insert ("test.arguments", variable_visibility::project); - - // These are only used in testscript. - // - v.insert ("test.redirects", variable_visibility::project); - v.insert ("test.cleanups", variable_visibility::project); + if (!v || v.empty ()) + v = cast ((*global_scope)["build.host"]); } } -- cgit v1.1