tests: fix a spurious typo-related failure
[automake.git] / t / aclocal-install-fail.sh
blob99fa77ab6cfcc856b7e793442713914c4df651f8
1 #! /bin/sh
2 # Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
17 # Check that "aclocal --install" fails when it should.
18 # FIXME: this is a good candidate for a conversion to TAP.
20 am_create_testdir=empty
21 required=ro-dir
22 . ./defs || exit 1
24 cat > configure.ac <<END
25 AC_INIT([$me], [1.0])
26 MY_MACRO
27 END
29 mkdir sys-acdir
30 cat > sys-acdir/my-defs.m4 <<END
31 AC_DEFUN([MY_MACRO], [:])
32 END
34 ACLOCAL="$ACLOCAL -Wnone --system-acdir=sys-acdir"
36 : > a-regular-file
37 mkdir unwritable-dir
38 chmod a-w unwritable-dir
40 $ACLOCAL -I a-regular-file --install 2>stderr \
41 && { cat stderr >&2; exit 1; }
42 cat stderr >&2
43 $EGREP '(mkdir:|directory ).*a-regular-file' stderr
44 test ! -e aclocal.m4
46 $ACLOCAL --install -I unwritable-dir/sub 2>stderr \
47 && { cat stderr >&2; exit 1; }
48 cat stderr >&2
49 $EGREP '(mkdir:|directory ).*unwritable-dir/sub' stderr
50 test ! -e aclocal.m4
52 $ACLOCAL -I unwritable-dir --install 2>stderr \
53 && { cat stderr >&2; exit 1; }
54 cat stderr >&2
55 $EGREP '(cp:|copy ).*unwritable-dir' stderr
56 test ! -e aclocal.m4
58 # Sanity check.
59 mkdir m4
60 $ACLOCAL -I m4 --install && test -f aclocal.m4 \
61 || fatal_ "aclocal failed also when expected to succeed"