Reference: <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00112.html>
On Sunday 17 April 2011, Stefano Lattarini wrote: > Reference: > <http://lists.gnu.org/archive/html/automake-patches/2011-02/msg00044.html> > > On Wednesday 16 February 2011, Stefano Lattarini wrote: > > Hello automakers. > > > > Recently, I've looked again into the `instspc*.test' tests (for more info: > > <http://lists.gnu.org/archive/html/automake-patches/2011-02/msg00036.html>). > > While doing so, I've come to realize that we don't really need to generate > > tons and tons of wrapper test scripts (presently, ~ 90) just to run what is > > basically a single test (specifically, `instspc-tests.sh') with different > > parameters. In fact, the possibility of running a single driver script > > with multiple files/configurations/parameters is one of the major selling > > points of the 'parallel-tests' testsuite driver of automake. So why not > > use ourselves more extensively the best features we provide? > > > > I'll soon post a two-patches series implementing this idea (note that the > > first one is just a preparatory patch that makes sense only in view of > > the second one). The patches has been tested with in-tree and VPATH > > builds, with various shells (pdksh, mksh, older bash and ash versions, > > Solaris 10 /bin/sh and /bin/ksh) and various make implementations (Debian > > ports of FreeBSD and NetBSD make, GNU make versions from 3.79 to 3.82, > > Heirloom make, and Solaris 10 dmake, CCS make and XPG4 make). > > > > Regards, > > Stefano > > > Ping on this? I'll push in 72 hours if there's no review by then. > > Regards, > Stefano > I've rebased the patches against the 'testsuite-work' branch, fixed a couple of buglets and warts, extended the explanations in the ChangeLog and pushed. The updated patches are attached, for reference. Regards, Stefano
From 6b7d31cec24b71073920bda28ec5977bed6b8e46 Mon Sep 17 00:00:00 2001 Message-Id: <6b7d31cec24b71073920bda28ec5977bed6b8e46.1304265895.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Wed, 16 Feb 2011 13:46:33 +0100 Subject: [PATCH 1/2] build: improve the definition of the list of testcases * tests/Makefile.am (handwritten_tests): New variable. (generated_tests): Likewise. (TESTS): Redefine as the union of the above. (EXTRA_DIST): Extend using $(handwritten_tests) and $(generated_tests) rather than $(TESTS). * tests/gen-parallel-tests: Update accordingly, and make more robust. --- ChangeLog | 11 +++++++++++ tests/Makefile.am | 15 ++++++++------- tests/Makefile.in | 10 +++++----- tests/gen-parallel-tests | 10 ++++++++-- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0851b77..028e905 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-05-01 Stefano Lattarini <stefano.lattar...@gmail.com> + build: improve the definition of the list of testcases + * tests/Makefile.am (handwritten_tests): New variable. + (generated_tests): Likewise. + (TESTS): Redefine as the union of the above. + (EXTRA_DIST): Extend using $(handwritten_tests) and + $(generated_tests) rather than $(TESTS). + * tests/gen-parallel-tests: Update accordingly, and + make more robust. + +2011-05-01 Stefano Lattarini <stefano.lattar...@gmail.com> + tests skips: shorter and clearer messages * tests/defs: Use shorter messages when giving reasons for test skipping; it turns out these shorter messages are also clearer. diff --git a/tests/Makefile.am b/tests/Makefile.am index edb516b..12b1c59 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -110,7 +110,13 @@ AM_TESTS_ENVIRONMENT = \ test x"$$original_ACLOCAL" = x || unset original_ACLOCAL; \ exec 9>&2; stderr_fileno_=9; export stderr_fileno_; -TESTS = \ +TESTS = $(handwritten_tests) $(generated_tests) + +EXTRA_DIST += $(handwritten_tests) $(generated_tests) + +generated_tests = $(parallel_tests) $(instspc_tests) + +handwritten_tests = \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -529,7 +535,6 @@ instmany.test \ instmany-mans.test \ instmany-python.test \ instspc-data.test \ -$(instspc_tests) \ interp.test \ interp2.test \ java.test \ @@ -1043,11 +1048,7 @@ yflags-conditional.test \ yflags-d-false-positives.test \ yflags-force-override.test \ yflags-force-conditional.test \ -yflags-var-expand.test \ -$(parallel_tests) - -EXTRA_DIST += $(TESTS) - +yflags-var-expand.test # Each test case depends on defs, aclocal, and automake. $(TEST_LOGS): defs aclocal-$(APIVERSION) automake-$(APIVERSION) diff --git a/tests/Makefile.in b/tests/Makefile.in index 5b1fd31..84a1b72 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -286,7 +286,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests) EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \ - $(TESTS) + $(handwritten_tests) $(generated_tests) XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \ override-conditional-2.test pr8365-remake-timing.test \ yacc-dist-nobuild-subdir.test txinfo5.test \ @@ -375,7 +375,9 @@ AM_TESTS_ENVIRONMENT = \ test x"$$original_ACLOCAL" = x || unset original_ACLOCAL; \ exec 9>&2; stderr_fileno_=9; export stderr_fileno_; -TESTS = \ +TESTS = $(handwritten_tests) $(generated_tests) +generated_tests = $(parallel_tests) $(instspc_tests) +handwritten_tests = \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -794,7 +796,6 @@ instmany.test \ instmany-mans.test \ instmany-python.test \ instspc-data.test \ -$(instspc_tests) \ interp.test \ interp2.test \ java.test \ @@ -1308,8 +1309,7 @@ yflags-conditional.test \ yflags-d-false-positives.test \ yflags-force-override.test \ yflags-force-conditional.test \ -yflags-var-expand.test \ -$(parallel_tests) +yflags-var-expand.test all: all-am diff --git a/tests/gen-parallel-tests b/tests/gen-parallel-tests index d2a5c13..20b9ee1 100755 --- a/tests/gen-parallel-tests +++ b/tests/gen-parallel-tests @@ -1,7 +1,7 @@ #! /bin/sh # Generate parallel-tests.am. # -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2009, 2010, 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 @@ -22,7 +22,13 @@ set -e -tests=`sed -n '/^TESTS =/,/^$/s/\(.*\.test\).*/\1/p' Makefile.am` +tests=`sed -n '/^handwritten_tests =/,/^$/s/\(.*\.test\).*/\1/p' Makefile.am` + +if test -z "$tests"; then + echo "$0: failed to obtain list of tests" >&2 + exit 1 +fi + { grep -l '^TESTS ' $tests grep -l ' TESTS ' $tests -- 1.7.2.3
From c348cde4decb1f22a2305742cadafcaf0dd70d63 Mon Sep 17 00:00:00 2001 Message-Id: <c348cde4decb1f22a2305742cadafcaf0dd70d63.1304265895.git.stefano.lattar...@gmail.com> In-Reply-To: <6b7d31cec24b71073920bda28ec5977bed6b8e46.1304265895.git.stefano.lattar...@gmail.com> References: <6b7d31cec24b71073920bda28ec5977bed6b8e46.1304265895.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Wed, 16 Feb 2011 13:46:33 +0100 Subject: [PATCH 2/2] tests: avoid extra test generation (for `instspc' tests) We don't really need to generate tons and tons of wrapper test scripts (presently, ~ 90) just to run what is basically a single test (specifically, `instspc-tests.sh') with different parameters. In fact, the possibility of running a single driver script with multiple files/configurations/parameters is one of the major selling points of the 'parallel-tests' testsuite driver of automake. So why not use ourselves more extensively the best features we provide? * tests/instspc-tests.sh: Update heading comments. Expect to be executed, not sourced. Update handling of command-line arguments. Adjust to reflect the renaming of "instspc tests" from `instspc-*.test' to `*.instspc'. * tests/instspc-data.test: Update heading comments. Execute driver script `instspc-tests.sh', instead of sourcing it. Give more informative messages in case of internal errors. * tests/Makefile.am (TESTS_EXTENSIONS): Define explicitly (to `.test' and `.instspc'). (TESTS): Add `$(instspc_tests)'. (generated_tests): Remove `$(instspc_tests)'. (INSTSPC_LOG_COMPILER): Define. Calls `instspc-tests.sh', so that the "instspc tests" will be now executed by passing that driver script a proper parameter. ($(instspc_tests)): Remove, we don't need anymore to generate this tests. ($(instspc_tests:.test=.log)): Remove, substituted by ... ($(instspc_tests:.instspc=.log)): ... this. ($(instspc_tests)): New dependency declaration (dummy, but required in order to have make actually produce expected log files from the `.instspc.log' suffix rule). (MAINTAINERCLEANFILES, generated_tests): Don't extend with $(instspc_tests) anymore. Update comments. --- ChangeLog | 36 ++++++++++ tests/Makefile.am | 42 ++++-------- tests/Makefile.in | 166 +++++++++++++++++++++-------------------------- tests/instspc-data.test | 15 +++-- tests/instspc-tests.sh | 73 ++++++++++----------- 5 files changed, 169 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 028e905..b91c764 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,41 @@ 2011-05-01 Stefano Lattarini <stefano.lattar...@gmail.com> + tests: avoid extra test generation (for `instspc' tests) + We don't really need to generate tons and tons of wrapper test + scripts (presently, ~ 90) just to run what is basically a single + test (specifically, `instspc-tests.sh') with different parameters. + In fact, the possibility of running a single driver script with + multiple files/configurations/parameters is one of the major + selling points of the 'parallel-tests' testsuite driver of + automake. So why not use ourselves more extensively the best + features we provide? + * tests/instspc-tests.sh: Update heading comments. Expect + to be executed, not sourced. Update handling of command-line + arguments. Adjust to reflect the renaming of "instspc tests" + from `instspc-*.test' to `*.instspc'. + * tests/instspc-data.test: Update heading comments. Execute + driver script `instspc-tests.sh', instead of sourcing it. + Give more informative messages in case of internal errors. + * tests/Makefile.am (TESTS_EXTENSIONS): Define explicitly (to + `.test' and `.instspc'). + (TESTS): Add `$(instspc_tests)'. + (generated_tests): Remove `$(instspc_tests)'. + (INSTSPC_LOG_COMPILER): Define. Calls `instspc-tests.sh', so + that the "instspc tests" will be now executed by passing that + driver script a proper parameter. + ($(instspc_tests)): Remove, we don't need anymore to generate + this tests. + ($(instspc_tests:.test=.log)): Remove, substituted by ... + ($(instspc_tests:.instspc=.log)): ... this. + ($(instspc_tests)): New dependency declaration (dummy, but + required in order to have make actually produce expected log + files from the `.instspc.log' suffix rule). + (MAINTAINERCLEANFILES, generated_tests): Don't extend with + $(instspc_tests) anymore. + Update comments. + +2011-05-01 Stefano Lattarini <stefano.lattar...@gmail.com> + build: improve the definition of the list of testcases * tests/Makefile.am (handwritten_tests): New variable. (generated_tests): Likewise. diff --git a/tests/Makefile.am b/tests/Makefile.am index 12b1c59..a5c5a63 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -18,6 +18,7 @@ MAINTAINERCLEANFILES = EXTRA_DIST = ChangeLog-old +TEST_EXTENSIONS = .test .instspc XFAIL_TESTS = \ all.test \ @@ -63,37 +64,21 @@ EXTRA_DIST += gen-parallel-tests include $(srcdir)/instspc-tests.am +INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh + $(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am $(AM_V_GEN)($(am__cd) $(srcdir) \ && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ -$(instspc_tests): Makefile.am - $(AM_V_at)rm -f $@ $@-t - $(AM_V_GEN) :; \ - base=`expr 'x/$@' : 'x.*/instspc-\(.*\)\.test$$'`; \ - name=`expr x"$$base" : x'\(.*\)-'`; \ - action=`expr x"$$base" : x'.*-\(.*\)'`; \ - { \ - echo '#!/bin/sh'; \ - echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ - echo; \ - echo '# Ensure proper definition of $$testsrcdir.'; \ - echo '. ./defs-static || exit 99'; \ - echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ - echo; \ - echo "instspc_test_name='$$name'"; \ - echo "instspc_action='test-$$action'"; \ - echo ". \$$testsrcdir/instspc-tests.sh"; \ - } > $@-t - $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ - -# All instspc-*.test tests work by sourcing the `instspc-tests.sh' -# script. Also, they all use shared data generated by the helper -# test `instspc-data.test', for reasons of speed. +# All `*.instspc' tests work by calling the script `instspc-tests.sh'. +# Also, they all use shared data generated by the `instspc-data.test' +# helper test (for reasons of speed). instspc-data.log: instspc-tests.sh -$(instspc_tests:.test=.log): instspc-tests.sh instspc-data.log +$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log +# This dummy declaration is required to have make actually produce +# expected log files from the `.instspc.log' suffix rule. +$(instspc_tests): -MAINTAINERCLEANFILES += $(instspc_tests) EXTRA_DIST += instspc-tests.sh XFAIL_TESTS += $(instspc_xfail_tests) @@ -110,11 +95,14 @@ AM_TESTS_ENVIRONMENT = \ test x"$$original_ACLOCAL" = x || unset original_ACLOCAL; \ exec 9>&2; stderr_fileno_=9; export stderr_fileno_; -TESTS = $(handwritten_tests) $(generated_tests) +TESTS = \ + $(handwritten_tests) \ + $(generated_tests) \ + $(instspc_tests) EXTRA_DIST += $(handwritten_tests) $(generated_tests) -generated_tests = $(parallel_tests) $(instspc_tests) +generated_tests = $(parallel_tests) handwritten_tests = \ aclocal.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 84a1b72..8288973 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -186,11 +186,13 @@ RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check check-html recheck recheck-html TEST_SUITE_LOG = test-suite.log TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) -TEST_EXTENSIONS = .test am__test_logs1 = $(TESTS:=.log) -TEST_LOGS = $(am__test_logs1:.test.log=.log) +am__test_logs2 = $(am__test_logs1:.test.log=.log) TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) +TEST_LOGS = $(am__test_logs2:.instspc.log=.log) +INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \ + $(INSTSPC_LOG_FLAGS) TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -284,9 +286,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests) +MAINTAINERCLEANFILES = $(parallel_tests) EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \ $(handwritten_tests) $(generated_tests) +TEST_EXTENSIONS = .test .instspc XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \ override-conditional-2.test pr8365-remake-timing.test \ yacc-dist-nobuild-subdir.test txinfo5.test \ @@ -300,68 +303,58 @@ parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \ exeext4-p.test maken3-p.test maken4-p.test \ posixsubst-tests-p.test pr401-p.test pr401b-p.test \ pr401c-p.test -instspc_tests = instspc-squote-build.test instspc-squote-install.test \ - instspc-dquote-build.test instspc-dquote-install.test \ - instspc-bquote-build.test instspc-bquote-install.test \ - instspc-sharp-build.test instspc-sharp-install.test \ - instspc-dollar-build.test instspc-dollar-install.test \ - instspc-bang-build.test instspc-bang-install.test \ - instspc-bslash-build.test instspc-bslash-install.test \ - instspc-ampersand-build.test instspc-ampersand-install.test \ - instspc-percent-build.test instspc-percent-install.test \ - instspc-leftpar-build.test instspc-leftpar-install.test \ - instspc-rightpar-build.test instspc-rightpar-install.test \ - instspc-pipe-build.test instspc-pipe-install.test \ - instspc-caret-build.test instspc-caret-install.test \ - instspc-tilde-build.test instspc-tilde-install.test \ - instspc-qmark-build.test instspc-qmark-install.test \ - instspc-star-build.test instspc-star-install.test \ - instspc-plus-build.test instspc-plus-install.test \ - instspc-minus-build.test instspc-minus-install.test \ - instspc-comma-build.test instspc-comma-install.test \ - instspc-colon-build.test instspc-colon-install.test \ - instspc-semicol-build.test instspc-semicol-install.test \ - instspc-equal-build.test instspc-equal-install.test \ - instspc-less-build.test instspc-less-install.test \ - instspc-more-build.test instspc-more-install.test \ - instspc-at-build.test instspc-at-install.test \ - instspc-lqbrack-build.test instspc-lqbrack-install.test \ - instspc-rqbrack-build.test instspc-rqbrack-install.test \ - instspc-lcbrack-build.test instspc-lcbrack-install.test \ - instspc-rcbrack-build.test instspc-rcbrack-install.test \ - instspc-space-build.test instspc-space-install.test \ - instspc-tab-build.test instspc-tab-install.test \ - instspc-linefeed-build.test instspc-linefeed-install.test \ - instspc-backspace-build.test instspc-backspace-install.test \ - instspc-formfeed-build.test instspc-formfeed-install.test \ - instspc-carriageret-build.test \ - instspc-carriageret-install.test \ - instspc-quadrigraph0-build.test \ - instspc-quadrigraph0-install.test \ - instspc-quadrigraph1-build.test \ - instspc-quadrigraph1-install.test \ - instspc-quadrigraph2-build.test \ - instspc-quadrigraph2-install.test \ - instspc-quadrigraph3-build.test \ - instspc-quadrigraph3-install.test \ - instspc-quadrigraph4-build.test \ - instspc-quadrigraph4-install.test instspc-a_b-build.test \ - instspc-a_b-install.test instspc-a__b-build.test \ - instspc-a__b-install.test instspc-a_lf_b-build.test \ - instspc-a_lf_b-install.test instspc-dotdotdot-build.test \ - instspc-dotdotdot-install.test instspc-dosdrive-build.test \ - instspc-dosdrive-install.test instspc-miscglob1-build.test \ - instspc-miscglob1-install.test instspc-miscglob2-build.test \ - instspc-miscglob2-install.test -instspc_xfail_tests = instspc-squote-build.test \ - instspc-dquote-build.test instspc-bquote-build.test \ - instspc-sharp-build.test instspc-dollar-build.test \ - instspc-bslash-build.test instspc-ampersand-build.test \ - instspc-linefeed-build.test instspc-quadrigraph0-build.test \ - instspc-a_lf_b-build.test instspc-squote-install.test \ - instspc-dquote-install.test instspc-bquote-install.test \ - instspc-sharp-install.test instspc-dollar-install.test \ - instspc-linefeed-install.test instspc-a_lf_b-install.test +instspc_tests = build-squote.instspc install-squote.instspc \ + build-dquote.instspc install-dquote.instspc \ + build-bquote.instspc install-bquote.instspc \ + build-sharp.instspc install-sharp.instspc build-dollar.instspc \ + install-dollar.instspc build-bang.instspc install-bang.instspc \ + build-bslash.instspc install-bslash.instspc \ + build-ampersand.instspc install-ampersand.instspc \ + build-percent.instspc install-percent.instspc \ + build-leftpar.instspc install-leftpar.instspc \ + build-rightpar.instspc install-rightpar.instspc \ + build-pipe.instspc install-pipe.instspc build-caret.instspc \ + install-caret.instspc build-tilde.instspc \ + install-tilde.instspc build-qmark.instspc \ + install-qmark.instspc build-star.instspc install-star.instspc \ + build-plus.instspc install-plus.instspc build-minus.instspc \ + install-minus.instspc build-comma.instspc \ + install-comma.instspc build-colon.instspc \ + install-colon.instspc build-semicol.instspc \ + install-semicol.instspc build-equal.instspc \ + install-equal.instspc build-less.instspc install-less.instspc \ + build-more.instspc install-more.instspc build-at.instspc \ + install-at.instspc build-lqbrack.instspc \ + install-lqbrack.instspc build-rqbrack.instspc \ + install-rqbrack.instspc build-lcbrack.instspc \ + install-lcbrack.instspc build-rcbrack.instspc \ + install-rcbrack.instspc build-space.instspc \ + install-space.instspc build-tab.instspc install-tab.instspc \ + build-linefeed.instspc install-linefeed.instspc \ + build-backspace.instspc install-backspace.instspc \ + build-formfeed.instspc install-formfeed.instspc \ + build-carriageret.instspc install-carriageret.instspc \ + build-quadrigraph0.instspc install-quadrigraph0.instspc \ + build-quadrigraph1.instspc install-quadrigraph1.instspc \ + build-quadrigraph2.instspc install-quadrigraph2.instspc \ + build-quadrigraph3.instspc install-quadrigraph3.instspc \ + build-quadrigraph4.instspc install-quadrigraph4.instspc \ + build-a_b.instspc install-a_b.instspc build-a__b.instspc \ + install-a__b.instspc build-a_lf_b.instspc \ + install-a_lf_b.instspc build-dotdotdot.instspc \ + install-dotdotdot.instspc build-dosdrive.instspc \ + install-dosdrive.instspc build-miscglob1.instspc \ + install-miscglob1.instspc build-miscglob2.instspc \ + install-miscglob2.instspc +instspc_xfail_tests = build-squote.instspc build-dquote.instspc \ + build-bquote.instspc build-sharp.instspc build-dollar.instspc \ + build-bslash.instspc build-ampersand.instspc \ + build-linefeed.instspc build-quadrigraph0.instspc \ + build-a_lf_b.instspc install-squote.instspc \ + install-dquote.instspc install-bquote.instspc \ + install-sharp.instspc install-dollar.instspc \ + install-linefeed.instspc install-a_lf_b.instspc +INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh # Some testsuite-influential variables should be overridable from the # test scripts, but not from the environment. @@ -375,8 +368,12 @@ AM_TESTS_ENVIRONMENT = \ test x"$$original_ACLOCAL" = x || unset original_ACLOCAL; \ exec 9>&2; stderr_fileno_=9; export stderr_fileno_; -TESTS = $(handwritten_tests) $(generated_tests) -generated_tests = $(parallel_tests) $(instspc_tests) +TESTS = \ + $(handwritten_tests) \ + $(generated_tests) \ + $(instspc_tests) + +generated_tests = $(parallel_tests) handwritten_tests = \ aclocal.test \ aclocal3.test \ @@ -1314,7 +1311,7 @@ yflags-var-expand.test all: all-am .SUFFIXES: -.SUFFIXES: .html .log .test +.SUFFIXES: .html .instspc .log .test $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/instspc-tests.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1486,6 +1483,8 @@ recheck recheck-html: $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' .test.log: @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post) +.instspc.log: + @p='$<'; $(am__check_pre) $(INSTSPC_LOG_COMPILE) "$$tst" $(am__check_post) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -1694,31 +1693,14 @@ $(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am $(AM_V_GEN)($(am__cd) $(srcdir) \ && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ -$(instspc_tests): Makefile.am - $(AM_V_at)rm -f $@ $@-t - $(AM_V_GEN) :; \ - base=`expr 'x/$@' : 'x.*/instspc-\(.*\)\.test$$'`; \ - name=`expr x"$$base" : x'\(.*\)-'`; \ - action=`expr x"$$base" : x'.*-\(.*\)'`; \ - { \ - echo '#!/bin/sh'; \ - echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ - echo; \ - echo '# Ensure proper definition of $$testsrcdir.'; \ - echo '. ./defs-static || exit 99'; \ - echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \ - echo; \ - echo "instspc_test_name='$$name'"; \ - echo "instspc_action='test-$$action'"; \ - echo ". \$$testsrcdir/instspc-tests.sh"; \ - } > $@-t - $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ - -# All instspc-*.test tests work by sourcing the `instspc-tests.sh' -# script. Also, they all use shared data generated by the helper -# test `instspc-data.test', for reasons of speed. +# All `*.instspc' tests work by calling the script `instspc-tests.sh'. +# Also, they all use shared data generated by the `instspc-data.test' +# helper test (for reasons of speed). instspc-data.log: instspc-tests.sh -$(instspc_tests:.test=.log): instspc-tests.sh instspc-data.log +$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log +# This dummy declaration is required to have make actually produce +# expected log files from the `.instspc.log' suffix rule. +$(instspc_tests): # Each test case depends on defs, aclocal, and automake. $(TEST_LOGS): defs aclocal-$(APIVERSION) automake-$(APIVERSION) diff --git a/tests/instspc-data.test b/tests/instspc-data.test index 1c165d8..54f796c 100755 --- a/tests/instspc-data.test +++ b/tests/instspc-data.test @@ -14,13 +14,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Helper testcase which generate input data for the other test -# `instspc-*.test'. It basically delegates the work to the helper -# script `instspc-test.sh'. +# Helper testcase which generate input data for the `*.instspc' tests. +# It basically delegates the work to the driver script `instspc-test.sh'. # Ensure proper definition of $testsrcdir. . ./defs-static || exit 99 -test -n "$testsrcdir" || exit 99 # sanity check -instspc_action=generate-data -. $testsrcdir/instspc-tests.sh +# Sanity check. +if test x"$testsrcdir" = x; then + echo "$0: \$testsrcdir not set after sourcing of ./defs-static" >&2 + exit 99 +fi + +exec $SHELL $testsrcdir/instspc-tests.sh --generate-data diff --git a/tests/instspc-tests.sh b/tests/instspc-tests.sh index 2c4089f..70c1a65 100755 --- a/tests/instspc-tests.sh +++ b/tests/instspc-tests.sh @@ -15,24 +15,19 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# Driver script to generate and run tests checking that building from, -# or installing to, directories with shell metacharacters succeed. +# Driver script to run tests checking that building from, or installing +# to, directories with shell metacharacters succeed. # # Original report from James Amundson about file names with spaces. # Other characters added by Paul Eggert. # # This script fulfills a threefold role: -# 1. It generates a Makefile.am snippet, containing the definition -# of proper lists of tests. -# 2. It sets up a directory containing some common data files and -# autotools-generated files used by said generated tests (this -# is done for speed reasons only). -# 3. It is sourced by said generated tests with proper parameters -# pre-set, to run the "meat" of the checks. -# This setup might seem a tricky and over-engineered abuse, but past -# (painful) experiences showed that it is indeed required, because -# the test generation code and test execution code tend to be -# inextricably coupled and intertwined. +# 1. It is called to generate a Makefile.am snippet, containing the +# definition of proper lists of tests. +# 2. It is called to set up a directory containing some common data +# files and autotools-generated files used by the aforementioned +# tests (this is done for speed reasons only). +# 3. It is called to properly run those tests, one at a time. # # Be more Bourne compatible (snippet copied from `tests/defs'). @@ -50,30 +45,26 @@ fi set -e -# Sanity and usage checks. -if test x"$instspc_action" = x; then - if test "$#,$1" = "1,--generate-makefile"; then - instspc_action=generate-makefile - else - echo "$0: empty action and no proper command line" >&2 - exit 99 - fi -elif test $# -gt 0; then - echo "$0: action specified and command line arguments used" >&2 - exit 99 -fi +case $# in + 0) echo "$0: missing argument" >&2; exit 99;; + 1) ;; + *) echo "$0: too many arguments" >&2; exit 99;; +esac -case $instspc_action in - generate-makefile|generate-data) +case $1 in + --generate-makefile|--generate-data) + instspc_action=`expr x"$1" : x'--\(.*\)'` ;; - test-build|test-install) - if test x"$instspc_test_name" = x; then - echo "$0: test name undefined for action '$instspc_action'" >&2 - exit 99 - fi + build-*.instspc|*/build-*.instspc) + instspc_action=test-build + instspc_test_name=`expr /"$1" : '.*/build-\(.*\)\.instspc'` + ;; + install-*.instspc|*/install-*.instspc) + instspc_action=test-install + instspc_test_name=`expr /"$1" : '.*/install-\(.*\)\.instspc'` ;; *) - echo "$0: invalid action: '$instspc_action'" + echo "$0: invalid argument '$1'" >&2 exit 99 ;; esac @@ -261,21 +252,27 @@ if test x"$instspc_action" = x"generate-makefile"; then echo 'instspc_tests =' echo 'instspc_xfail_tests =' for test_name in $instspc_names_list; do - echo "instspc_tests += instspc-$test_name-build.test" - echo "instspc_tests += instspc-$test_name-install.test" + echo "instspc_tests += build-$test_name.instspc" + echo "instspc_tests += install-$test_name.instspc" done for test_name in $instspc_xfail_builds_list; do - echo "instspc_xfail_tests += instspc-$test_name-build.test" + echo "instspc_xfail_tests += build-$test_name.instspc" done for test_name in $instspc_xfail_installs_list; do - echo "instspc_xfail_tests += instspc-$test_name-install.test" + echo "instspc_xfail_tests += install-$test_name.instspc" done exit 0 fi # We'll need the full setup provided by `tests/defs'. Temporarily disable # the errexit flag, since the setup code might not be prepared to deal -# with it. +# with it. Also pre-set `$me' for `tests/defs', so that different calls +# to `instspc-tests.sh' won't try to use the same temporary directory. +if test x"$instspc_action" = x"generate-data"; then + me=instspc-data +else + me=$instspc_action-$instspc_test_name +fi set +e . ./defs || Exit 99 set -e -- 1.7.2.3