summaryrefslogtreecommitdiffabout
path: root/tests
authorSergey Poznyakoff <gray@gnu.org>2019-06-03 10:17:13 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-06-03 10:41:34 (GMT)
commitf50a208f9df348cede2ba50b4f435351d8d3f19e (patch) (side-by-side diff)
treec596fdf237b17713ab56c0269cdb1d339e306941 /tests
parent8004bbaa1b31b14dd4c4d3886b5f57b103bf7405 (diff)
downloadpies-f50a208f9df348cede2ba50b4f435351d8d3f19e.tar.gz
pies-f50a208f9df348cede2ba50b4f435351d8d3f19e.tar.bz2
Finish the env re-implementation
* NEWS: Document the "env" statement and the PIES_MASTER_PID environment variable. Version 1.3.91 * configure.ac: Version 1.3.91 * doc/pies.texi: Document the new "env" statement syntax. Provide instructions on how to convert legacy "env" statement to the new form. * lib/envop.c (environ_unset): Take reference value as argument. If supplied, unset the variable only if its value matches the reference one. * lib/envop.h (environ_unset): Change proto. * src/pies.c (parse_legacy_env): Minor changes. (_cb_env_unset): Allow to specify value. * src/progman.c (run_command): Define PIES_MASTER_PID. * tests/env.at: Check the legacy env syntax. * tests/envop.at: Additional checks.
Diffstat (limited to 'tests') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/env.at72
-rw-r--r--tests/envop.at23
2 files changed, 93 insertions, 2 deletions
diff --git a/tests/env.at b/tests/env.at
index 18b0e52..430bf10 100644
--- a/tests/env.at
+++ b/tests/env.at
@@ -17,3 +17,3 @@ component envtest {
action disable;
- exec "piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
+ exec "$abs_top_builddir/src/piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
}
@@ -25,3 +25,3 @@ to 5 \
$abs_top_builddir/src/pies --foreground --stderr \
- --config-file control.conf --config-file envtest.conf 2>errlog
+ --config-file control.conf --config-file envtest.conf --debug 1 2>errlog
cat log
@@ -70 +70,69 @@ USER="user"
m4_popdef([ENVTEST])
+
+# ##############################
+# Legacy syntax
+# ##############################
+
+AT_BANNER([env: legacy syntax])
+
+m4_pushdef([ENVTEST],
+[AT_SETUP([$1])
+AT_KEYWORDS([env $2])
+AT_CHECK([
+PIES_XFAIL_CHECK
+PIES_CONTROL_INIT
+cat > envtest.conf <<_EOT
+component envtest {
+ env $3;
+ command "$abs_builddir/envtest -clone";
+ chdir $PWD;
+ stdout file "$PWD/log";
+ return-code 0 {
+ action disable;
+ exec "$abs_top_builddir/src/piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
+ }
+}
+_EOT
+
+to 5 \
+ envtest -exec \
+ $abs_top_builddir/src/pies --foreground --stderr \
+ --config-file control.conf --config-file envtest.conf --debug 1 2>errlog
+cat log
+],
+[0],
+[$4])
+AT_CLEANUP])
+
+ENVTEST([clear],[clear],[-],[])
+ENVTEST([keep],[keep],[- USER LOGIN],
+[LOGIN="user"
+USER="user"
+])
+
+ENVTEST([set],[set],["FOO=bar" "BAR=bar"],
+[BAR="bar"
+FOO="bar"
+HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PIES_INSTANCE="pies"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([unset],[unset],["-LC_NUMERIC" "-LC_CTYPE" "-LC_MESSAGES"],
+[HOME="/home/user"
+LC_ALL="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PIES_INSTANCE="pies"
+PWD="/home"
+USER="user"
+])
+
+
diff --git a/tests/envop.at b/tests/envop.at
index 6f634fb..2b857f5 100644
--- a/tests/envop.at
+++ b/tests/envop.at
@@ -99,2 +99,25 @@ USER="user"
+ENVTEST([unset with value],[unset],[-unset 'LOGIN=user'],
+[HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
+ENVTEST([unset with value (mismatch)],[unset],[-unset 'LOGIN=another'],
+[HOME="/home/user"
+LC_ALL="C"
+LC_CTYPE="C"
+LC_MESSAGES="C"
+LC_NUMERIC="C"
+LOGIN="user"
+PATH="/usr/local/bin:/usr/bin:/bin"
+PWD="/home"
+USER="user"
+])
+
m4_popdef([ENVTEST])

Return to:

Send suggestions and report system problems to the System administrator.