]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
coverage: more on java support: EXTRA_ and noinst_ prefixes
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 6 Apr 2011 18:41:04 +0000 (20:41 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 9 Apr 2011 12:00:57 +0000 (14:00 +0200)
* tests/java-extra.test: New test, checking support for the
prefix `EXTRA_' with the JAVA primary.
* tests/java-noinst.test: New test, checking support for the
prefix `noinst_' with the JAVA primary.
* tests/Makefile.am (TESTS): Update.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/java-extra.test [new file with mode: 0755]
tests/java-noinst.test [new file with mode: 0755]

index 1be7709f668588d57e0c6980a726118502915073..9640a53885f996db00645f478eef206409053060 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-04-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: more on java support EXTRA_ and noinst_ prefixes
+       * tests/java-extra.test: New test, checking support for the
+       prefix `EXTRA_' with the JAVA primary.
+       * tests/java-noinst.test: New test, checking support for the
+       prefix `noinst_' with the JAVA primary.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-04-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix timestamp-related failures
index d4d94749795f93faedbd68f8f1109cfc38b9a1a1..718ca2bce791403d3640df8ba5c322515020a9a6 100644 (file)
@@ -422,6 +422,8 @@ java2.test \
 java3.test \
 javaprim.test \
 javasubst.test \
+java-extra.test \
+java-noinst.test \
 ldadd.test \
 ldflags.test \
 lex.test \
index 4d4c21f8d356806dc73ca6d4dcd2984143e0a74d..725ae4db78b1217643b55296af9c0d632d839c19 100644 (file)
@@ -692,6 +692,8 @@ java2.test \
 java3.test \
 javaprim.test \
 javasubst.test \
+java-extra.test \
+java-noinst.test \
 ldadd.test \
 ldflags.test \
 lex.test \
diff --git a/tests/java-extra.test b/tests/java-extra.test
new file mode 100755 (executable)
index 0000000..5309964
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check use of EXTRA with the JAVA primary.  Also test interaction
+# of JAVA with conditionals (it's natural to test it here, since
+# EXTRA_JAVA exists mostly for ensuring interoperation with Automake
+# conditionals).
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
+($HAS_JAVAC 77); $HAS_JAVAC 77
+AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(pkgdatadir)/java
+
+EXTRA_JAVA = Class1.java Class2.java Class3.java
+
+java_JAVA = Class1.java
+
+if COND
+java_JAVA += Class2.java
+else !COND
+java_JAVA += Class3.java
+endif !COND
+
+Class3.java: Makefile
+       echo 'class Class3 {}' > $@
+CLEANFILES = Class3.java
+END
+
+echo "class Class1 {}" > Class1.java
+echo "class Class2 {}" > Class2.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure cond=yes
+$MAKE
+ls -l
+test -f Class1.class
+test -f Class2.class
+test ! -f Class3.class
+test ! -f Class3.java
+
+$MAKE distclean
+
+./configure cond=no
+$MAKE
+ls -l
+test -f Class1.class
+test ! -f Class2.class
+test -f Class3.class
+test -f Class3.java
+
+:
diff --git a/tests/java-noinst.test b/tests/java-noinst.test
new file mode 100755 (executable)
index 0000000..130ea63
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that noinst_JAVA causes generated *.class files not to be installed.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
+($HAS_JAVAC 77); $HAS_JAVAC 77
+AC_OUTPUT
+END
+
+cat > Foo.java <<'END'
+class Foo { }
+END
+
+$ACLOCAL
+$AUTOCONF
+
+: > Makefile.in # Will be updated later.
+
+./configure --prefix="`pwd`/_inst"
+
+# We need this hacky loop because multiple uses of the JAVA primary
+# in the same Makefile.am are not allowed.
+
+for prefix in '' nodist_ dist_; do
+  echo "${prefix}noinst_JAVA = Foo.java" > Makefile.am
+  $AUTOMAKE
+  ./config.status Makefile
+  $MAKE
+  test -f Foo.class
+  $MAKE install
+  test ! -d _inst
+done
+
+: