From: Stefano Lattarini Date: Wed, 6 Apr 2011 18:41:04 +0000 (+0200) Subject: coverage: more on java support: EXTRA_ and noinst_ prefixes X-Git-Tag: ng-0.5a~219^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d6b98c76cd6e64ce1e67303db13d457ae33bc4f;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 1be7709f6..9640a5388 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-06 Stefano Lattarini + + 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 tests: fix timestamp-related failures diff --git a/tests/Makefile.am b/tests/Makefile.am index d4d947497..718ca2bce 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -422,6 +422,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/Makefile.in b/tests/Makefile.in index 4d4c21f8d..725ae4db7 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..530996402 --- /dev/null +++ b/tests/java-extra.test @@ -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 . + +# 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 index 000000000..130ea6353 --- /dev/null +++ b/tests/java-noinst.test @@ -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 . + +# 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 + +: