aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-08 22:40:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-11 18:58:13 +0300
commitcb558e4bd2b817bc72275c2bbd90dfe9fe380af9 (patch)
tree83bb92e3dc8a7744b30a9c9cfd12106780f24691 /libbuild2/test
parentff0bf71889b041be794e8bd47d5be57f6eb07ad1 (diff)
Add export script pseudo-builtin
Diffstat (limited to 'libbuild2/test')
-rw-r--r--libbuild2/test/script/parser+env.test.testscript2
-rw-r--r--libbuild2/test/script/script.cxx8
-rw-r--r--libbuild2/test/script/script.hxx7
3 files changed, 16 insertions, 1 deletions
diff --git a/libbuild2/test/script/parser+env.test.testscript b/libbuild2/test/script/parser+env.test.testscript
index b6fb305..efa5dec 100644
--- a/libbuild2/test/script/parser+env.test.testscript
+++ b/libbuild2/test/script/parser+env.test.testscript
@@ -31,7 +31,7 @@
: invalid-val
:
$* <'env --unset=a=b -- cmd' 2>>EOE != 0
- testscript:1:5: error: env: invalid value 'a=b' for option '--unset': contains '='
+ testscript:1:5: error: env: invalid value 'a=b' for option --unset: contains '='
EOE
: no-sep
diff --git a/libbuild2/test/script/script.cxx b/libbuild2/test/script/script.cxx
index 165b9b7..3a8ceac 100644
--- a/libbuild2/test/script/script.cxx
+++ b/libbuild2/test/script/script.cxx
@@ -173,6 +173,14 @@ namespace build2
reset_special ();
}
+ const environment_vars& scope::
+ exported_variables (environment_vars& storage)
+ {
+ return parent != nullptr
+ ? parent->merge_exported_variables (exported_vars, storage)
+ : exported_vars;
+ }
+
// script_base
//
script_base::
diff --git a/libbuild2/test/script/script.hxx b/libbuild2/test/script/script.hxx
index ea1f579..7dae78c 100644
--- a/libbuild2/test/script/script.hxx
+++ b/libbuild2/test/script/script.hxx
@@ -30,6 +30,7 @@ namespace build2
using build2::script::command_expr;
using build2::script::expr_term;
using build2::script::command;
+ using build2::script::environment_vars;
using build2::script::deadline;
using build2::script::timeout;
@@ -110,6 +111,12 @@ namespace build2
const string& attrs,
const location&) override;
+ // Merge the command execution environment variable (un)sets from this
+ // and outer scopes.
+ //
+ virtual const environment_vars&
+ exported_variables (environment_vars& storage) override;
+
// Noop since the temporary directory is a working directory and so
// is created before the scope commands execution.
//