aboutsummaryrefslogtreecommitdiff
path: root/tests/envglobal.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/envglobal.at')
-rw-r--r--tests/envglobal.at86
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/envglobal.at b/tests/envglobal.at
new file mode 100644
index 0000000..9b89ce2
--- /dev/null
+++ b/tests/envglobal.at
@@ -0,0 +1,86 @@
1# This file is part of GNU pies testsuite. -*- autotest -*-
2# Copyright (C) 2020-2023 Sergey Poznyakoff
3#
4# GNU pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# GNU pies is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GNU pies. If not, see <http://www.gnu.org/licenses/>.
16dnl ENVTEST(NAME,KW,ENV,OUT)
17m4_pushdef([ENVTEST],
18[AT_SETUP([$1])
19AT_KEYWORDS([env $2])
20AT_CHECK([
21PIES_XFAIL_CHECK
22PIES_CONTROL_INIT
23cat > envtest.conf <<_EOT
24env {
25 $3
26}
27component envtest {
28 command "$abs_builddir/envtest -clone";
29 chdir $PWD;
30 stdout file "$PWD/log";
31 return-code 0 {
32 action disable;
33 exec "$abs_top_builddir/src/piesctl --url unix:///$PWD/pies.ctl --config-file=/dev/null --no-netrc shutdown";
34 }
35}
36_EOT
37
38to 5 \
39 envtest -exec \
40 $abs_top_builddir/src/pies --no-preprocessor --foreground --stderr \
41 --config-file control.conf --config-file envtest.conf --debug 1 2>errlog
42cat log
43],
44[0],
45[$4])
46AT_CLEANUP])
47
48dnl #############################
49dnl Start tests
50dnl #############################
51
52AT_BANNER([Global environment statement])
53
54ENVTEST([clear],[clear],[clear;],[])
55
56ENVTEST([keep],[keep],[keep "LC_*";],
57[LC_ALL="C"
58LC_CTYPE="C"
59LC_MESSAGES="C"
60LC_NUMERIC="C"
61])
62
63ENVTEST([set],[set],[set "FOO=bar";],
64[FOO="bar"
65HOME="/home/user"
66LC_ALL="C"
67LC_CTYPE="C"
68LC_MESSAGES="C"
69LC_NUMERIC="C"
70LOGIN="user"
71PATH="/usr/local/bin:/usr/bin:/bin"
72PIES_INSTANCE="pies"
73PWD="/home"
74USER="user"
75])
76
77ENVTEST([unset],[unset],[unset "LC_*"; unset PWD;],
78[HOME="/home/user"
79LOGIN="user"
80PATH="/usr/local/bin:/usr/bin:/bin"
81PIES_INSTANCE="pies"
82USER="user"
83])
84
85m4_popdef([ENVTEST])
86

Return to:

Send suggestions and report system problems to the System administrator.