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