tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / remake11.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 # Test remake rules in deeply nested subdirectories, and with a lot
18 # of files.  This is basically a mild stress test, ensuring that rebuild
19 # rules don't break in obvious ways in a slightly "heavier than usual"
20 # setup.
21
22 . ./defs || Exit 1
23
24 ocwd=`pwd` || Exit 1
25
26 magic1=::MagicStringOne::
27 magic2=__MagicStringTwo__
28
29 echo "AC_SUBST([FOO], [$magic1])" >> configure.ac
30
31 echo "@FOO@" > bar.in
32 echo "AC_CONFIG_FILES([bar])" >> configure.ac
33 for i in 0 1 2 3 4 5 6 7 8 9; do
34   d=${d+"$d/"}sub$i
35   echo "SUBDIRS = sub$i" > Makefile.am
36   echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.ac
37   echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.ac
38   mkdir sub$i
39   cd sub$i
40   echo "$d: @FOO@" > bar.in
41 done
42 echo AC_OUTPUT >> "$ocwd"/configure.ac
43 : > Makefile.am
44 unset d i
45 bottom=`pwd`
46
47 cd "$ocwd"
48
49 makefiles_am_list=`find . -name Makefile.am | LC_ALL=C sort`
50 makefiles_list=`echo "$makefiles_am_list" | sed 's/\.am$//'`
51 bar_in_list=`find . -name bar.in | LC_ALL=C sort`
52 bar_list=`echo "$bar_in_list" | sed 's/\.in$//'`
53
54 cat configure.ac # For debugging.
55
56 $ACLOCAL
57 $AUTOMAKE
58 $AUTOCONF
59
60 ./configure
61
62 for f in configure config.status $makefiles_list $bar_list; do
63   $FGREP "$magic1" $f
64 done
65
66 $sleep
67 sed "s/$magic1/$magic2/" configure.ac >configure.tmp
68 mv -f configure.tmp configure.ac
69
70 cd "$bottom"
71 $MAKE
72 cd "$ocwd"
73
74 for f in configure config.status $makefiles_list $bar_list; do
75   $FGREP "$magic2" $f
76 done
77 $FGREP "$magic1" configure config.status $makefiles_list $bar_list && Exit 1
78
79 $MAKE distcheck
80
81 :