aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test/script/runner.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-09 19:51:43 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-11 14:31:39 +0300
commitff0bf71889b041be794e8bd47d5be57f6eb07ad1 (patch)
tree2964d1c0803003a896447bdc4181339deaddbe1a /libbuild2/test/script/runner.cxx
parent26af9268e98ed4c82c83b8f6e3f94af71b109eba (diff)
Copy parent scope's test program list in runner's entry() function rather than in scope's constructor
Diffstat (limited to 'libbuild2/test/script/runner.cxx')
-rw-r--r--libbuild2/test/script/runner.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbuild2/test/script/runner.cxx b/libbuild2/test/script/runner.cxx
index eb30e02..af5f30a 100644
--- a/libbuild2/test/script/runner.cxx
+++ b/libbuild2/test/script/runner.cxx
@@ -41,6 +41,18 @@ namespace build2
dr << info << "test id: " << sp.id_path.posix_string ();
});
+ // Note that we could probably keep the test programs sets fully
+ // independent across the scopes and check if the program is a test by
+ // traversing the scopes upwards recursively. Note though, that the
+ // parent scope's set cannot change during the nested scope execution
+ // and normally contains just a single entry. Thus, it seems more
+ // efficient to get rid of the recursion by copying the set from the
+ // parent now and potentially changing it later on the test variable
+ // assignment, etc.
+ //
+ if (sp.parent != nullptr)
+ sp.test_programs = sp.parent->test_programs;
+
// Scope working directory shall be empty (the script working
// directory is cleaned up by the test rule prior the script
// execution).