test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / test-extensions.sh
blob5d6badda63b932bb640d7f44f284486998e329ea
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Make sure that Automake diagnose invalid entries in TEST_EXTENSIONS,
18 # and do not diagnose valid (albeit more unusual) ones.
19 # See automake bug#9400.
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 AC_OUTPUT
25 END
27 $ACLOCAL
28 $AUTOCONF
30 valid_extensions='sh T t1 _foo BAR x_Y_z _'
32 echo TESTS = > Makefile.am
33 echo " $valid_extensions" \
34 | sed -e 's/ / ./g' -e 's/^/TEST_EXTENSIONS =/' >> Makefile.am
35 cat Makefile.am # For debugging.
37 $AUTOMAKE -a
39 grep -i 'log' Makefile.in # For debugging.
41 for lc in $valid_extensions; do
42 uc=$(echo $lc | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ)
43 $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in
44 grep "^${uc}_LOG_COMPILE =" Makefile.in
45 grep "^\.${lc}\.log:" Makefile.in
46 done
48 # The produced Makefile is not broken.
49 ./configure
50 $MAKE all check
52 cat > Makefile.am << 'END'
53 TESTS = foo.test bar.sh
54 TEST_EXTENSIONS = .test mu .x-y a-b .t.1 .sh .6c .0 .11 .= @suf@ .@ext@
55 TEST_EXTENSIONS += .= .t33 .a@b _&_
56 END
58 AUTOMAKE_fails
59 for suf in mu .x-y a-b .t.1 .6c .0 .11 @suf@ .@ext@ '.=' '_&_'; do
60 suf2=$(printf '%s\n' "$suf" | sed -e 's/\./\\./')
61 $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr
62 done
64 # Verify that we accept valid suffixes, even if intermixed with
65 # invalid ones.
66 $EGREP '\.(sh|test|t33)' stderr && exit 1
68 # Verify that we don't try to handle invalid suffixes.
69 $EGREP '(LOG_COMPILER|non-POSIX var|bad character)' stderr && exit 1