automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, branch-1.11, updated. v1.11


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, branch-1.11, updated. v1.11.1-507-gacb2af6
Date: Sun, 18 Sep 2011 18:15:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=acb2af6bf0f745af619f164f59f7f3d37bfc6d99

The branch, branch-1.11 has been updated
       via  acb2af6bf0f745af619f164f59f7f3d37bfc6d99 (commit)
       via  dd7e620bf9ef468a762be8594c61c7e5bb0b0d27 (commit)
       via  0b7d3cbc93055201bc58497e6519f477d0b72701 (commit)
       via  8d97cb95019b04707fdd60b4d9994d0acc9c6554 (commit)
       via  e9e0b23fc89dbec01138359033b13a8f8be50ee8 (commit)
       via  c9a6f7e262be9f011862580a07e37091819b6785 (commit)
       via  9a937d21bbf695af2749d6ca2cd2def96009ec9a (commit)
       via  2990ef353fa395d1b7ded2aa15f5cf574adbb78d (commit)
       via  20787ab1199329eda967d14a6fd1d7f6a92d149a (commit)
       via  672fd9352b5b8a07ab0c74cef2357770497fcdaa (commit)
       via  527d34a6af23afcbede70765e72a255c7affe729 (commit)
       via  9f10765954f400c047b3d6cd12e31e54efefe0c3 (commit)
       via  fc27b8fa70ffad842a525e05d5069022b96f6388 (commit)
       via  3f7d0a5e8a9970e166a228a32a3bc80cd6da7868 (commit)
       via  a2ebf0e5b1f34d76ce92673cf8575a10d33f9b05 (commit)
       via  cd16ceb382de8f64d44efd7dd1948c33fc52566e (commit)
       via  429b748cecaa046d11f5a93bea0c93c809179ed6 (commit)
       via  a716df2ed5f62889d3b442d5ecc5e2edd6794ee4 (commit)
       via  dd8b570a6a55cb20690cdc2c312309338d2495d3 (commit)
       via  b46debf534a9adab1b7c8e8b96c3c11de5dc9ae4 (commit)
      from  449e62feb12417fdff9e74073b88da65a58bd62a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit acb2af6bf0f745af619f164f59f7f3d37bfc6d99
Merge: 449e62f dd7e620
Author: Stefano Lattarini <address@hidden>
Date:   Sun Sep 18 20:14:48 2011 +0200

    Merge branch 'maint' into branch-1.11
    
    * maint:
      coverage: test interactions of `nobase_' and `nodist_'
      java: fix various blunders in test 'java-mix.test'
      cosmetics: fix various typos and grammaros
      java: allow both JAVA and nobase_JAVA in the same Makefile.am
      java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
      py-compile: '--' and non-option arguments terminate the option list
      py-compile: complain on unrecognized options
      py-compile: normalize error and help messages
      python tests: add "unit tests" on py-compile
      py-compile: the '--destdir' option now accepts a blank argument
      python: run the 'py-compile' script with $(SHELL)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |  125 ++++++++++++++++++++
 NEWS                                               |    5 +
 automake.in                                        |   20 +++-
 lib/am/java.am                                     |   14 ++-
 lib/am/python.am                                   |   19 +--
 lib/py-compile                                     |   51 +++++---
 tests/Makefile.am                                  |   15 +++
 tests/Makefile.in                                  |   15 +++
 tests/java-clean.test                              |   68 +++++++++++
 tests/java-compile-install.test                    |   99 ++++++++++++++++
 tests/java-mix.test                                |   69 +++++++++++
 ...el-tests-subdir.test => java-no-duplicate.test} |   44 +++----
 tests/{java-check.test => java-nobase.test}        |   57 +++++-----
 ...ck-tests_environment.test => java-sources.test} |   42 +++++--
 tests/java.test                                    |    9 +-
 tests/nobase-nodist.test                           |   62 ++++++++++
 tests/py-compile-basedir.test                      |   51 ++++++++
 tests/py-compile-basic.test                        |   64 ++++++++++
 tests/py-compile-basic2.test                       |   71 +++++++++++
 tests/py-compile-destdir.test                      |   44 +++++++
 ...ck-exported-srcdir.test => py-compile-env.test} |   65 +++++------
 ...onfig.test => py-compile-option-terminate.test} |   44 ++++----
 tests/py-compile-usage.test                        |   75 ++++++++++++
 23 files changed, 964 insertions(+), 164 deletions(-)
 create mode 100755 tests/java-clean.test
 create mode 100755 tests/java-compile-install.test
 create mode 100755 tests/java-mix.test
 copy tests/{parallel-tests-subdir.test => java-no-duplicate.test} (55%)
 copy tests/{java-check.test => java-nobase.test} (50%)
 copy tests/{check-tests_environment.test => java-sources.test} (60%)
 create mode 100644 tests/nobase-nodist.test
 create mode 100755 tests/py-compile-basedir.test
 create mode 100755 tests/py-compile-basic.test
 create mode 100755 tests/py-compile-basic2.test
 create mode 100755 tests/py-compile-destdir.test
 copy tests/{check-exported-srcdir.test => py-compile-env.test} (50%)
 copy tests/{autodist-acconfig.test => py-compile-option-terminate.test} (60%)
 create mode 100755 tests/py-compile-usage.test

diff --git a/ChangeLog b/ChangeLog
index b491cf4..e1f4ce3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,67 @@
+2011-09-12  Stefano Lattarini  <address@hidden>
+
+       cosmetics: fix various typos and grammaros
+       * NEWS: Fix typos.
+       * tests/py-compile-basic.test: Likewise.
+       * tests/py-compile-basedir.test: Fix botched wording in comments.
+       * tests/py-compile-option-terminate.test: Fix typo and incomplete
+       comment.
+       Suggestions by Peter Rosin.
+
+2011-09-18  Stefano Lattarini  <address@hidden>
+
+       coverage: test interactions of `nobase_' and `nodist_'
+       * tests/nobase-nodist.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-09-18  Stefano Lattarini  <address@hidden>
+
+       java: fix various blunders in test 'java-mix.test'
+       * tests/java-mix.test: Add missing call to `set -e'.  Fix inverted
+       semantics (`.java' files are expected *not* to be distributed by
+       default, not the other way round).  Fix various typos in the name
+       of the `.java' files.  Correct other minor blunders.  Improve some
+       comments.
+
+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-18  Stefano Lattarini  <address@hidden>
+
+       java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
+       Fixes automake bug#8434.
+       * automake.in (handle_java): Strip `dist_' and `nodist_' from
+       the given prefix.  Define a new internal Makefile variable
+       `am__java_sources'.  Related adjustments.
+       * lib/am/java.am (JAVAC, JAVAROOT, CLASSPATH_ENV): Define only the
+       first time this am file is processed.
+       (class%DIR%.stamp): Stamp file renamed ...
+       (class%NDIR%.stamp): ... to this, so that the `dist_' and `nodist_'
+       prefixes are stripped from the name of the stampfile.  Adjust
+       declaration of dependencies by using the new automake-generated
+       internal variable `$(am__java_sources)'.  In the rule, use `$@'
+       as the name of the target, rather than hard-coding it.
+       * tests/java.test: Update and extend.
+       * tests/java-no-duplicate.test: New test.
+       * tests/java-mix-dist-nodist.test: Likewise.
+       * tests/java-compile-and-install.test: Likewise.
+       * tests/java-clean.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-09-11  Stefano Lattarini  <address@hidden>
 
        tests: fix spurious failure on fast machines
@@ -508,6 +572,67 @@
        generic hard errors.  The latter should be reserved for "real"
        set-up failures.
 
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: '--' and non-option arguments terminate the option list
+       * lib/py-compile: Any non-option argument, or the special `--'
+       argument, now explicitly terminates the list of options.
+       * tests/py-compile-option-terminate.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: complain on unrecognized options
+       * lib/py-compile: Complain on unrecognized options.  Don't be too
+       lax in matching `--help' and `--version' options.
+       * tests/py-compile-usage.test: Extend accordingly.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: normalize error and help messages
+       * lib/py-compile: Now error messages do not begin with a capital
+       letter, nor end with a period, as per GNU standards.  Prepend the
+       error messages with the name of the script, not with its path.
+       When an invalid usage is recognized, always display the customary
+       message "Try `py-compile --help' ..." on a line of its own.
+       ($me): New variable, containing the name of the
+       program, i.e., `py-compile'.  Use it throughout.
+       (usage_error): New function, used to display error messages about
+       invalid usage.
+       * tests/py-compile-usage.test: Extend and tighten accordingly.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       python tests: add "unit tests" on py-compile
+       * tests/py-compile-basic.test: New test.
+       * tests/py-compile-basic2.test: New test.
+       * tests/py-compile-basedir.test: Likewise.
+       * tests/py-compile-destdir.test: Likewise.
+       * tests/py-compile-env.test: Likewise.
+       * tests/py-compile-usage.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       Tested with python 2.0.1, 2.4.6, 2.6.6, 2.7.1, and 3.1.3.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: the '--destdir' option now accepts a blank argument
+       * lib/py-compile (Option parsing): Do not count an empty argument
+       to `--destdir' or `--basedir' as a missing argument.
+       * lib/python.am: Simplify accordingly, passing the `--destdir'
+       option to py-compile unconditionally, even if `$(DESTDIR)' is
+       empty.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       python: run the 'py-compile' script with $(SHELL)
+       * lib/python.am (install-%DIR%PYTHON): Run each instance of
+       py-compile using $(SHELL).  Since we are at it, break overly
+       long lines.
+       (am__py_compile): New variable, to reduce code duplication.
+
 2011-06-02  Stefano Lattarini  <address@hidden>
 
        maintcheck: fix some failures, extend some checks
diff --git a/NEWS b/NEWS
index 985fa5f..0ec8fab 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,11 @@ New in 1.11.1a:
   - The `lzma' compression scheme and associated automake option `dist-lzma'
     is obsoleted by `xz' and `dist-xz' due to upstream changes.
 
+  - The py-compile script now accepts empty arguments passed to the options
+    `--destdir' and `--basedir', and complains about unrecognized options.
+    Moreover, a non-option argument or a special `--' argument terminates
+    the list of options.
+
   - A developer that needs to pass specific flags to configure at "make
     distcheck" time can now, and indeed he's advised to, do so by defining
     the developer-reserved makefile variable AM_DISTCHECK_CONFIGURE_FLAGS,
diff --git a/automake.in b/automake.in
index d0d986e..208a66b 100755
--- a/automake.in
+++ b/automake.in
@@ -5107,20 +5107,32 @@ sub handle_java
                                      'java', 'noinst', 'check');
     return if ! @sourcelist;
 
-    my @prefix = am_primary_prefixes ('JAVA', 1,
+    my @prefixes = am_primary_prefixes ('JAVA', 1,
                                      'java', 'noinst', 'check');
 
     my $dir;
-    foreach my $curs (@prefix)
+    my @java_sources = ();
+    foreach my $prefix (@prefixes)
       {
+        (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
+
        next
          if $curs eq 'EXTRA';
 
-       err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
-         if defined $dir;
+        push @java_sources, '$(' . $prefix . '_JAVA' . ')';
+
+       if (defined $dir)
+         {
+           err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
+            unless $curs eq $dir;
+         }
+
        $dir = $curs;
       }
 
+    define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
+                            "@java_sources");
+
     if ($dir eq 'check')
       {
         push (@check, "class$dir.stamp");
diff --git a/lib/am/java.am b/lib/am/java.am
index 604df22..464b706 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -20,11 +20,13 @@
 ## Building.  ##
 ## ---------- ##
 
+if %?FIRST%
 JAVAC = javac
 CLASSPATH_ENV = 
CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
 JAVAROOT = $(top_builddir)
+endif %?FIRST%
 
-class%DIR%.stamp: $(%DIR%_JAVA)
+class%NDIR%.stamp: $(am__java_sources)
        @list1='$?'; list2=; if test -n "$$list1"; then \
          for p in $$list1; do \
            if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
@@ -33,7 +35,7 @@ class%DIR%.stamp: $(%DIR%_JAVA)
          echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) 
$(JAVACFLAGS) '"$$list2"; \
          $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) 
$(JAVACFLAGS) $$list2; \
        else :; fi
-       echo timestamp > class%DIR%.stamp
+       echo timestamp > $@
 
 
 ## ------------ ##
@@ -44,7 +46,7 @@ if %?INSTALL%
 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
 ?EXEC?.PHONY install-exec-am: install-%DIR%JAVA
 ?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
-install-%DIR%JAVA: class%DIR%.stamp
+install-%DIR%JAVA: class%NDIR%.stamp
        @$(NORMAL_INSTALL)
        test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
 ## A single .java file can be compiled into multiple .class files.  So
@@ -76,9 +78,9 @@ endif %?INSTALL%
 ## Cleaning.  ##
 ## ---------- ##
 
-.PHONY clean-am: clean-%DIR%JAVA
-clean-%DIR%JAVA:
-       -rm -f *.class class%DIR%.stamp
+.PHONY clean-am: clean-%NDIR%JAVA
+clean-%NDIR%JAVA:
+       -rm -f *.class class%NDIR%.stamp
 
 
 ## -------------- ##
diff --git a/lib/am/python.am b/lib/am/python.am
index 9424a19..40aaa62 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1999, 2001, 2003, 2004, 2006, 2007, 2008, 2009  Free
-## Software Foundation, Inc.
+## Copyright (C) 1999, 2001, 2003, 2004, 2006, 2007, 2008, 2009, 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
@@ -24,6 +24,7 @@ endif %?INSTALL%
 ## ------------ ##
 
 if %?INSTALL%
+?FIRST?am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
 .PHONY install-%EXEC?exec:data%-am: install-%DIR%PYTHON
 install-%DIR%PYTHON: $(%DIR%_PYTHON)
@@ -52,11 +53,8 @@ if %?BASE%
 ## Byte-compile must be done at install time, since file times are
 ## encoded in the actual files.
        if test -n "$$dlist"; then \
-         if test -z "$(DESTDIR)"; then \
-           PYTHON=$(PYTHON) $(py_compile) --basedir "$(%NDIR%dir)" $$dlist; \
-         else \
-           PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir 
"$(%NDIR%dir)" $$dlist; \
-         fi; \
+         $(am__py_compile) --destdir "$(DESTDIR)" \
+                           --basedir "$(%NDIR%dir)" $$dlist; \
        else :; fi
 else !%?BASE%
        @list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
@@ -76,11 +74,8 @@ else !%?BASE%
 ## Byte-compile must be done at install time, since file times are
 ## encoded in the actual files.
          if test -n "$$dlist"; then \
-           if test -z "$(DESTDIR)"; then \
-             PYTHON=$(PYTHON) $(py_compile) --basedir "$(%NDIR%dir)" $$dlist; \
-           else \
-             PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir 
"$(%NDIR%dir)" $$dlist; \
-           fi; \
+           $(am__py_compile) --destdir "$(DESTDIR)" \
+                             --basedir "$(%NDIR%dir)" $$dlist; \
          else :; fi \
        done
 endif !%?BASE%
diff --git a/lib/py-compile b/lib/py-compile
index 3f9d05b..15c834c 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -1,10 +1,10 @@
 #!/bin/sh
 # py-compile - Compile a Python program
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-06-08.12; # UTC
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 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
@@ -32,28 +32,36 @@ if [ -z "$PYTHON" ]; then
   PYTHON=python
 fi
 
+me=py-compile
+
+usage_error ()
+{
+  echo "$me: $*" >&2
+  echo "Try \`$me --help' for more information." >&2
+  exit 1
+}
+
 basedir=
 destdir=
-files=
 while test $# -ne 0; do
   case "$1" in
     --basedir)
-      basedir=$2
-      if test -z "$basedir"; then
-        echo "$0: Missing argument to --basedir." 1>&2
-        exit 1
+      if test $# -lt 2; then
+        usage_error "option '--basedir' requires an argument"
+      else
+        basedir=$2
       fi
       shift
       ;;
     --destdir)
-      destdir=$2
-      if test -z "$destdir"; then
-        echo "$0: Missing argument to --destdir." 1>&2
-        exit 1
+      if test $# -lt 2; then
+        usage_error "option '--destdir' requires an argument"
+      else
+        destdir=$2
       fi
       shift
       ;;
-    -h|--h*)
+    -h|--help)
       cat <<\EOF
 Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] 
FILES..."
 
@@ -69,20 +77,27 @@ Report bugs to <address@hidden>.
 EOF
       exit $?
       ;;
-    -v|--v*)
-      echo "py-compile $scriptversion"
+    -v|--version)
+      echo "$me $scriptversion"
       exit $?
       ;;
+    --)
+      shift
+      break
+      ;;
+    -*)
+      usage_error "unrecognized option '$1'"
+      ;;
     *)
-      files="$files $1"
+      break
       ;;
   esac
   shift
 done
 
+files=$*
 if test -z "$files"; then
-    echo "$0: No files given.  Try \`$0 --help' for more information." 1>&2
-    exit 1
+    usage_error "no files given"
 fi
 
 # if basedir was given, then it should be prepended to filenames before
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 35b96fe..c2dbf23 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 \
 vala-vpath.test \
@@ -454,6 +455,12 @@ java-check.test \
 java-empty-classpath.test \
 javaprim.test \
 javasubst.test \
+java-clean.test \
+java-nobase.test \
+java-compile-install.test \
+java-sources.test \
+java-no-duplicate.test \
+java-mix.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -558,6 +565,7 @@ multlib.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
+nobase-nodist.test \
 nodef.test \
 nodef2.test \
 nodep.test \
@@ -661,6 +669,13 @@ primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
 proginst.test \
+py-compile-basic.test \
+py-compile-basic2.test \
+py-compile-basedir.test \
+py-compile-destdir.test \
+py-compile-env.test \
+py-compile-option-terminate.test \
+py-compile-usage.test \
 python.test \
 python2.test \
 python3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index e9541ba..5384f30 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -286,6 +286,7 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
+java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 vala-vpath.test \
@@ -732,6 +733,12 @@ java-check.test \
 java-empty-classpath.test \
 javaprim.test \
 javasubst.test \
+java-clean.test \
+java-nobase.test \
+java-compile-install.test \
+java-sources.test \
+java-no-duplicate.test \
+java-mix.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -836,6 +843,7 @@ multlib.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
+nobase-nodist.test \
 nodef.test \
 nodef2.test \
 nodep.test \
@@ -939,6 +947,13 @@ primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
 proginst.test \
+py-compile-basic.test \
+py-compile-basic2.test \
+py-compile-basedir.test \
+py-compile-destdir.test \
+py-compile-env.test \
+py-compile-option-terminate.test \
+py-compile-usage.test \
 python.test \
 python2.test \
 python3.test \
diff --git a/tests/java-clean.test b/tests/java-clean.test
new file mode 100755
index 0000000..7db5e53
--- /dev/null
+++ b/tests/java-clean.test
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 1998, 2001, 2002, 2004, 2007  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 cleaning of Java class files and timestamps.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/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
+END
+
+for base in '' Nobase; do
+  for dist in '' Dist Nodist; do
+    echo "class Class$base$dist {}" > Class$base$dist.java
+  done
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+ls -l
+test -f classjava.stamp
+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
new file mode 100755
index 0000000..74b7a00
--- /dev/null
+++ b/tests/java-compile-install.test
@@ -0,0 +1,99 @@
+#! /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 on compilation and installation of Java class files.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+java_JAVA = Foo.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
+nodist_java_JAVA = Baz.java
+
+# 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
+       echo 'class Baz2 {}' >> address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+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:
+       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 Foo2.java
+END
+
+echo 'class aClass {}' > Foo.java
+echo 'class Zardoz {}' > Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+$MAKE
+$MAKE test
+$MAKE install
+$MAKE test-install
+$MAKE distcheck
+
+:
diff --git a/tests/java-mix.test b/tests/java-mix.test
new file mode 100755
index 0000000..d6a43e7
--- /dev/null
+++ b/tests/java-mix.test
@@ -0,0 +1,69 @@
+#! /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 that the JAVA primary can be used freely in the same Makefile.am
+# with proper combinations of the `dist_', `nodist_' and `nobase_'
+# modifiers.  Also check that `.java' files are not ditributed by default.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# This test does not require compilation of *.java files.
+JAVAC = false
+javadir = $(prefix)
+
+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
+
+Class.java ClassNodist.java ClassNobase.java ClassNobaseNodist.java:
+       @echo '$@ should not be generated!' >&2; exit 1
+END
+
+: > ClassDist.java
+: > ClassNobaseDist.java
+
+$ACLOCAL
+$AUTOCONF
+# Automake used to display non-fatal warnings with this test, but
+# they were unexpected, so we want to consider them as failures in
+# this test.
+$AUTOMAKE 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+test ! -s stderr
+
+./configure
+
+$MAKE distdir
+ls -l $distdir # For debugging.
+test ! -f $distdir/Class.java
+test -f $distdir/ClassDist.java
+test ! -f $distdir/ClassNobase.java
+test -f $distdir/ClassNobaseDist.java
+test ! -f $distdir/ClassNodist.java
+test ! -f $distdir/ClassNobaseNodist.java
+
+:
diff --git a/tests/parallel-tests-subdir.test b/tests/java-no-duplicate.test
similarity index 55%
copy from tests/parallel-tests-subdir.test
copy to tests/java-no-duplicate.test
index 18695fe..ec42a3b 100755
--- a/tests/parallel-tests-subdir.test
+++ b/tests/java-no-duplicate.test
@@ -14,38 +14,34 @@
 # 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 parallel-tests driver creates parent directories for
-# the log files when needed.
+# Test that some Java-related variables and rules are not repeatedly
+# defined.
 
-parallel_tests=yes
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
-AC_OUTPUT
-END
-
 cat > Makefile.am << 'END'
-TESTS = dir1/foo.test dir2/dir3/foo.test
-TEST_LOG_COMPILER = sh
+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
 
-mkdir dir1 dir2 dir2/dir3
-echo : > dir1/foo.test
-echo : > dir2/dir3/foo.test
-
 $ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-mkdir build
-cd build
-../configure
-$MAKE check
-find . # For debugging.
-test -f test-suite.log
-test -f dir1/foo.log
-test -f dir2/dir3/foo.log
+$AUTOMAKE
+
+$EGREP -i '\.stamp|\.class|java|classpath' Makefile.in # For debugging.
+
+for var in JAVAC JAVAROOT CLASSPATH_ENV am__java_sources; do
+  grep "^$var =" Makefile.in
+  test `grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in` = 1
+done
+
+grep '^classjava\.stamp:' Makefile.in
+test `grep -c "class.*java.*\.stamp.*:" Makefile.in` = 1
 
 :
diff --git a/tests/java-check.test b/tests/java-nobase.test
similarity index 50%
copy from tests/java-check.test
copy to tests/java-nobase.test
index a67b4e8..7b55290 100755
--- a/tests/java-check.test
+++ b/tests/java-nobase.test
@@ -14,53 +14,54 @@
 # 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 check_JAVA causes *.class files to be built only with
-# "make check", and not also with "make all".
-# See automake bug#8234.
+# Test support of `nobase_' with the `JAVA' primary.
 
 required=javac
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in << 'END'
+cat >>configure.in <<'END'
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-check_JAVA = One.java Two.java
-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
 
-cat > One.java <<'END'
-class One { }
-END
+# Java files are not distributed by default.
+EXTRA_DIST = sub/subsub/Foo.java
 
-cat > Two.java <<'END'
-class Two { // Deliberately missing closing bracket.
+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
 
-inst=`pwd`/_inst
-
-./configure --prefix="$inst"
-
-$MAKE
-ls | $EGREP '\.(class|stamp)$' && Exit 1
-
-# Make Two.java compilable.
-echo '}' >> Two.java
-
-# "make check" should compile files in $(check_JAVA) ...
+./configure --prefix="`pwd`"/_inst
 $MAKE check
-ls -l # for debugging
-test -f One.class
-test -f Two.class
-# ... but should *not* install them.
-$FGREP checkdir Makefile && Exit 1
 $MAKE install
-test -d _inst && Exit 1
+$MAKE test-install
+$MAKE distcheck
 
 :
diff --git a/tests/check-tests_environment.test b/tests/java-sources.test
similarity index 60%
copy from tests/check-tests_environment.test
copy to tests/java-sources.test
index a07ab95..770eb2d 100755
--- a/tests/check-tests_environment.test
+++ b/tests/java-sources.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/>.
 
-# "Simple Tests" testsuite driver: check TESTS_ENVIRONMENT support.
+# Test definition of automake-generated private Makefile variable
+# `$(am__java_sources)'.
 
 . ./defs || Exit 1
 
@@ -25,23 +26,42 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TESTS = foo.test
-EXTRA_DIST = $(TESTS)
-END
+foodir = $(prefix)
 
-cat > foo.test << 'END'
-#! /bin/sh
-test x"$FOO" = x"ok"
+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:
+       @echo 'am__java_sources: "$(am__java_sources)"'
+got:
+       @lst='$(am__java_sources)'; \
+         for f in $$lst; do echo $$f; done | sort > $@
 END
-chmod a+x foo.test
 
 $ACLOCAL
+$AUTOMAKE
 $AUTOCONF
-$AUTOMAKE -a
+
+cat > exp << 'END'
+a.java
+b.java
+c.java
+d.java
+e.java
+f.java
+END
 
 ./configure
+$MAKE debug
+$MAKE got
 
-FOO=bad TESTS_ENVIRONMENT='FOO=ok'  $MAKE check
-FOO=ok  TESTS_ENVIRONMENT='FOO=bad' $MAKE check && Exit 1
+cat got
+cat exp
+diff exp got
 
 :
diff --git a/tests/java.test b/tests/java.test
index cae56dc..4aa91d0 100755
--- a/tests/java.test
+++ b/tests/java.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2004, 2007, 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
@@ -25,7 +26,6 @@ cat >>configure.in <<'EOF'
 AC_OUTPUT
 EOF
 
-
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 dist_java_JAVA = a.java b.java
@@ -34,7 +34,10 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-grep '^all[-a-z]*:.*classdist_java\.stamp' Makefile.in
+
+$EGREP '\.stamp|class' Makefile.in # For debugging.
+grep '^all[-a-z]*:.*classjava\.stamp' Makefile.in
+test `grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in` -eq 1
 
 cat >a.java <<EOF
 class a
diff --git a/tests/nobase-nodist.test b/tests/nobase-nodist.test
new file mode 100644
index 0000000..90823e2
--- /dev/null
+++ b/tests/nobase-nodist.test
@@ -0,0 +1,62 @@
+#! /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/>.
+
+# Interaction of `nobase_' and `nodist_' prefixes.
+
+. ./defs || Exit 1
+
+set -e
+
+# Simulate no emacs and no python (it shouldn't be needed in this test).
+EMACS="no" PYTHON=":"; export EMCAS PYTHON
+
+cat >> configure.in << 'END'
+AM_PATH_LISPDIR
+AM_PATH_PYTHON([], [], [:])
+# Simulate no javac (it shouldn't be needed in this test).
+AC_SUBST([JAVAC], [false])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+nobase_nodist_noinst_PYTHON = baz1.py sub/baz2.py
+# Lisp and Java sources are not distributed by default, so try both
+# with and without the `nodist_' prefix, for more coverage.
+nobase_noinst_LISP = foo1.el sub/foo2.el
+nobase_nodist_noinst_LISP = foo3.el sub/foo4.el
+nobase_noinst_JAVA = bar1.java sub/bar2.java
+nobase_nodist_noinst_JAVA = bar3.java sub/bar4.java
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE distdir
+
+ls -l $distdir $distdir/* # For debugging.
+test ! -f $distdir/foo1.el
+test ! -f $distdir/sub/foo2.el
+test ! -f $distdir/foo3.el
+test ! -f $distdir/sub/foo4.el
+test ! -f $distdir/bar1.java
+test ! -f $distdir/sub/bar2.java
+test ! -f $distdir/bar3.java
+test ! -f $distdir/sub/bar4.java
+test ! -f $distdir/baz1.py
+test ! -f $distdir/sub/baz2.py
+
+:
diff --git a/tests/py-compile-basedir.test b/tests/py-compile-basedir.test
new file mode 100755
index 0000000..a277639
--- /dev/null
+++ b/tests/py-compile-basedir.test
@@ -0,0 +1,51 @@
+#! /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 the `--basedir' option of the `py-compile' script,
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+# We'll need to create files in `..', so we need one more subdirectory
+# level in order not to clutter up the top-level tests directory.
+mkdir sandbox
+cd sandbox
+
+cp "$testsrcdir/../lib/py-compile" .
+
+f=__init__
+for d in foo foo/bar "`pwd`/foo" . .. ../foo ''; do
+  if test -z "$d"; then
+    d2=.
+  else
+    d2=$d
+  fi
+  ../install-sh -d "$d2" "$d2/sub" || Exit 99
+  : > "$d2/$f.py"
+  : > "$d2/sub/$f.py"
+  ./py-compile --basedir "$d" "$f.py" "sub/$f.py"
+  ls -l "$d2" "$d2/sub" # For debugging.
+  test -f "$d2/$f.pyc"
+  test -f "$d2/$f.pyo"
+  test -f "$d2/sub/$f.pyc"
+  test -f "$d2/sub/$f.pyo"
+  rm -f "$d2/$f.pyc" "$d2/$f.pyo" "$d2/sub/$f.pyc" "$d2/sub/$f.pyo"
+  find . | grep '\.py[co]$' && Exit 1
+done
+
+:
diff --git a/tests/py-compile-basic.test b/tests/py-compile-basic.test
new file mode 100755
index 0000000..a7a3f89
--- /dev/null
+++ b/tests/py-compile-basic.test
@@ -0,0 +1,64 @@
+#! /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 more basic functionalities of the `py-compile' script,
+# with "believable" python sources.  See also related test
+# `py-compile-basic2.test'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+cat > foo.py <<'END'
+# Try out some non-trivial syntax in here.
+
+'''Module docstring'''
+
+def foo (*args, **kwargs):
+  """Function docstring
+  with embedded newline"""
+  return 1
+
+class Foo:
+  r"""Class docstring"""
+  def __init__(self):
+    r'''Method docstring
+        with
+        embedded
+        newlines'''
+    pass
+
+bar = baz = (1, (2,), [3, 4]); zardoz = 0;
+END
+
+cat > bar.py <<'END'
+# Import of non-existent modules, or assertion of false conditions,
+# shouldn't cause problems, as it should be enough for the code to
+# be syntactically correct.
+import Automake.No.Such.Module
+assert False
+END
+
+./py-compile foo.py bar.py
+test -f foo.pyc
+test -f foo.pyo
+test -f bar.pyc
+test -f bar.pyo
+
+:
diff --git a/tests/py-compile-basic2.test b/tests/py-compile-basic2.test
new file mode 100755
index 0000000..0da0d42
--- /dev/null
+++ b/tests/py-compile-basic2.test
@@ -0,0 +1,71 @@
+#! /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 more basic functionalities of the `py-compile' script, with
+# dummy python sources, but more complex directory layouts.  See also
+# related test `py-compile-basic.test'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 99
+
+pyfiles="
+  foo.py
+  ./foo1.py
+  ../foo2.py
+  ../dir/foo3.py
+  $ocwd/foo4.py
+  sub/bar.py
+  sub/subsub/barbar.py
+  __init__.py
+  sub/__init__.py
+  1.py
+  .././_.py
+"
+
+lst='
+  dir/foo
+  dir/foo1
+  foo2
+  dir/foo3
+  foo4
+  dir/sub/bar
+  dir/sub/subsub/barbar
+  dir/__init__
+  dir/sub/__init__
+  dir/1
+  _
+'
+
+mkdir dir
+cd dir
+cp "$testsrcdir/../lib/py-compile" .
+mkdir sub sub/subsub
+touch $pyfiles
+./py-compile $pyfiles
+cd "$ocwd"
+
+for x in $lst; do echo $x.pyc; echo $x.pyo; done | sort > exp
+find . -name '*.py[co]' | sed 's|^\./||' | sort > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/py-compile-destdir.test b/tests/py-compile-destdir.test
new file mode 100755
index 0000000..3d122e6
--- /dev/null
+++ b/tests/py-compile-destdir.test
@@ -0,0 +1,44 @@
+#! /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 the `--destdir' option of the `py-compile' script,
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+# Should not give false positives when grepping for it, so use
+# an "uncommon" string (with ugly CamelCase).
+destdir=TheDestDir
+
+mkdir sub $destdir $destdir/sub
+echo 'def foo (): return "foo"' > $destdir/foo.py
+echo 'def bar (): return "bar"' > $destdir/sub/bar.py
+
+./py-compile --destdir $destdir foo.py sub/bar.py
+ls -l $destdir $destdir/sub # For debugging.
+ls . sub | grep '\.py[co]$' && Exit 1
+test -f $destdir/foo.pyc
+test -f $destdir/foo.pyo
+test -f $destdir/sub/bar.pyc
+test -f $destdir/sub/bar.pyo
+strings $destdir/*.py[co] $destdir/sub/*.py[co] || : # For debugging.
+$FGREP $destdir $destdir/*.py[co] $destdir/sub/*.py[co] && Exit 1
+
+:
diff --git a/tests/check-exported-srcdir.test b/tests/py-compile-env.test
similarity index 50%
copy from tests/check-exported-srcdir.test
copy to tests/py-compile-env.test
index 5cec7fc..a72d173 100755
--- a/tests/check-exported-srcdir.test
+++ b/tests/py-compile-env.test
@@ -14,52 +14,47 @@
 # 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 testsuite driver (either with or without the
-# parallel-tests option enabled) exports the `srcdir' value in the
-# environment of the tests.  This is documented in the manual.
+# Make sure `py-compile' honours the PYTHON environment variable.
 
 . ./defs || Exit 1
 
 set -e
 
-show_info ()
-{
-  if test x"$parallel_tests" = x"yes"; then
-     cat foo.log
-     cat test-suite.log
-  else
-     :
-  fi
-}
+cp "$testsrcdir/../lib/py-compile" .
 
-mkdir SrcDir
-mv [!S]* SrcDir
-mkdir BuildDir
-cd SrcDir
-
-cat >> configure.in << 'END'
-AC_OUTPUT
+cat > my-py <<'END'
+#!/bin/sh
+: > my-py.run
 END
+chmod a+x my-py
 
-cat > Makefile.am << 'END'
-TESTS = foo.test
-END
+mkdir sub1
+cd sub1
 
-cat > foo.test <<'END'
-#!/bin/sh
-echo "foo.test: srcdir='$srcdir'"
-test x"$srcdir" = x"../SrcDir"
-END
-chmod a+x foo.test
+PYTHON=: ../py-compile foo.py
+ls | grep . && Exit 1
+
+PYTHON=false ../py-compile foo.py && Exit 1
+ls | grep . && Exit 1
+
+PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
+PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
+ls | grep . && Exit 1
 
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
+cd ..
+mkdir sub2
+cd sub2
 
-cd ../BuildDir
-../SrcDir/configure
+PYTHON=../my-py ../py-compile foo.py
+test -f my-py.run
+ls | grep -v '^my-py\.run$' | grep . && Exit 1
 
-$MAKE check || { show_info; Exit 1; }
-show_info
+cd ..
+mkdir sub3
+cd sub3
+PATH=..$PATH_SEPARATOR$PATH; export PATH
+PYTHON=my-py py-compile foo.py
+test -f my-py.run
+ls | grep -v '^my-py\.run$' | grep . && Exit 1
 
 :
diff --git a/tests/autodist-acconfig.test 
b/tests/py-compile-option-terminate.test
similarity index 60%
copy from tests/autodist-acconfig.test
copy to tests/py-compile-option-terminate.test
index 49ab2f0..69f9bb5 100755
--- a/tests/autodist-acconfig.test
+++ b/tests/py-compile-option-terminate.test
@@ -14,33 +14,31 @@
 # 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 `acconfig.h' is automatically distributed if it exists
-# (at automake runtime).
-# Related to automake bug#7819.
+# Check that a non-option argument and the `--' special argument
+# explicitly terminate the option list for `py-compile'.
 
+required=python
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in <<END
-AC_OUTPUT
-END
-
-cat > Makefile.am <<'END'
-.PHONY: test
-test: distdir
-       ls -l $(distdir)
-       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]acconfig\.h '
-       test -f $(distdir)/acconfig.h
-END
-
-: > acconfig.h
-
-$ACLOCAL
-$AUTOMAKE
-$AUTOCONF
-
-./configure
-$MAKE test
+cp "$testsrcdir/../lib/py-compile" .
+
+: > ./-o.py
+: > ./--foo.py
+./py-compile -- -o.py --foo.py
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
+rm -f ./-*.py[co]
+: > x.py
+./py-compile x.py -o.py --foo.py
+test -f ./x.pyc
+test -f ./x.pyo
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
 
 :
diff --git a/tests/py-compile-usage.test b/tests/py-compile-usage.test
new file mode 100755
index 0000000..7e8c786
--- /dev/null
+++ b/tests/py-compile-usage.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/>.
+
+# Test `py-compile --help', `py-compile --version', and that `py-compile'
+# correctly complains on wrong usage.
+
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+# --help
+
+./py-compile --help >stdout 2>stderr \
+  || { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout
+test -s stderr && { cat stderr >&2; Exit 1; }
+grep '^Usage: py-compile .' stdout
+$FGREP ' [--basedir DIR]' stdout
+$FGREP ' [--destdir DIR]' stdout
+
+# --version
+
+./py-compile --version >stdout 2>stderr \
+  || { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout
+test -s stderr && { cat stderr >&2; Exit 1; }
+year='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
+month='(0[0-9]|1[012])'
+day='([012][0-9]|3[01])'
+hour='([01][0-9]|2[0123])'
+LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
+test `wc -l <stdout` -eq 1
+
+# Unknown option.
+for opt in -b -d --foo; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: unrecognized option ['\`]$opt'" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+# Missing option argument.
+
+for opt in --basedir --destdir; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: option ['\`]$opt' requires an argument" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+# Missing files.
+
+for args in '' '--basedir dir' '--destdir dir'; do
+  ./py-compile $args 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep '^py-compile: no files given' stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]