Hash :
7df1a9bd
Author :
Date :
2011-06-06T16:12:59
tests: `lib/' shell scripts transparently tested also with $SHELL With the previous commit, the user could prefer the use of $SHELL over /bin/sh in some tests checking the Automake-provided shell scripts by manually exporting `test_prefer_config_shell' to "yes" in the environment. With this commit, we ensure that such tests *always* and *transparently* run using both $SHELL and /bin/sh to execute the checked scripts. The `test_prefer_config_shell' variable becomes an internal detail, and is no more meant to be manually defined or overridden. * tests/defs-static.in: Check that `test_prefer_config_shell' is not exported in the environment. Error out if this is the case. * tests/config-shell-tests.sh: New file, driver script to run checks on the shell scripts in `lib/' using the $SHELL determined at configure time instead of the default system shell /bin/sh. * Makefile.am (TESTS_EXTENSIONS): Add `.shtst'. (SHTST_LOG_COMPILER): Define, it calls `config-shell-tests.sh'. (config_shell_tests): Define to a list of tests that wraps other `*.test' tests using `config-shell-tests.sh'. ($(config_shell_tests)): Dummy dependency declaration required in order to have make actually produce expected log files from the `.shtst.log' suffix rule. (EXTRA_DIST): Distribute `config-shell-tests.sh'. (TESTS): Add `$(config_shell_tests)'. * tests/self-check-env-sanitize.test: Update, by checking that `test_prefer_config_shell' isn't exported in the environment.
#! /bin/sh
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Sanity check for the automake testsuite.
# Make sure that the testsuite initialization code complains when
# some testsuite-influential variables are set in the environment.
. ./defs-static || exit 1
set -x
exec 5>&1
for var in me parallel_tests required original_AUTOMAKE original_ACLOCAL \
test_prefer_config_shell
do
env "$var=foo" $SHELL -c '. ./defs' foo.test && exit 1
env "$var=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
| grep "foo\.test:.* variable \`$var'.* in the environment.*unsafe" || exit 1
done
: