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