tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / aclocal-install-mkdir.sh
1 #! /bin/sh
2 # Copyright (C) 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 # Check that "aclocal --install" creates the local m4 directory if
18 # necessary.
19 # FIXME: this is a good candidate for a conversion to TAP.
20
21 am_create_testdir=empty
22 . ./defs || Exit 1
23
24 set -e
25
26 cat > configure.ac <<END
27 AC_INIT([$me], [1.0])
28 MY_MACRO
29 END
30
31 mkdir sys-acdir
32 cat > sys-acdir/my-defs.m4 <<END
33 AC_DEFUN([MY_MACRO], [:])
34 END
35
36 ACLOCAL="$ACLOCAL --system-acdir=sys-acdir"
37
38 $ACLOCAL -I foo --install
39 test -f foo/my-defs.m4
40
41 $ACLOCAL --install -I "`pwd`/bar"
42 test -f bar/my-defs.m4
43
44 $ACLOCAL --install -I baz/sub/sub2
45 test -f baz/sub/sub2/my-defs.m4
46
47 # What should happen:
48 #  * zardoz1 should be created, and required m4 files copied into there.
49 #  * zardoz2 shouldn't be preferred to quux, even if the former exists
50 #    while the latter does not.
51 mkdir zardoz2
52 $ACLOCAL --install -I zardoz1 -I zardoz2
53 test -d zardoz1
54 grep MY_MACRO zardoz1/my-defs.m4
55 ls zardoz2 | grep . && Exit 1
56
57 # Directories in ACLOCAL_PATH should never be created if they don't
58 # exist.
59 ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install && Exit 1
60 test ! -d none
61 test ! -d none2
62 ACLOCAL_PATH="`pwd`/none:`pwd`/none2" $ACLOCAL --install -I x
63 test -f x/my-defs.m4
64 test ! -d none
65 test ! -d none2
66
67 # It's better if aclocal doesn't create the first include dir on failure.
68 $ACLOCAL --install -I none -I none2 && Exit 1
69 test ! -d none
70 test ! -d none2
71
72 :