[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI 1/8] java: allow both JAVA and nobase_JAVA in the same Makefile.am
From: |
Stefano Lattarini |
Subject: |
[FYI 1/8] java: allow both JAVA and nobase_JAVA in the same Makefile.am |
Date: |
Tue, 26 Apr 2011 18:17:28 +0200 |
* automake.in (handle_java): Also strip `nobase_' from the given
prefix, when needed.
* tests/java-clean.test: Update and extend.
* tests/java-compile-install.test: Likewise.
* tests/java-no-duplicate.test: Likewise.
* tests/java-sources.test: Likewise.
* tests/java-noinst.test: Likewise.
* tests/java-mix-dist-nodist.test: Renamed to ...
* tests/java-mix.test: ... this, and extended.
* tests/java-nobase.test: New test, still xfailing due to
unrelated issues.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
---
ChangeLog | 16 +++++
automake.in | 2 +-
tests/Makefile.am | 4 +-
tests/Makefile.in | 4 +-
tests/java-clean.test | 25 +++++--
tests/java-compile-install.test | 23 +++++--
tests/{java-mix-dist-nodist.test => java-mix.test} | 34 +++++++---
tests/java-no-duplicate.test | 3 +
tests/java-nobase.test | 67 ++++++++++++++++++++
tests/java-noinst.test | 37 ++++++-----
tests/java-sources.test | 6 ++
11 files changed, 179 insertions(+), 42 deletions(-)
rename tests/{java-mix-dist-nodist.test => java-mix.test} (63%)
create mode 100755 tests/java-nobase.test
diff --git a/ChangeLog b/ChangeLog
index 414f5cb..adabd27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-04-23 Stefano Lattarini <address@hidden>
+
+ java: allow both JAVA and nobase_JAVA in the same Makefile.am
+ * automake.in (handle_java): Also strip `nobase_' from the given
+ prefix, when needed.
+ * tests/java-clean.test: Update and extend.
+ * tests/java-compile-install.test: Likewise.
+ * tests/java-no-duplicate.test: Likewise.
+ * tests/java-sources.test: Likewise.
+ * tests/java-noinst.test: Likewise.
+ * tests/java-mix-dist-nodist.test: Renamed to ...
+ * tests/java-mix.test: ... this, and extended.
+ * tests/java-nobase.test: New test, still xfailing due to
+ unrelated issues.
+ * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
2011-04-22 Stefano Lattarini <address@hidden>
testsuite: more environment sanitization
diff --git a/automake.in b/automake.in
index 01b41a1..434ee20 100755
--- a/automake.in
+++ b/automake.in
@@ -5114,7 +5114,7 @@ sub handle_java
my @java_sources = ();
foreach my $prefix (@prefixes)
{
- (my $curs = $prefix) =~ s/^(?:no)?dist_//;
+ (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
next
if $curs eq 'EXTRA';
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d59d1e..05d69cf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,6 +21,7 @@ all.test \
auxdir2.test \
cond17.test \
gcj6.test \
+java-nobase.test \
pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test \
txinfo5.test
@@ -437,10 +438,11 @@ javaprim.test \
javasubst.test \
java-extra.test \
java-noinst.test \
+java-nobase.test \
java-compile-install.test \
java-sources.test \
java-no-duplicate.test \
-java-mix-dist-nodist.test \
+java-mix.test \
ldadd.test \
ldflags.test \
lex.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index aadb869..3d6d7ec 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -277,6 +277,7 @@ all.test \
auxdir2.test \
cond17.test \
gcj6.test \
+java-nobase.test \
pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test \
txinfo5.test
@@ -708,10 +709,11 @@ javaprim.test \
javasubst.test \
java-extra.test \
java-noinst.test \
+java-nobase.test \
java-compile-install.test \
java-sources.test \
java-no-duplicate.test \
-java-mix-dist-nodist.test \
+java-mix.test \
ldadd.test \
ldflags.test \
lex.test \
diff --git a/tests/java-clean.test b/tests/java-clean.test
index 4dcc966..7db5e53 100755
--- a/tests/java-clean.test
+++ b/tests/java-clean.test
@@ -27,14 +27,21 @@ END
cat > Makefile.am << 'END'
javadir = $(datadir)/java
+
java_JAVA = Class.java
dist_java_JAVA = ClassDist.java
-nodist_java_JAVA = ClassNoDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
END
-echo 'class Class {}' > Class.java
-echo 'class ClassDist {}' > ClassDist.java
-echo 'class ClassNoDist {}' > ClassNoDist.java
+for base in '' Nobase; do
+ for dist in '' Dist Nodist; do
+ echo "class Class$base$dist {}" > Class$base$dist.java
+ done
+done
$ACLOCAL
$AUTOCONF
@@ -44,14 +51,18 @@ $AUTOMAKE
$MAKE
ls -l
test -f classjava.stamp
-test -f Class.class
-test -f ClassDist.class
-test -f ClassNoDist.class
+for base in '' Nobase; do
+ for dist in '' Dist Nodist; do
+ test -f Class$base$dist.class
+ done
+done
$MAKE clean
find . -name '*.class' -o -name '*.stamp' | grep . && Exit 1
# We should not remove unrelated stamp files.
echo timestamp > classjava2.stamp
+echo timestamp > classdist_java.stamp
$MAKE clean
test -f classjava2.stamp
+test -f classdist_java.stamp
:
diff --git a/tests/java-compile-install.test b/tests/java-compile-install.test
index b2145fb..74b7a00 100755
--- a/tests/java-compile-install.test
+++ b/tests/java-compile-install.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
+# 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
@@ -28,12 +28,20 @@ EOF
cat > Makefile.am << 'END'
javadir = $(datadir)/java
java_JAVA = Foo.java
-dist_java_JAVA = Bar.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
nodist_java_JAVA = Baz.java
-# Java files are not distributed by default.
+# Java files are not distributed by default, so we distribute
+# one "by hand" ...
EXTRA_DIST = Foo.java
+# ... and make the other one generated.
+Foo2.java:
+ rm -f $@ address@hidden
+ echo 'class bClass {}' > address@hidden
+ chmod a-w address@hidden && mv -f address@hidden $@
+# Explicitly declared as `nodist_', so generate it.
Baz.java:
rm -f $@ address@hidden
echo 'class Baz {}' > address@hidden
@@ -44,29 +52,34 @@ test:
ls -l $(srcdir) . ;: For debugging.
test -f $(srcdir)/Foo.java
test -f $(srcdir)/Bar.java
+ test -f Foo2.java
test -f Baz.java
test -f aClass.class
+ test -f bClass.class
test -f Zardoz.class
test -f Baz.class
test -f Baz2.class
test ! -r Foo.class
test ! -r Bar.class
+ test -f classjava.stamp
test-install:
- find $(prefix) ;: For debugging.
+ ls -l $(javadir) ;: For debugging.
+ test -f '$(javadir)/bClass.class'
test -f '$(javadir)/aClass.class'
test -f '$(javadir)/Zardoz.class'
test -f '$(javadir)/Baz.class'
test -f '$(javadir)/Baz2.class'
test ! -r '$(javadir)/Foo.class'
test ! -r '$(javadir)/Bar.class'
+ if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
check-local: test
installcheck-local: test-install
.PHONY: test test-install
-DISTCLEANFILES = Baz.java
+DISTCLEANFILES = Baz.java Foo2.java
END
echo 'class aClass {}' > Foo.java
diff --git a/tests/java-mix-dist-nodist.test b/tests/java-mix.test
similarity index 63%
rename from tests/java-mix-dist-nodist.test
rename to tests/java-mix.test
index 786f400..1c8163a 100755
--- a/tests/java-mix-dist-nodist.test
+++ b/tests/java-mix.test
@@ -14,8 +14,9 @@
# 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 that the JAVA primary can be used with both `dist_' and `nodist_'
-# modifiers in the same directory.
+# Check that the JAVA primary can be used freely in the same Makefile.am
+# with proper combinations of the `dist_', `nodist_' and `nobase_'
+# modifiers .
. ./defs || Exit 1
@@ -27,15 +28,23 @@ cat > Makefile.am << 'END'
# This test does not require compilation of *.java files.
JAVAC = false
javadir = $(prefix)
-java_JAVA = Class1.java
-dist_java_JAVA = Class2.java
-nodist_java_JAVA = Class3.java
-Class3.java:
+
+java_JAVA = Class.java
+dist_java_JAVA = ClassDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
+
+Class3.java Class6.java:
@echo '$@ should not be generated!' >&2; exit 1
END
-: > Class1.java
-: > Class2.java
+: > Class.java
+: > ClassDist.java
+: > ClassNobase.java
+: > ClassNobaseDist.java
$ACLOCAL
$AUTOCONF
@@ -49,8 +58,11 @@ test ! -s stderr
$MAKE distdir
ls -l $distdir # For debugging.
-test -f $distdir/Class1.java
-test -f $distdir/Class2.java
-test ! -f $distdir/Class3.java
+test -f $distdir/Class.java
+test -f $distdir/ClassDist.java
+test -f $distdir/NobaseClass.java
+test -f $distdir/NobaseClassDist.java
+test ! -f $distdir/ClassNodist.java
+test ! -f $distdir/NobaseClassNodist.java
:
diff --git a/tests/java-no-duplicate.test b/tests/java-no-duplicate.test
index d5fec4b..ec42a3b 100755
--- a/tests/java-no-duplicate.test
+++ b/tests/java-no-duplicate.test
@@ -26,6 +26,9 @@ javadir = $(datadir)/java
java_JAVA = a.java
dist_java_JAVA = b.java
nodist_java_JAVA = c.java
+nobase_java_JAVA = d.java
+nobase_dist_java_JAVA = e.java
+nobase_nodist_java_JAVA = f.java
END
$ACLOCAL
diff --git a/tests/java-nobase.test b/tests/java-nobase.test
new file mode 100755
index 0000000..7b55290
--- /dev/null
+++ b/tests/java-nobase.test
@@ -0,0 +1,67 @@
+#! /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/>.
+
+# Test support of `nobase_' with the `JAVA' primary.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+nobase_java_JAVA = sub/subsub/Foo.java
+nobase_dist_java_JAVA = sub/Bar.java
+nobase_nodist_java_JAVA = sub2/Baz.java
+
+# Java files are not distributed by default.
+EXTRA_DIST = sub/subsub/Foo.java
+
+sub2/Baz.java:
+ rm -f $@ address@hidden
+ test -d sub2 || mkdir sub2
+ echo 'class Baz {}' > address@hidden
+ chmod a-w address@hidden && mv -f address@hidden $@
+
+.PHONY: test-install
+test-install:
+ find $(prefix) ;: For debugging.
+ test -f $(javadir)/sub/subsub/Foo.class
+ test -f $(javadir)/sub/Bar.class
+ test -f $(javadir)/sub2/Baz.class
+installcheck-local: test-install
+DISTCLEANFILES = sub2/Baz.java
+END
+
+mkdir sub sub/subsub
+echo 'class Foo {}' > sub/subsub/Foo.java
+echo 'class Bar {}' > sub/Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+$MAKE check
+$MAKE install
+$MAKE test-install
+$MAKE distcheck
+
+:
diff --git a/tests/java-noinst.test b/tests/java-noinst.test
index 130ea63..6547770 100755
--- a/tests/java-noinst.test
+++ b/tests/java-noinst.test
@@ -14,7 +14,8 @@
# 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.
+# Make sure that noinst_JAVA causes generated *.class files not to
+# be installed.
. ./defs || Exit 1
@@ -26,28 +27,32 @@ AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
AC_OUTPUT
END
-cat > Foo.java <<'END'
-class Foo { }
+cat > Makefile.am <<'END'
+noinst_JAVA = 1.java
+dist_noinst_JAVA = 2.java
+nodist_noinst_JAVA = 3.java
+nobase_noinst_JAVA = 4.java
+nobase_dist_noinst_JAVA = 5.java
+nobase_nodist_noinst_JAVA = 6.java
END
+for i in 1 2 3 4 5 6; do
+ echo "class Class$i {}" > $i.java
+done
+
$ACLOCAL
+$AUTOMAKE
$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
+$MAKE
+ls -l
+for i in 1 2 3 4 5 6; do
+ test -f Class$i.class
done
+$MAKE install
+test -d _inst && { ls -l _inst; Exit 1; }
+
:
diff --git a/tests/java-sources.test b/tests/java-sources.test
index 4a489e4..770eb2d 100755
--- a/tests/java-sources.test
+++ b/tests/java-sources.test
@@ -31,6 +31,9 @@ foodir = $(prefix)
foo_JAVA = a.java
dist_foo_JAVA = b.java
nodist_foo_JAVA = c.java
+nobase_foo_JAVA = d.java
+nobase_dist_foo_JAVA = e.java
+nobase_nodist_foo_JAVA = f.java
.PHONY: debug
debug:
@@ -48,6 +51,9 @@ cat > exp << 'END'
a.java
b.java
c.java
+d.java
+e.java
+f.java
END
./configure
--
1.7.2.3
- [FYI 0/8] More Java patches (mostly testsuite-related), Stefano Lattarini, 2011/04/26
- [FYI 2/8] java tests: require java compiler more properly, Stefano Lattarini, 2011/04/26
- [FYI 3/8] java coverage: add test on uninstall with JAVA primary, Stefano Lattarini, 2011/04/26
- [FYI 1/8] java: allow both JAVA and nobase_JAVA in the same Makefile.am,
Stefano Lattarini <=
- [FYI 4/8] java tests: tweak and make stricter a couple of tests, Stefano Lattarini, 2011/04/26
- [FYI 5/8] test defs: new requirement for the default java interpreter, Stefano Lattarini, 2011/04/26
- [FYI 6/8] java coverage: try to build and run a java program, Stefano Lattarini, 2011/04/26
- [FYI 7/8] java coverage: test rebuild rules for java, Stefano Lattarini, 2011/04/26
- [FYI 8/8] java coverage: test JAVACFLAGS and AM_JAVACFLAGS, Stefano Lattarini, 2011/04/26