tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / subpkg4.sh
1 #! /bin/sh
2 # Copyright (C) 2006-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 # Test to ensure 'distdir' fixes the mode of files and directories
18 # copied into '$(distdir)', even with sub-packages.
19
20 . test-init.sh
21
22 cat >Makefile.am <<'END'
23 SUBDIRS = subpkg
24 test-distdir-is-readable:
25         bad_dirs=`find $(distdir) -type d ! -perm -755 -print`; \
26         if test -n "$$bad_dirs"; then \
27           echo "directories not permissive: $$bad_dirs" >&2; \
28           exit 1; \
29         fi
30         bad_files=`find $(distdir) ! -type d ! -perm -444 -print`; \
31         if test -n "$$bad_files"; then \
32           echo "file not permissive: $$bad_files" >&2; \
33           exit 1; \
34         fi
35 END
36
37 cat >>configure.ac <<'END'
38 AC_CONFIG_SUBDIRS([subpkg])
39 AC_OUTPUT
40 END
41
42 mkdir subpkg subpkg/dir
43 echo foobar >subpkg/foobar
44 echo baz > subpkg/dir/baz
45
46 chmod go-rwx subpkg/foobar subpkg/dir/baz subpkg/dir
47
48 cat >subpkg/Makefile.am <<'END'
49 EXTRA_DIST = foobar dir
50 END
51
52 cat >subpkg/configure.ac <<'END'
53 AC_INIT([subpkg], [1.0])
54 AM_INIT_AUTOMAKE
55 AC_CONFIG_FILES([Makefile])
56 AC_OUTPUT
57 END
58
59 $ACLOCAL
60 $AUTOMAKE
61 $AUTOCONF
62
63 cd subpkg
64 $ACLOCAL
65 $AUTOMAKE
66 $AUTOCONF
67 cd ..
68
69 ./configure
70 $MAKE distdir
71 $MAKE test-distdir-is-readable