Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distcheck-pr9579.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 against automake bug#9579: distcheck does not always detect
18 # incomplete uninstall as advertised.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AC_OUTPUT
26 END
27
28 # NOTE: the use of `dir' as the name of the data file installed by hand
29 # is deliberate, and enhances coverage -- see definition and comments of
30 # lib/am/distdir.am:$(am__distuninstallcheck_listfiles).
31
32 cat > Makefile.am << 'END'
33 dist_data_DATA = foo
34 EXTRA_DIST = dir
35 install-data-local:
36         $(MKDIR_P) '$(DESTDIR)$(datadir)'
37         cp '$(srcdir)/dir' '$(DESTDIR)$(datadir)/dir'
38 END
39
40 : > foo
41 : > dir
42
43 $ACLOCAL
44 $AUTOMAKE
45 $AUTOCONF
46
47 ./configure --prefix="`pwd`/inst"
48
49 # Sanity checks.
50 $MAKE install
51 find inst -type f
52 test -f inst/share/foo
53 test -f inst/share/dir
54 # We expect the uninstall target of our Makefile to be definitely broken.
55 $MAKE uninstall
56 test -f inst/share/dir
57 rm -rf inst
58
59 $MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
60 cat output
61
62 $FGREP 'ERROR: files left after uninstall:' output
63 grep '/share/dir *$' output
64
65 # A few trickier corner cases.
66
67 cat > Makefile.am << 'END'
68 EXTRA_DIST = dir
69 install-data-local:
70 install-data-local:
71         $(MKDIR_P) '$(DESTDIR)$(prefix)/mu/share/info'
72         cp '$(srcdir)/dir' '$(DESTDIR)$(prefix)/mu/share/info'
73         $(MKDIR_P) '$(DESTDIR)$(infodir)/more'
74         cp '$(srcdir)/dir' '$(DESTDIR)$(infodir)/more'
75 END
76
77 $AUTOMAKE
78 ./config.status Makefile
79
80 # Sanity checks, again.
81 $MAKE install
82 find inst -type f
83 test -f inst/mu/share/info/dir
84 test -f inst/share/info/more/dir
85 # We expect the uninstall target of our Makefile to be definitely broken.
86 $MAKE uninstall
87 test -f inst/mu/share/info/dir
88 test -f inst/share/info/more/dir
89 rm -rf inst
90
91 $MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
92 cat output
93
94 $FGREP 'ERROR: files left after uninstall:' output
95 grep '/mu/share/info/dir *$' output
96 grep '/share/info/more/dir *$' output
97
98 :