[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BIKESHEDDING PATCH] Avoid generation of `tests/defs-p' file
From: |
Stefano Lattarini |
Subject: |
[BIKESHEDDING PATCH] Avoid generation of `tests/defs-p' file |
Date: |
Thu, 4 Mar 2010 20:22:17 +0100 |
User-agent: |
KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.2; i686; ; ) |
Hello automakers.
Here I propose a simple patch which tweaks the part of the testsuite
dealing with the `parallel-tests' Automake option. Specifically, the
patch aims to get rid of the `tests/defs-p' file.
I always disliked the creation and use of the `defs-p' file (which
differs from the `defs' file *for just one line*). It adds another IMHO
useless level of indirection, and another generated file to keep track
of, just to do something that could be done equally well by making the
`defs' file a tiny bit more configurable (which is what I do in this
patch). By the way, since `defs' already offers some degree of
configurability through the use of the `$required' variable, I'm not
adding any new convention here, just extending an existing one.
This patch is admittedly mostly bikeshedding, but I hope you'll find it
useful anyway.
Regards,
Stefano
From 5ce7a69690b5a0c5d1bd0a78a5f50b3a26e5709a Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 3 Mar 2010 16:39:40 +0100
Subject: [PATCH] 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 `am_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 `$am_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.
---
ChangeLog | 29 +++++++++++++++++++++++++++++
tests/.gitignore | 1 -
tests/Makefile.am | 9 +++------
tests/Makefile.in | 9 +++------
tests/README | 13 ++++++++-----
tests/defs.in | 14 +++++++++-----
tests/gen-parallel-tests | 5 ++++-
tests/parallel-tests.test | 3 ++-
tests/parallel-tests10.test | 3 ++-
tests/parallel-tests2.test | 3 ++-
tests/parallel-tests3.test | 3 ++-
tests/parallel-tests4.test | 3 ++-
tests/parallel-tests5.test | 3 ++-
tests/parallel-tests6.test | 3 ++-
tests/parallel-tests7.test | 3 ++-
tests/parallel-tests8.test | 3 ++-
tests/parallel-tests9.test | 3 ++-
17 files changed, 76 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5fbc889..d567aed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2010-03-03 Stefano Lattarini <address@hidden>
+
+ 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 `am_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 `$am_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-02-24 Antonio Diaz Diaz <address@hidden> (tiny change)
Ralf Wildenhues <address@hidden>
diff --git a/tests/.gitignore b/tests/.gitignore
index cfd4565..3c1f990 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,7 +1,6 @@
aclocal-*
automake-*
defs
-defs-p
parallel-tests.am
*.dir
*.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9d99d3a..0bf22ea 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,14 +30,12 @@ $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
$(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
- sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+ sed 's|^\. \./defs.*|am_parallel_tests=yes; &|' \
+ < $(srcdir)/$$input >$@
$(AM_V_at)chmod a+rx $@
MAINTAINERCLEANFILES = $(parallel_tests)
-defs-p: defs Makefile.am
- $(AM_V_GEN)sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
-
TESTS = \
aclibobj.test \
aclocal.test \
@@ -777,7 +775,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
@@ -789,4 +787,3 @@ clean-local-check:
find "$$@" -type d '!' -perm -200 -exec chmod u+w {} ';'; \
rm -rf "$$@"; \
fi;
- -rm -f defs-p
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a2d2931..b31d9b1 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1019,7 +1019,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:
@@ -1376,12 +1376,10 @@ $(srcdir)/parallel-tests.am: gen-parallel-tests
Makefile.am
$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
$(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
- sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+ sed 's|^\. \./defs.*|am_parallel_tests=yes; &|' \
+ < $(srcdir)/$$input >$@
$(AM_V_at)chmod a+rx $@
-defs-p: defs Makefile.am
- $(AM_V_GEN)sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
-
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
@@ -1392,7 +1390,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.
diff --git a/tests/README b/tests/README
index d494b10..7845e7e 100644
--- a/tests/README
+++ b/tests/README
@@ -113,12 +113,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 `am_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
@@ -126,6 +127,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.
diff --git a/tests/defs.in b/tests/defs.in
index 6eec344..a986aef 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -291,11 +291,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"${am_parallel_tests-no}" = 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
diff --git a/tests/gen-parallel-tests b/tests/gen-parallel-tests
index 4a71a73..835eae8 100755
--- a/tests/gen-parallel-tests
+++ b/tests/gen-parallel-tests
@@ -16,7 +16,10 @@ 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 "am_parallel_tests=yes" $tst >/dev/null \
+ || grep "am_parallel_tests=['\"]yes" $tst >/dev/null
+ # note: autoconf manual says `\?' in grep regexp is not portable, so
+ # the repetition above is required
then :; else echo $tst; fi;
done |
{
diff --git a/tests/parallel-tests.test b/tests/parallel-tests.test
index 385cef3..3bc375a 100755
--- a/tests/parallel-tests.test
+++ b/tests/parallel-tests.test
@@ -24,7 +24,8 @@
# - TEST_LOGS
# - RECHECK_LOGS
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
diff --git a/tests/parallel-tests10.test b/tests/parallel-tests10.test
index 2642c7a..69f3432 100755
--- a/tests/parallel-tests10.test
+++ b/tests/parallel-tests10.test
@@ -18,7 +18,8 @@
# - trailing whitespace in TESTS
# GNU make 3.80 may expand trailing white space to `.log'.
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test
index 5101e47..6d399b9 100755
--- a/tests/parallel-tests2.test
+++ b/tests/parallel-tests2.test
@@ -18,8 +18,9 @@
# - check-html
# - recheck-html
+am_parallel_tests=yes
required=rst2html
-. ./defs-p || Exit 1
+. ./defs || Exit 1
set -e
diff --git a/tests/parallel-tests3.test b/tests/parallel-tests3.test
index d631d67..1e39784 100755
--- a/tests/parallel-tests3.test
+++ b/tests/parallel-tests3.test
@@ -17,8 +17,9 @@
# Check parallel-tests features:
# - concurrent parallel execution
+am_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
diff --git a/tests/parallel-tests4.test b/tests/parallel-tests4.test
index d842486..5bcc7a9 100755
--- a/tests/parallel-tests4.test
+++ b/tests/parallel-tests4.test
@@ -17,7 +17,8 @@
# Check parallel-tests features:
# - suffix rules
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
diff --git a/tests/parallel-tests5.test b/tests/parallel-tests5.test
index a7bbc9e..006d2f5 100755
--- a/tests/parallel-tests5.test
+++ b/tests/parallel-tests5.test
@@ -20,8 +20,9 @@
# Actually, this test doesn't ensure that things happen concurrently.
# It merely serves as demonstration. :-)
+am_parallel_tests=yes
required=GNUmake
-. ./defs-p || Exit 1
+. ./defs || Exit 1
set -e
diff --git a/tests/parallel-tests6.test b/tests/parallel-tests6.test
index 5dbb433..28fac46 100755
--- a/tests/parallel-tests6.test
+++ b/tests/parallel-tests6.test
@@ -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
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
diff --git a/tests/parallel-tests7.test b/tests/parallel-tests7.test
index c2ae63a..7f49781 100755
--- a/tests/parallel-tests7.test
+++ b/tests/parallel-tests7.test
@@ -17,7 +17,8 @@
# Check parallel-tests features:
# - per-extension test drivers
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
diff --git a/tests/parallel-tests8.test b/tests/parallel-tests8.test
index 2c27064..2195862 100755
--- a/tests/parallel-tests8.test
+++ b/tests/parallel-tests8.test
@@ -24,7 +24,8 @@
# manual for the ugliness in this area, when VPATH comes into
# play. :-/
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
diff --git a/tests/parallel-tests9.test b/tests/parallel-tests9.test
index 300a2f0..6d5c21f 100755
--- a/tests/parallel-tests9.test
+++ b/tests/parallel-tests9.test
@@ -17,7 +17,8 @@
# Check parallel-tests features:
# - recheck
-. ./defs-p || Exit 1
+am_parallel_tests=yes
+. ./defs || Exit 1
set -e
--
1.6.5
- [BIKESHEDDING PATCH] Avoid generation of `tests/defs-p' file,
Stefano Lattarini <=