diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | doc/dejagnu.texi | 21 | ||||
-rw-r--r-- | lib/utils.exp | 8 | ||||
-rw-r--r-- | testsuite/runtest.all/utils.test | 13 |
5 files changed, 54 insertions, 6 deletions
@@ -1,3 +1,17 @@ +2017-08-29 Ben Elliston <bje@gnu.org> + + Revert these changes: + + 2016-04-25 Ben Elliston <bje@gnu.org> + + * testsuite/runtest.all/utils.test: Remove unsetenv test. + + 2016-04-24 Ben Elliston <bje@gnu.org> + + * lib/utils.exp (unsetenv): Remove proc. + * doc/dejagnu.texi: Update documentation. + * NEWS: Update. + 2017-08-19 Ben Elliston <bje@gnu.org> * lib/framework.exp (xml_tag): Escape all of the non-printable @@ -2,10 +2,6 @@ Changes since 1.6: -1. The user-visible utility procedure `unsetenv' has been removed. If - a testsuite uses any of these procedures, a copy of the procedure - should be made and placed in the lib directory of the testsuite. - Changes since 1.5.3: 1. Proper support for target communication via SSH has been added. diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index 5231593..a63f5b4 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -4530,6 +4530,7 @@ tool, and its version number. * runtest_file_p Procedure: runtest_file_p procedure * diff Procedure: diff procedure * setenv Procedure: setenv procedure +* unsetenv Procedure: unsetenv procedure * getenv Procedure: getenv procedure * prune_system_crud Procedure: prune_system_crud procedure @end menu @@ -4689,7 +4690,7 @@ The first file to compare. The second file to compare. @end table -@node setenv procedure, getenv procedure, diff procedure, Utility Procedures +@node setenv procedure, unsetenv procedure, diff procedure, Utility Procedures @subsubsection setenv Procedure Sets the environment variable @emph{var} to the value @emph{val}. @@ -4708,7 +4709,23 @@ The environment variable to set. The value to set the variable to. @end table -@node getenv procedure, prune_system_crud procedure, setenv procedure, Utility Procedures +@node unsetenv procedure, getenv procedure, setenv procedure, Utility Procedures +@subsubsection unsetenv Procedure + +Unsets the environment variable +@emph{var}. + +@quotation +@t{@b{unsetenv}@{@i{var}@}} +@end quotation + +@table @asis + +@item @code{var} +The environment variable to unset. +@end table + +@node getenv procedure, prune_system_crud procedure, unsetenv procedure, Utility Procedures @subsubsection getenv Procedure Returns the value of @emph{var} in the environment if it exists, diff --git a/lib/utils.exp b/lib/utils.exp index 056157a..eca82d9 100644 --- a/lib/utils.exp +++ b/lib/utils.exp @@ -339,6 +339,14 @@ proc setenv { var val } { set env($var) $val } +# Unset an environment variable +# +proc unsetenv { var } { + global env + unset env($var) +} + + # Get a value from an environment variable # proc getenv { var } { diff --git a/testsuite/runtest.all/utils.test b/testsuite/runtest.all/utils.test index 201280f..de8c809 100644 --- a/testsuite/runtest.all/utils.test +++ b/testsuite/runtest.all/utils.test @@ -88,6 +88,19 @@ if [info exists env(TESTRUN)] { untested "getenv, get an environment variable" } +# Test unsetenv: +# +if [info exists env(TESTRUN)] { + unsetenv TESTRUN + if [info exists env(TESTRUN)] { + fail "unsetenv, unset an environment variable" + } else { + pass "unsetenv, unset an environment variable" + } +} else { + untested "unsetenv, unset an environment variable" +} + # Test 'which' using a relative path. # if {[which ./config.status] != 0} { |