Avoid generation of `tests/defs-p' file
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 4 Mar 2010 19:22:17 +0000 (20:22 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 5 Mar 2010 19:27:31 +0000 (20:27 +0100)
* tests/defs.in: In the generated `configure.in' snippet: call
`AM_INIT_AUTOMAKE' with the `parallel-tests' option if the shell
variable `parallel_tests' is set to `yes'.
* tests/Makefile.am (defs-p): Target removed.
(check_SCRIPTS): Removed `defs-p'.
(clean-local-check): Do not unlink `defs-p' anymore.
($(parallel_tests)): Transformation rules for the test scripts
adjusted.
* tests/gen-parallel-tests: Selection rules for the test
scripts adjusted.
* tests/parallel-tests.test: Set `$parallel_tests' to `yes'
then include `./defs' (rather than simply including `./defs-p').
* tests/parallel-tests2.test: Likewise.
* tests/parallel-tests3.test: Likewise.
* tests/parallel-tests4.test: Likewise.
* tests/parallel-tests5.test: Likewise.
* tests/parallel-tests6.test: Likewise.
* tests/parallel-tests7.test: Likewise.
* tests/parallel-tests8.test: Likewise.
* tests/parallel-tests9.test: Likewise.
* tests/parallel-tests10.test: Likewise.
* tests/README (Section "Writing Test Cases", subsection "Do"):
Adjusted the parts referring to tests checking `parallel-tests'
behaviour.  Some other minor related improvements.
* tests/.gitignore (defs-p): Removed.

17 files changed:
ChangeLog
tests/.gitignore
tests/Makefile.am
tests/Makefile.in
tests/README
tests/defs.in
tests/gen-parallel-tests
tests/parallel-tests.test
tests/parallel-tests10.test
tests/parallel-tests2.test
tests/parallel-tests3.test
tests/parallel-tests4.test
tests/parallel-tests5.test
tests/parallel-tests6.test
tests/parallel-tests7.test
tests/parallel-tests8.test
tests/parallel-tests9.test

index 84faddc..d198ee6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2010-03-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Avoid generation of `tests/defs-p' file.
+       * tests/defs.in: In the generated `configure.in' snippet: call
+       `AM_INIT_AUTOMAKE' with the `parallel-tests' option if the shell
+       variable `parallel_tests' is set to `yes'.
+       * tests/Makefile.am (defs-p): Target removed.
+       (check_SCRIPTS): Removed `defs-p'.
+       (clean-local-check): Do not unlink `defs-p' anymore.
+       ($(parallel_tests)): Transformation rules for the test scripts
+       adjusted.
+       * tests/gen-parallel-tests: Selection rules for the test
+       scripts adjusted.
+       * tests/parallel-tests.test: Set `$parallel_tests' to `yes'
+       then include `./defs' (rather than simply including `./defs-p').
+       * tests/parallel-tests2.test: Likewise.
+       * tests/parallel-tests3.test: Likewise.
+       * tests/parallel-tests4.test: Likewise.
+       * tests/parallel-tests5.test: Likewise.
+       * tests/parallel-tests6.test: Likewise.
+       * tests/parallel-tests7.test: Likewise.
+       * tests/parallel-tests8.test: Likewise.
+       * tests/parallel-tests9.test: Likewise.
+       * tests/parallel-tests10.test: Likewise.
+       * tests/README (Section "Writing Test Cases" subsection "Do"):
+       Adjusted the parts referring to tests checking `parallel-tests'
+       behaviour.  Some other minor related improvements.
+       * tests/.gitignore (defs-p): Removed.
+
 2010-03-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Remove redundant unset of variable TESTS from some test scripts.
index cfd4565..3c1f990 100644 (file)
@@ -1,7 +1,6 @@
 aclocal-*
 automake-*
 defs
-defs-p
 parallel-tests.am
 *.dir
 *.log
index 4b73a62..e721e66 100644 (file)
@@ -30,14 +30,12 @@ $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
 
 $(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
        input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
-       sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+       sed 's|^\. \./defs.*|parallel_tests=yes; &|' \
+         < $(srcdir)/$$input >$@
        chmod a+rx $@
 
 MAINTAINERCLEANFILES = $(parallel_tests)
 
-defs-p: defs Makefile.am
-       sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
-
 TESTS =        \
 aclibobj.test \
 aclocal.test \
@@ -765,7 +763,7 @@ $(parallel_tests)
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
 
 clean-local: clean-local-check
 .PHONY: clean-local-check
@@ -777,4 +775,3 @@ clean-local-check:
           find "$$@" -type d '!' -perm -200 -exec chmod u+w {} ';'; \
           rm -rf "$$@"; \
         fi;
-       -rm -f defs-p
index 709739e..682e137 100644 (file)
@@ -1000,7 +1000,7 @@ $(parallel_tests)
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
 all: all-am
 
 .SUFFIXES:
@@ -1355,12 +1355,10 @@ $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
 
 $(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
        input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
-       sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+       sed 's|^\. \./defs.*|parallel_tests=yes; &|' \
+         < $(srcdir)/$$input >$@
        chmod a+rx $@
 
-defs-p: defs Makefile.am
-       sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
-
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
@@ -1371,7 +1369,6 @@ clean-local-check:
           find "$$@" -type d '!' -perm -200 -exec chmod u+w {} ';'; \
           rm -rf "$$@"; \
         fi;
-       -rm -f defs-p
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
index 4068ad6..095d176 100644 (file)
@@ -95,12 +95,13 @@ Do
 
   Use `required=...' for required tools.
 
-  Include ./defs (see other tests) for normal tests, ./defs-p for tests
-  that use the `parallel-tests' option.  For the latter, use a name that
-  ends in `-p.test' and does not clash with any generated tests in the
-  suite.
+  Include ./defs in every test script (see existing tests for examples
+  of how to do this).
 
-  Use `set -e' to catch failures you might not have thought of.
+  For tests that use the `parallel-tests' Automake option, set the shell
+  variable `parallel_tests' to "yes" before including ./defs.  Also,
+  use for them a name that ends in `-p.test' and does not clash with any
+  generated tests in the suite.
 
   ./defs sets a skeleton configure.in.  If possible, append to this
   file.  In some cases you'll have to overwrite it, but this should
@@ -108,6 +109,8 @@ Do
   but do not output anything by default.  If you need ./configure
   to create Makefile, append AC_OUTPUT to configure.in.
 
+  Use `set -e' to catch failures you might not have thought of.
+
   Use $ACLOCAL, $AUTOMAKE, $AUTOCONF, $AUTOUPDATE, $AUTOHEADER,
   $PERL, $MAKE, $EGREP, and $FGREP, instead of the corresponding
   commands.
index ecdf069..18f2aeb 100644 (file)
@@ -287,11 +287,15 @@ cd ./$testSubDir
 # Don't use AC_OUTPUT, but AC_CONFIG_FILES so that appending
 # still produces a valid configure.ac.  But then, tests running
 # config.status really need to append AC_OUTPUT.
-cat > configure.in << END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
-END
+{
+  echo "AC_INIT([$me], [1.0])"
+  if test x"$parallel_tests" = x"yes"; then
+    echo "AM_INIT_AUTOMAKE([parallel-tests])"
+  else
+    echo "AM_INIT_AUTOMAKE"
+  fi
+  echo "AC_CONFIG_FILES([Makefile])"
+} >configure.in
 
 # Unset some MAKE... variables that may cause $MAKE to act like a
 # recursively invoked sub-make.  Any $MAKE invocation in a test is
index 4a71a73..39f5d1e 100755 (executable)
@@ -1,6 +1,21 @@
 #! /bin/sh
 # Generate parallel-tests.am.
 #
+# Copyright (C) 2009, 2010  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/>.
+
 # For each test in the TESTS list in this Makefile.am file, that itself
 # tests features of the TESTS automake interface, generate a sibling
 # test that does likewise, but with the option `parallel-tests' enabled.
@@ -16,7 +31,8 @@ grep -v '.-p\.test' |
 LC_ALL=C sort -u |
 while read tst; do
   if grep '^[^#]*parallel-tests' $tst >/dev/null \
-     || grep '^\. \./defs-p' $tst >/dev/null
+     || grep "parallel_tests=yes" $tst >/dev/null \
+     || grep "parallel_tests=['\"]yes" $tst >/dev/null
   then :; else echo $tst; fi;
 done |
 {
index 97e27b1..29111c2 100755 (executable)
@@ -24,7 +24,8 @@
 # - TEST_LOGS
 # - RECHECK_LOGS
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 
 set -e
 
index 2642c7a..5cd3310 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010  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
@@ -18,7 +18,8 @@
 # - trailing whitespace in TESTS
 # GNU make 3.80 may expand trailing white space to `.log'.
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 set -e
 
 cat >> configure.in << 'END'
index 5101e47..9cfe14f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010  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
@@ -18,8 +18,9 @@
 # - check-html
 # - recheck-html
 
+parallel_tests=yes
 required=rst2html
-. ./defs-p || Exit 1
+. ./defs || Exit 1
 
 set -e
 
index e1cbe9f..a138f90 100755 (executable)
@@ -17,8 +17,9 @@
 # Check parallel-tests features:
 # - concurrent parallel execution
 
+parallel_tests=yes
 required=GNUmake
-. ./defs-p || Exit 1
+. ./defs || Exit 1
 
 # This test does not work well if $MAKE contains -j.
 case $MAKE in
index f48da5e..efe7e8d 100755 (executable)
@@ -17,7 +17,8 @@
 # Check parallel-tests features:
 # - suffix rules
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 set -e
 
 cat >> configure.in << 'END'
index 6db5db6..c4ff5b9 100755 (executable)
@@ -20,8 +20,9 @@
 # Actually, this test doesn't ensure that things happen concurrently.
 # It merely serves as demonstration.  :-)
 
+parallel_tests=yes
 required=GNUmake
-. ./defs-p || Exit 1
+. ./defs || Exit 1
 
 set -e
 
index 7ed7ad6..44caf0c 100755 (executable)
@@ -19,7 +19,8 @@
 # BSD make will expand `$(TESTS:=.log)' to `.log' unless overridden.
 # See parallel-tests10.test for a similar issue.
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 set -e
 
 cat >> configure.in << 'END'
index 2432c88..d01ada1 100755 (executable)
@@ -17,7 +17,8 @@
 # Check parallel-tests features:
 # - per-extension test drivers
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 set -e
 
 cat >> configure.in << 'END'
index 2c27064..784e07f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010  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,7 +24,8 @@
 #       manual for the ugliness in this area, when VPATH comes into
 #       play.  :-/
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 
 set -e
 
index 300a2f0..337328f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010  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
@@ -17,7 +17,8 @@
 # Check parallel-tests features:
 # - recheck
 
-. ./defs-p || Exit 1
+parallel_tests=yes
+. ./defs || Exit 1
 
 set -e