doc: typos in test file.
[automake.git] / t / aclocal-serial.sh
blob0e9f7dfdef765f1cb9b0b5d37185f009d5c71159
1 #! /bin/sh
2 # Copyright (C) 2005-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 # Test for --install with #serial numbers.
19 am_create_testdir=empty
20 . test-init.sh
22 cat > configure.ac << 'END'
23 AC_INIT
24 AM_MACRO1
25 AM_MACRO2
26 END
28 mkdir 1 2 3 4 5 6
30 cat >1/m1.m4 <<EOF
31 #serial 1.8.1230.9
32 AC_DEFUN([AM_MACRO1], [:macro11:])
33 AC_DEFUN([AM_MACRO2], [:macro21:])
34 EOF
36 cat >2/m1.m4 <<EOF
37 #serial 1.8.1231.9
38 AC_DEFUN([AM_MACRO1], [:macro12:])
39 EOF
41 cat >3/m2.m4 <<EOF
42 #serial 13
43 AC_DEFUN([AM_MACRO2], [:macro23:])
44 EOF
46 cat >3/m1.m4 <<EOF
47 #serial 1.8.1230.1
48 AC_DEFUN([AM_MACRO1], [:macro13:])
49 EOF
51 cat >4/mumble.m4 <<EOF
52 #serial 0
53 AC_DEFUN([AM_MACRO1], [:macro14:])
54 EOF
56 cat >5/ill-formed.m4 <<EOF
57 #serial bla
58 #serial .2
59 #serial
60 AC_DEFUN([AM_MACRO1], [:macro15:])
61 EOF
63 cat >6/after-def.m4 <<EOF
64 AC_DEFUN([AM_MACRO1], [:macro16:])
65 #serial 1
66 EOF
68 clean_stale ()
70 rm -rf aclocal.m4 configure autom4te*.cache
73 $ACLOCAL -I 1 -I 2 -I 3 -I 4
74 $AUTOCONF
75 $FGREP ':macro11:' configure
76 $FGREP ':macro21:' configure
78 clean_stale
79 $ACLOCAL -I 1 -I 2 -I 3 -I 4 --install
80 $AUTOCONF
81 $FGREP ':macro12:' configure
82 $FGREP ':macro23:' configure
84 cp -f aclocal.m4 aclocal-m4.sav
85 clean_stale
86 mv -f aclocal-m4.sav aclocal.m4
87 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install --dry-run
88 $AUTOCONF
89 $FGREP ':macro12:' configure
90 $FGREP ':macro23:' configure
92 clean_stale
93 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install
94 $AUTOCONF
95 $FGREP ':macro14:' configure
96 $FGREP ':macro23:' configure
98 clean_stale
99 $ACLOCAL -I 4 -I 1 -I 2 --install 2>stderr && { cat stderr >&2; exit 1; }
100 cat stderr >&2
101 grep 'macro.*AM_MACRO2.*not found' stderr
103 clean_stale
104 $ACLOCAL -I 4 -I 1 --install
105 $AUTOCONF
106 $FGREP ':macro14:' configure
107 $FGREP ':macro21:' configure
109 mkdir acdir
110 ACLOCAL="$ACLOCAL --system-acdir acdir"
112 cat >acdir/m1.m4 <<EOF
113 #serial 456
114 AC_DEFUN([AM_MACRO1], [:macro1d:])
115 AC_DEFUN([AM_MACRO2], [:macro2d:])
117 clean_stale
118 $ACLOCAL -I 4 -I 1 --diff=diff >stdout 2>stderr || {
119 cat stderr >&2
120 cat stdout
121 exit 1
123 cat stderr >&2
124 cat stdout
125 grep '#serial 456' stdout
126 test ! -e 4/m1.m4
127 grep 'installing.*4/m1\.m4' stderr
129 $ACLOCAL -I 5 2>stderr && { cat stderr >&2; exit 1; }
130 cat stderr >&2
131 test $(grep -c 'ill-formed serial' stderr) -eq 3
133 $ACLOCAL -I 6 2>stderr && { cat stderr >&2; exit 1; }
134 cat stderr >&2
135 grep 'serial.*before any macro definition' stderr