Blame tests/envvar-check

Packit 709fb3
# -*- sh -*-
Packit 709fb3
# Check environment variables for sane values while testing.
Packit 709fb3
Packit 709fb3
# Copyright (C) 2000-2017 Free Software Foundation, Inc.
Packit 709fb3
Packit 709fb3
# This program is free software: you can redistribute it and/or modify
Packit 709fb3
# it under the terms of the GNU General Public License as published by
Packit 709fb3
# the Free Software Foundation, either version 3 of the License, or
Packit 709fb3
# (at your option) any later version.
Packit 709fb3
Packit 709fb3
# This program is distributed in the hope that it will be useful,
Packit 709fb3
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 709fb3
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 709fb3
# GNU General Public License for more details.
Packit 709fb3
Packit 709fb3
# You should have received a copy of the GNU General Public License
Packit 709fb3
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 709fb3
Packit 709fb3
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
Packit 709fb3
  as_unset=unset
Packit 709fb3
else
Packit 709fb3
  as_unset=false
Packit 709fb3
fi
Packit 709fb3
Packit 709fb3
envvar_check_fail=0
Packit 709fb3
vars='
Packit 709fb3
  _POSIX2_VERSION
Packit 709fb3
  _STDBUF_E
Packit 709fb3
  _STDBUF_I
Packit 709fb3
  _STDBUF_O
Packit 709fb3
  BASH_ENV
Packit 709fb3
  BLOCKSIZE
Packit 709fb3
  BLOCK_SIZE
Packit 709fb3
  CDPATH
Packit 709fb3
  COLUMNS
Packit 709fb3
  DF_BLOCK_SIZE
Packit 709fb3
  DU_BLOCK_SIZE
Packit 709fb3
  ENV
Packit 709fb3
  LANGUAGE
Packit 709fb3
  LS_BLOCK_SIZE
Packit 709fb3
  LS_COLORS
Packit 709fb3
  OMP_NUM_THREADS
Packit 709fb3
  POSIXLY_CORRECT
Packit 709fb3
  QUOTING_STYLE
Packit 709fb3
  SIMPLE_BACKUP_SUFFIX
Packit 709fb3
  TABSIZE
Packit 709fb3
  TERM
Packit 709fb3
  COLORTERM
Packit 709fb3
  TIME_STYLE
Packit 709fb3
  TMPDIR
Packit 709fb3
  VERSION_CONTROL
Packit 709fb3
'
Packit 709fb3
for var in $vars
Packit 709fb3
do
Packit 709fb3
  $as_unset $var
Packit 709fb3
  if eval test \"\${$var+set}\" = set; then
Packit 709fb3
    echo "$0: the $var environment variable is set --" \
Packit 709fb3
      ' unset it and rerun this test' >&2
Packit 709fb3
    envvar_check_fail=1
Packit 709fb3
  fi
Packit 709fb3
done
Packit 709fb3
Packit 709fb3
test "$envvar_check_fail" = 1 && exit 1