version 8.15
[coreutils.git] / tests / envvar-check
blob62fb512c054487df9135a111077a2d5d2b0daabf
1 # -*- sh -*-
2 # Check environment variables for sane values while testing.
4 # Copyright (C) 2000-2001, 2003-2004, 2006-2012 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
20   as_unset=unset
21 else
22   as_unset=false
25 envvar_check_fail=0
26 vars='
27   _POSIX2_VERSION
28   _STDBUF_E
29   _STDBUF_I
30   _STDBUF_O
31   BLOCKSIZE
32   BLOCK_SIZE
33   CDPATH
34   COLUMNS
35   DF_BLOCK_SIZE
36   DU_BLOCK_SIZE
37   LANGUAGE
38   LS_BLOCK_SIZE
39   LS_COLORS
40   OMP_NUM_THREADS
41   POSIXLY_CORRECT
42   QUOTING_STYLE
43   SIMPLE_BACKUP_SUFFIX
44   TABSIZE
45   TERM
46   TIME_STYLE
47   TMPDIR
48   VERSION_CONTROL
50 for var in $vars
52   $as_unset $var
53   if eval test \"\${$var+set}\" = set; then
54     echo "$0: the $var environment variable is set --" \
55       ' unset it and rerun this test' >&2
56     envvar_check_fail=1
57   fi
58 done
60 test "$envvar_check_fail" = 1 && exit 1