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) (unidiff)
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
@@ -15,7 +15,7 @@ component envtest {
15 stdout file "$PWD/log"; 15 stdout file "$PWD/log";
16 return-code 0 { 16 return-code 0 {
17 action disable; 17 action disable;
18 exec "piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown"; 18 exec "$abs_top_builddir/src/piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
19 } 19 }
20} 20}
21_EOT 21_EOT
@@ -23,7 +23,7 @@ _EOT
23to 5 \ 23to 5 \
24 envtest -exec \ 24 envtest -exec \
25 $abs_top_builddir/src/pies --foreground --stderr \ 25 $abs_top_builddir/src/pies --foreground --stderr \
26 --config-file control.conf --config-file envtest.conf 2>errlog 26 --config-file control.conf --config-file envtest.conf --debug 1 2>errlog
27cat log 27cat log
28], 28],
29[0], 29[0],
@@ -68,3 +68,71 @@ USER="user"
68]) 68])
69 69
70m4_popdef([ENVTEST]) 70m4_popdef([ENVTEST])
71
72# ##############################
73# Legacy syntax
74# ##############################
75
76AT_BANNER([env: legacy syntax])
77
78m4_pushdef([ENVTEST],
79[AT_SETUP([$1])
80AT_KEYWORDS([env $2])
81AT_CHECK([
82PIES_XFAIL_CHECK
83PIES_CONTROL_INIT
84cat > envtest.conf <<_EOT
85component envtest {
86 env $3;
87 command "$abs_builddir/envtest -clone";
88 chdir $PWD;
89 stdout file "$PWD/log";
90 return-code 0 {
91 action disable;
92 exec "$abs_top_builddir/src/piesctl --url unix:///$PWD/pies.ctl --no-netrc shutdown";
93 }
94}
95_EOT
96
97to 5 \
98 envtest -exec \
99 $abs_top_builddir/src/pies --foreground --stderr \
100 --config-file control.conf --config-file envtest.conf --debug 1 2>errlog
101cat log
102],
103[0],
104[$4])
105AT_CLEANUP])
106
107ENVTEST([clear],[clear],[-],[])
108ENVTEST([keep],[keep],[- USER LOGIN],
109[LOGIN="user"
110USER="user"
111])
112
113ENVTEST([set],[set],["FOO=bar" "BAR=bar"],
114[BAR="bar"
115FOO="bar"
116HOME="/home/user"
117LC_ALL="C"
118LC_CTYPE="C"
119LC_MESSAGES="C"
120LC_NUMERIC="C"
121LOGIN="user"
122PATH="/usr/local/bin:/usr/bin:/bin"
123PIES_INSTANCE="pies"
124PWD="/home"
125USER="user"
126])
127
128ENVTEST([unset],[unset],["-LC_NUMERIC" "-LC_CTYPE" "-LC_MESSAGES"],
129[HOME="/home/user"
130LC_ALL="C"
131LOGIN="user"
132PATH="/usr/local/bin:/usr/bin:/bin"
133PIES_INSTANCE="pies"
134PWD="/home"
135USER="user"
136])
137
138
diff --git a/tests/envop.at b/tests/envop.at
index 6f634fb..2b857f5 100644
--- a/tests/envop.at
+++ b/tests/envop.at
@@ -97,5 +97,28 @@ PWD="/home"
97USER="user" 97USER="user"
98]) 98])
99 99
100ENVTEST([unset with value],[unset],[-unset 'LOGIN=user'],
101[HOME="/home/user"
102LC_ALL="C"
103LC_CTYPE="C"
104LC_MESSAGES="C"
105LC_NUMERIC="C"
106PATH="/usr/local/bin:/usr/bin:/bin"
107PWD="/home"
108USER="user"
109])
110
111ENVTEST([unset with value (mismatch)],[unset],[-unset 'LOGIN=another'],
112[HOME="/home/user"
113LC_ALL="C"
114LC_CTYPE="C"
115LC_MESSAGES="C"
116LC_NUMERIC="C"
117LOGIN="user"
118PATH="/usr/local/bin:/usr/bin:/bin"
119PWD="/home"
120USER="user"
121])
122
100m4_popdef([ENVTEST]) 123m4_popdef([ENVTEST])
101 124

Return to:

Send suggestions and report system problems to the System administrator.