aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-21 17:07:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:34 +0200
commitd9b26553b67e87dd45b652dd91eaac782fdf91f9 (patch)
treea42f2e8d4d6bf2e6232861b57d262d2cf8cc0a33 /build2/test/script/parser.cxx
parenta36a5042a35ddf5e8e32dd351168d9e71cd761f2 (diff)
Add support for testscript scope id, working directory
Diffstat (limited to 'build2/test/script/parser.cxx')
-rw-r--r--build2/test/script/parser.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 756761f..a3860c4 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -79,6 +79,7 @@ namespace build2
if (tt == type::eos)
break;
+ const location ll (get_location (t));
line_type lt (pre_parse_script_line (t, tt));
assert (tt == type::newline);
@@ -98,11 +99,11 @@ namespace build2
}
case line_type::test:
{
- // Create implicit test scope.
+ // Create implicit test scope. Use line number as the scope id.
//
group_->scopes.push_back (
unique_ptr<test> (
- (test_ = new test (*group_))));
+ (test_ = new test (to_string (ll.line), *group_))));
ls = &test_->tests;
@@ -740,7 +741,7 @@ namespace build2
// Now that we have all the pieces, run the command.
//
if (!pre_parse_)
- runner_->run (c, li, ll);
+ runner_->run (*scope_, c, li, ll);
}
command_exit parser::
@@ -847,7 +848,8 @@ namespace build2
if (!qual.empty ())
fail (loc) << "qualified variable name";
- // @@ MT: will need RW mutex on var_pool.
+ // @@ MT: will need RW mutex on var_pool. Or maybe if it's not there
+ // then it can't possibly be found? Still will be setting variables.
//
if (name != "*" && !digits (name))
return scope_->find (script_->var_pool.insert (move (name)));
@@ -861,6 +863,10 @@ namespace build2
// we don't know which $NN vars will be looked up from inside.
// Could we collect all the variable names during the pre-parse
// stage? They could be computed.
+ //
+ // Or we could set all the non-NULL $NN (i.e., based on the number
+ // of elements in $*).
+ //
// In both cases first thing we do is lookup $*. It should always be
// defined since we set it on the script's root scope.