From 728b075cb5e0df9c386f8377e0f6961e5ccc5143 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 16 Jun 2020 17:08:39 +0300 Subject: Add env script pseudo-builtin Also disable C++ recipe tests when cross-testing. --- doc/testscript.cli | 30 ++- libbuild2/build/script/parser+diag.test.testscript | 36 +++ libbuild2/build/script/parser.cxx | 6 +- libbuild2/build/script/parser.hxx | 9 +- libbuild2/script/parser.cxx | 162 ++++++++++++- libbuild2/script/parser.hxx | 14 +- libbuild2/script/run.cxx | 11 +- libbuild2/script/script.cxx | 130 +++++++++- libbuild2/script/script.hxx | 8 +- libbuild2/test/script/parser+env.test.testscript | 77 ++++++ tests/build/root.build | 1 - tests/recipe/cxx/testscript | 269 +++++++++++---------- tests/test/script/runner/driver.cxx | 25 +- tests/test/script/runner/env.testscript | 7 + 14 files changed, 618 insertions(+), 167 deletions(-) create mode 100644 libbuild2/test/script/parser+env.test.testscript create mode 100644 tests/test/script/runner/env.testscript diff --git a/doc/testscript.cli b/doc/testscript.cli index c0f0d4e..49725df 100644 --- a/doc/testscript.cli +++ b/doc/testscript.cli @@ -2426,6 +2426,34 @@ Write strings to \c{stdout} separating them with a single space and ending with a newline. +\h#builtins-env|\c{env}| + +\ +env [-u ]... [-] [=]... -- +\ + +Run a command adding/removing the variables to/from the environment. + +Note that \c{env} is a \i{pseudo-builtin}. In particular, its name and the +\c{--} separator must be specified \i{literally} on the command line. +Specifically, they must not be the result of an expansion. Also note that the +\c{--} separator must always be present. + +To avoid ambiguity, the variable assignments can be separated from the options +with the explicit \c{-} separator. In the example below the \c{--unset} +variable is added to the environment: + +\ +env - --unset=FOO -- $* +\ + +\dl| + +\li|\n\c{-u|--unset } + + Remove the specified variable from the environment.|| + + \h#builtins-exit|\c{exit}| \ @@ -2643,7 +2671,7 @@ is ECMAScript (more specifically, ECMA-262-based C++11 regular expressions). Edit \i{file} in place.| -\li|\n\c{-e|--expression