summaryrefslogtreecommitdiff
path: root/tests/thelp.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/thelp.pl')
-rwxr-xr-xtests/thelp.pl13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/thelp.pl b/tests/thelp.pl
index 8d29e5c3..c95b54ae 100755
--- a/tests/thelp.pl
+++ b/tests/thelp.pl
@@ -10,6 +10,7 @@
# It supports the following operators:
# out <word> : echo <word> to stdout with a newline
# raw <word> : echo <word> to stdout without adding anything
+# env <word> : echo the value of the env.var. <word>, or "<unset>"
# file <word> : echo <word> to stdout AND create the file <word>
# dir <word> : echo <word> to stdout AND create the directory <word>
# rm <word> : echo <word> to stdout AND delete the file/directory <word>
@@ -19,7 +20,7 @@
# term <pid> : send SIGTERM to PID <pid>
# fail <err> : echo <err> to stdout then exit with error code err
#
-# If given -q only the "out" command generates output.
+# If given -q only the "out", "raw", and "env" commands generate output.
# Force flush
$| = 1;
@@ -41,6 +42,16 @@ sub op {
return 1;
}
+ if ($op eq 'env') {
+ print "$nm=" unless $quiet;
+ if (exists $ENV{$nm}) {
+ print "$ENV{$nm}\n";
+ } else {
+ print "<unset>\n";
+ }
+ return 1;
+ }
+
# Show the output before creating the file
if ($op eq 'file') {
print "file $nm\n" unless $quiet;