test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / conffile-leading-dot.sh
1 #! /bin/sh
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Automake must complain if AC_CONFIG_FILES is passed something starting
18 # with a dot (like "./Makefile"), since the remake rules might be subtly
19 # broken in that case.
20
21 required=GNUmake
22 . test-init.sh
23
24 cat > configure.ac << END
25 AC_INIT([$me], [1.0])
26 AM_INIT_AUTOMAKE
27 AC_CONFIG_FILES([./Makefile])
28 AC_CONFIG_FILES([./foo:a.in:b.in:c.in])
29 AC_OUTPUT
30 END
31
32 touch a.in b.in c.in Makefile.am
33
34 $ACLOCAL
35
36 AUTOMAKE_fails -Wnone -Wunsupported
37 grep "^configure\.ac:3:.*'\\./Makefile'" stderr
38 grep "^configure\.ac:3:.* omit leading '\\./'" stderr
39 grep "^configure\.ac:3:.*remake rules might be subtly broken" stderr
40 grep "^configure\.ac:4:.*'\\./foo'" stderr
41 grep "^configure\.ac:4:.* omit leading '\\./'" stderr
42 grep "^configure\.ac:4:.*remake rules might be subtly broken" stderr
43
44 # Check that our warning was actually justified.
45 sed 's/^AM_INIT_AUTOMAKE/&([-Wall -Wno-unsupported])/' <configure.ac >t
46 mv -f t configure.ac
47 rm -rf autom4te*.cache
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE -Wall -Wno-unsupported
51 ./configure
52 $MAKE
53 $sleep
54 touch Makefile.am
55 # Check that remake rules do truly break -- otherwise automake is
56 # giving a bogus warning.
57 run_make -e FAIL -E
58 grep "config\\.status:.*invalid argument.*Makefile" stderr
59
60 :