automake-patches
[Top][All Lists]
Advanced

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

[PATCH 2/2] tests: avoid extra test generation (for `instspc' tests)


From: Stefano Lattarini
Subject: [PATCH 2/2] tests: avoid extra test generation (for `instspc' tests)
Date: Wed, 16 Feb 2011 13:55:26 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

* 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').
(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): Don't extend with $(instspc_tests)
anymore.
(generated_tests): Likewise.
Update comments.
* tests/defs ($me): Allow overriding from calling script and
from the environment.
---
 ChangeLog               |   29 +++++++++
 tests/Makefile.am       |   37 +++--------
 tests/Makefile.in       |  160 ++++++++++++++++++++---------------------------
 tests/defs              |   10 ++-
 tests/instspc-data.test |   15 +++--
 tests/instspc-tests.sh  |   73 ++++++++++-----------
 6 files changed, 159 insertions(+), 165 deletions(-)
From 6d6b0a387774eb13a51624ac1d7b246b236c84ac Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 16 Feb 2011 13:46:33 +0100
Subject: [PATCH 2/2] tests: avoid extra test generation (for `instspc' tests)

* 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').
(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): Don't extend with $(instspc_tests)
anymore.
(generated_tests): Likewise.
Update comments.
* tests/defs ($me): Allow overriding from calling script and
from the environment.
---
 ChangeLog               |   29 +++++++++
 tests/Makefile.am       |   37 +++--------
 tests/Makefile.in       |  160 ++++++++++++++++++++---------------------------
 tests/defs              |   10 ++-
 tests/instspc-data.test |   15 +++--
 tests/instspc-tests.sh  |   73 ++++++++++-----------
 6 files changed, 159 insertions(+), 165 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 29e85ae..01a0630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
 2011-02-16  Stefano Lattarini  <address@hidden>
 
+       tests: avoid extra test generation (for `instspc' tests)
+       * 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').
+       (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): Don't extend with $(instspc_tests)
+       anymore.
+       (generated_tests): Likewise.
+       Update comments.
+       * tests/defs ($me): Allow overriding from calling script and
+       from the environment.
+
+2011-02-16  Stefano Lattarini  <address@hidden>
+
        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 96ea636..dbb6a29 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 \
@@ -61,37 +62,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 $@ address@hidden
-       $(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"; \
-         } > address@hidden
-       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
-
-# 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)
 
@@ -100,7 +85,7 @@ TESTS = $(handwritten_tests) $(generated_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 80c00bf..4ef1dc3 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -183,11 +183,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@
@@ -281,9 +283,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 txinfo5.test \
        $(instspc_xfail_tests)
@@ -296,70 +299,60 @@ 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
 TESTS = $(handwritten_tests) $(generated_tests)
-generated_tests = $(parallel_tests) $(instspc_tests)
+generated_tests = $(parallel_tests)
 handwritten_tests = \
 aclocal.test \
 aclocal3.test \
@@ -1267,7 +1260,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 \
@@ -1439,6 +1432,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'`; \
@@ -1647,31 +1642,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 $@ address@hidden
-       $(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"; \
-         } > address@hidden
-       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
-
-# 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/defs b/tests/defs
index a32ef15..6332bad 100644
--- a/tests/defs
+++ b/tests/defs
@@ -34,10 +34,12 @@ test -f ./defs-static || {
 
 # The name of the current test (without the `.test' suffix.)
 # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
-me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \
-  && test -n "$me" \
-  || { echo "$argv0: failed to define \$me" >&2; exit 99; }
-
+# Allow the user of the individual tests to override it.
+if test -z "$me"; then
+  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \
+    && test -n "$me" \
+    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
+fi
 
 ## ---------------------------------------- ##
 ##  Sanity checks and environment cleanup.  ##
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


reply via email to

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