From f4453f3dacef727cfd0fb8f17c47ac3eea367a34 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 15 Dec 2016 12:17:44 +0200 Subject: Implement test.redirects, test.cleanups --- build2/test/script/script.cxx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'build2/test/script/script.cxx') diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx index f1e1bd4..7abc3b6 100644 --- a/build2/test/script/script.cxx +++ b/build2/test/script/script.cxx @@ -393,9 +393,11 @@ namespace build2 : // Enter the test* variables with the same variable types as in // buildfiles. // - test_var (var_pool.insert ("test")), - opts_var (var_pool.insert ("test.options")), - args_var (var_pool.insert ("test.arguments")), + test_var (var_pool.insert ("test")), + options_var (var_pool.insert ("test.options")), + arguments_var (var_pool.insert ("test.arguments")), + redirects_var (var_pool.insert ("test.redirects")), + cleanups_var (var_pool.insert ("test.cleanups")), wd_var (var_pool.insert ("~")), id_var (var_pool.insert ("@")), @@ -441,6 +443,8 @@ namespace build2 // Unless we have the test variable set on the test or script target, // set it at the script level to the test target's path. // + // Note that test variable's visibility is target. + // if (!find (test_var)) { value& v (assign (test_var)); @@ -553,10 +557,20 @@ namespace build2 if (lookup l = find (root->test_var)) s.push_back (cast (l).representation ()); - if (lookup l = find (root->opts_var)) + if (lookup l = find (root->options_var)) + append (cast (l)); + + if (lookup l = find (root->arguments_var)) + append (cast (l)); + + // Keep redirects/cleanups out of $N. + // + size_t n (s.size ()); + + if (lookup l = find (root->redirects_var)) append (cast (l)); - if (lookup l = find (root->args_var)) + if (lookup l = find (root->cleanups_var)) append (cast (l)); // Set the $N values if present. @@ -565,7 +579,7 @@ namespace build2 { value& v (assign (*root->cmdN_var[i])); - if (i < s.size ()) + if (i < n) { if (i == 0) v = path (s[i]); -- cgit v1.1