diff options
Diffstat (limited to 'tests/envglobal.at')
-rw-r--r-- | tests/envglobal.at | 86 |
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/>. | ||
16 | dnl ENVTEST(NAME,KW,ENV,OUT) | ||
17 | m4_pushdef([ENVTEST], | ||
18 | [AT_SETUP([$1]) | ||
19 | AT_KEYWORDS([env $2]) | ||
20 | AT_CHECK([ | ||
21 | PIES_XFAIL_CHECK | ||
22 | PIES_CONTROL_INIT | ||
23 | cat > envtest.conf <<_EOT | ||
24 | env { | ||
25 | $3 | ||
26 | } | ||
27 | component 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 | |||
38 | to 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 | ||
42 | cat log | ||
43 | ], | ||
44 | [0], | ||
45 | [$4]) | ||
46 | AT_CLEANUP]) | ||
47 | |||
48 | dnl ############################# | ||
49 | dnl Start tests | ||
50 | dnl ############################# | ||
51 | |||
52 | AT_BANNER([Global environment statement]) | ||
53 | |||
54 | ENVTEST([clear],[clear],[clear;],[]) | ||
55 | |||
56 | ENVTEST([keep],[keep],[keep "LC_*";], | ||
57 | [LC_ALL="C" | ||
58 | LC_CTYPE="C" | ||
59 | LC_MESSAGES="C" | ||
60 | LC_NUMERIC="C" | ||
61 | ]) | ||
62 | |||
63 | ENVTEST([set],[set],[set "FOO=bar";], | ||
64 | [FOO="bar" | ||
65 | HOME="/home/user" | ||
66 | LC_ALL="C" | ||
67 | LC_CTYPE="C" | ||
68 | LC_MESSAGES="C" | ||
69 | LC_NUMERIC="C" | ||
70 | LOGIN="user" | ||
71 | PATH="/usr/local/bin:/usr/bin:/bin" | ||
72 | PIES_INSTANCE="pies" | ||
73 | PWD="/home" | ||
74 | USER="user" | ||
75 | ]) | ||
76 | |||
77 | ENVTEST([unset],[unset],[unset "LC_*"; unset PWD;], | ||
78 | [HOME="/home/user" | ||
79 | LOGIN="user" | ||
80 | PATH="/usr/local/bin:/usr/bin:/bin" | ||
81 | PIES_INSTANCE="pies" | ||
82 | USER="user" | ||
83 | ]) | ||
84 | |||
85 | m4_popdef([ENVTEST]) | ||
86 | |||