* 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 | 9 ++++++ tests/Makefile.am | 2 + tests/Makefile.in | 2 + tests/java-extra.test | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/java-noinst.test | 53 ++++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 0 deletions(-) create mode 100755 tests/java-extra.test create mode 100755 tests/java-noinst.test
-*-*- OK for master? I'll push in 72 hours if there is no objection. Regards, Stefano
From f2c0619febaa2d819dfb1c9e06e2aae077add83b Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Wed, 6 Apr 2011 20:41:04 +0200 Subject: [PATCH] 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. --- ChangeLog | 9 ++++++ tests/Makefile.am | 2 + tests/Makefile.in | 2 + tests/java-extra.test | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/java-noinst.test | 53 ++++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 0 deletions(-) create mode 100755 tests/java-extra.test create mode 100755 tests/java-noinst.test diff --git a/ChangeLog b/ChangeLog index 1be7709..9640a53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-06 Stefano Lattarini <stefano.lattar...@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.lattar...@gmail.com> tests: fix timestamp-related failures diff --git a/tests/Makefile.am b/tests/Makefile.am index d4d9474..718ca2b 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 4d4c21f..725ae4d 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 0000000..f1f7764 --- /dev/null +++ b/tests/java-extra.test @@ -0,0 +1,75 @@ +#! /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 +# JAVA_EXTRA 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 +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 0000000..130ea63 --- /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 <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 + +: -- 1.7.2.3