tests: expose automake bug#14560
[platform/upstream/automake.git] / t / java-uninstall.sh
1 #! /bin/sh
2 # Copyright (C) 1998-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 uninstallation of Java class files.
18
19 required=javac
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am << 'END'
27 javadir = $(prefix)/java
28 java_JAVA = Foo.java
29 nobase_java_JAVA = Foo2.java
30 nobase_dist_java_JAVA = Bar.java
31 nodist_java_JAVA = Baz.java
32
33 # Java files are not distributed by default, so we distribute
34 # one "by hand" ...
35 EXTRA_DIST = Foo.java
36 # ... and make the other one generated.
37 Foo2.java:
38         rm -f $@ $@-t
39         echo 'class bClass {}' > $@-t
40         chmod a-w $@-t && mv -f $@-t $@
41
42 # Explicitly declared as 'nodist_', so generate it.
43 Baz.java:
44         rm -f $@ $@-t
45         echo 'class Baz {}' > $@-t
46         echo 'class Baz2 {}' >> $@-t
47         chmod a-w $@-t && mv -f $@-t $@
48
49 DISTCLEANFILES = Baz.java Foo2.java
50 END
51
52 echo 'class aClass {}' > Foo.java
53 echo 'class Zardoz {}' > Bar.java
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE
58
59 ./configure --prefix="$(pwd)"/_inst
60 javadir=_inst/java
61
62 check_uninstallation()
63 {
64   test ! -e $javadir/aClass.class
65   test ! -e $javadir/bClass.class
66   test ! -e $javadir/Zardoz.class
67   test ! -e $javadir/Baz.class
68   test ! -e $javadir/Baz2.class
69   test   -f $javadir/Foo.class
70   test   -f $javadir/Bar.class
71   test   -f $javadir/xClass.class
72 }
73
74 $MAKE
75 ls -l
76 $MAKE install
77 : > $javadir/Foo.class
78 : > $javadir/Bar.class
79 : > $javadir/xClass.class
80 ls -l $javadir
81 $MAKE uninstall
82 ls -l $javadir
83 check_uninstallation
84
85 # FIXME: "make uninstall" should continue to work also after "make clean",
86 #        but currently this doesn't happen.  See automake bug#8540.
87 $MAKE install
88 ls -l $javadir
89 $MAKE clean
90 ls -l
91 $MAKE uninstall
92 ls -l $javadir
93 #check_uninstallation
94
95 $MAKE distcheck
96
97 :