Hash :
5ac7081c
Author :
Date :
2011-06-13T14:48:57
tests: autogenerate list of wrapped tests for `lib/' shell scripts * tests/gen-config-shell-tests: New script, generates distributed makefile snippet `tests/config-shell-tests.am' to list all tests that use the `get_shell_script' function, with names mangled to use suffix `-w.shtst', in ... * tests/Makefile.am (config_shell_tests): ... this macro, whose definition has been consequently removed from Makefile.am. (EXTRA_DIST): Distribute the new script. ($(srcdir)/config-shell-tests.am): Generate using the new script. (include): Include the `config-shell-tests.am' fragment. * bootstrap: Invoke `tests/gen-config-shell-tests' to generate `tests/config-shell-tests.am'. * tests/.gitignore: Ignore `config-shell-tests.am'. * tests/gen-parallel-tests: Fixlet in heading comments.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#! /bin/sh
# Generate config-shell-tests.am.
#
# 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/>.
#
# For each test in the $(handwritten_tests) list in this Makefile.am file,
# that directly tests features of an automake-provided shell script from
# the `lib/' subdirectory, define a sibling test that does likewise, but
# using, to run said script, the configure-time $SHELL instead of the
# default system shell /bin/sh.
#
# A test is considered a candidate for sibling-generation if it calls the
# `get_shell_script' function anywhere.
#
# Individual tests can prevent the creation of such a sibling by explicitly
# setting the `$test_prefer_config_shell' variable to either "yes" or "no".
# The rationale for this is that if the variable is set to "yes", the test
# already uses $SHELL, so that a sibling would be just a duplicate; while
# if the variable is set to "no", the test doesn't support, or is not meant
# to use, $SHELL to run the script under testing, and forcing it to do so
# in the sibling would likely cause a spurious failure.
#
set -e
tests=`sed -n '/^handwritten_tests =/,/^$/s/\(.*\.test\).*/\1/p' Makefile.am`
if test -z "$tests"; then
echo "$0: failed to obtain list of tests" >&2
exit 1
fi
{
grep -l '^get_shell_script ' $tests
grep -l ' get_shell_script ' $tests
} |
LC_ALL=C sort -u |
while read tst; do
grep "test_prefer_config_shell=" $tst >/dev/null || echo $tst
done |
sed -e 's/\.test$//' |
{
echo "## Generated by gen-config-shell-tests."
echo "## Edit Makefile.am instead of this."
echo "config_shell_tests ="
# Since `foo-w.shtst' sources `foo.test', `foo-p.log' also depends on
# `foo.test'.
sed -e '
h
s/^/config_shell_tests += /
s/$/-w.shtst/
p
x
s/.*/&-w.log: &.test/
'
}