Blame tests/envvar-check

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