automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Overhauled and modularized tests in `instspc.test'.


From: Stefano Lattarini
Subject: Re: [PATCH] Overhauled and modularized tests in `instspc.test'.
Date: Mon, 10 May 2010 23:56:16 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

At Sunday 09 May 2010, Stefano Lattarini <address@hidden> wrote:
> Sigh.  This version of the patch fails to provide make with the
> necessary rules to properly regenerate the tests instspc*.test.
> In case any of these tests is removed, subsequent `make check'
> or `make dist' calls will fail.
> 
> Fixing this problem is turning out to be quite tricky.
> 
> For the moment, please don't apply the patch.  I hope to come up
>  with an amended patch soonish (probably tomorrow).
> 
Done in the attached patch.  Note that, unfortunately, the size of
the generated makefile fragment `tests/instspc-tests.am' (and
consequently of `tests/Makefile.in') has been *greatly* increased,
since each test instspc*.test requires a rule of its own to be
correctly generated.

Regards,
    Stefano

-*-*-*-

Overhauled and modularized tests in `instspc.test'.

The test `instspc.test' was way too big and fragile.  Its running
time was very long.  It also produced a log that was nearly
unreadable due to its lenght, making it very difficult to find
out the reason of failures.
Also, it was too much monolithic, with a single (maybe spurious)
failure in a corner case causing the whole test to fail (even if
everything worked as expected in the other 99% of cases).
The present change should solve these problems, by separating
`instspc.test' into many smaller, self-contained, auto-generated
tests.

* tests/gen-instspc-tests: New file, generates a distributed
Makefile.am snippet `tests/instspc-tests.am'.  This contains
rules to generate a host of new tests `instspc*.test', which
will take over the older `instspc.test'.
* tests/instspc.test: Moved to ...
* tests/instspc.sh: ... this, and modified (quite heavily) to
adapt to the new circumstances (it will be included by all the
newly generated `instspc*.test').
* tests/Makefile.am ($(srcdir)/instspc-tests.am): Include this
snippet, which (among the other things) defines ...
(instspc_tests): ... this new macro, containing the list of the
newly generated `instspc*.test' tests, and ...
(instspc_xfail_tests): ... this new macro, containing the list
of the `instspc*.test' tests expected to fail.
($(instspc_tests:.test=.log)): New rule, registers the dependency
of all `instspc*.test' tests from the `instspc.sh' script.
(TESTS): Add `$(instspc_tests)', remove `instspc.test'.
(XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
(EXTRA_DIST): Distribute gen-instspc-tests and instspc.sh.
(MAINTAINERCLEANFILES): Added $(instspc_tests).
Other minor cosmetic changes.
* bootstrap: Generate instspc-tests.am.
* tests/.gitignore: Updated.
---
 ChangeLog                    |   37 +++
 bootstrap                    |    8 +-
 tests/.gitignore             |    5 +-
 tests/Makefile.am            |   28 ++-
 tests/Makefile.in            |  622 +++++++++++++++++++++++++++++++++++-
 tests/gen-instspc-tests      |   97 ++++++
 tests/{instspc.test => instspc.sh} |  175 +++++-----
 7 files changed, 863 insertions(+), 109 deletions(-)
 create mode 100755 tests/gen-instspc-tests
 rename tests/{instspc.test => instspc.sh} (53%)
 mode change 100755 => 100644
From 295bc2894683d4b1a5714c047e1036d196550300 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 10 May 2010 23:22:52 +0200
Subject: [PATCH] Overhauled and modularized tests in `instspc.test'.

The test `instspc.test' was way too big and fragile.  Its running
time was very long.  It also produced a log that was nearly
unreadable due to its lenght, making it very difficult to find
out the reason of failures.
Also, it was too much monolithic, with a single (maybe spurious)
failure in a corner case causing the whole test to fail (even if
everything worked as expected in the other 99% of cases).
The present change should solve these problems, by separating
`instspc.test' into many smaller, self-contained, auto-generated
tests.

* tests/gen-instspc-tests: New file, generates a distributed
Makefile.am snippet `tests/instspc-tests.am'.  This contains
rules to generate a host of new tests `instspc*.test', which
will take over the older `instspc.test'.
* tests/instspc.test: Moved to ...
* tests/instspc.sh: ... this, and modified (quite heavily) to
adapt to the new circumstances (it will be included by all the
newly generated `instspc*.test').
* tests/Makefile.am ($(srcdir)/instspc-tests.am): Include this
snippet, which (among the other things) defines ...
(instspc_tests): ... this new macro, containing the list of the
newly generated `instspc*.test' tests, and ...
(instspc_xfail_tests): ... this new macro, containing the list
of the `instspc*.test' tests expected to fail.
($(instspc_tests:.test=.log)): New rule, registers the dependency
of all `instspc*.test' tests from the `instspc.sh' script.
(TESTS): Add `$(instspc_tests)', remove `instspc.test'.
(XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
(EXTRA_DIST): Distribute gen-instspc-tests and instspc.sh.
(MAINTAINERCLEANFILES): Added $(instspc_tests).
Other minor cosmetic changes.
* bootstrap: Generate instspc-tests.am.
* tests/.gitignore: Updated.
---
 ChangeLog                          |   37 +++
 bootstrap                          |    8 +-
 tests/.gitignore                   |    5 +-
 tests/Makefile.am                  |   28 ++-
 tests/Makefile.in                  |  622 +++++++++++++++++++++++++++++++++++-
 tests/gen-instspc-tests            |   97 ++++++
 tests/{instspc.test => instspc.sh} |  175 +++++-----
 7 files changed, 863 insertions(+), 109 deletions(-)
 create mode 100755 tests/gen-instspc-tests
 rename tests/{instspc.test => instspc.sh} (53%)
 mode change 100755 => 100644

diff --git a/ChangeLog b/ChangeLog
index 71b0d9b..40c407d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2010-05-10  Stefano Lattarini  <address@hidden>
+
+       Overhauled and modularized tests in `instspc.test'.
+       The test `instspc.test' was way too big and fragile.  Its running
+       time was very long.  It also produced a log that was nearly
+       unreadable due to its lenght, making it very difficult to find
+       out the reason of failures.
+       Also, it was too much monolithic, with a single (maybe spurious)
+       failure in a corner case causing the whole test to fail (even if
+       everything worked as expected in the other 99% of cases).
+       The present change should solve these problems, by separating
+       `instspc.test' into many smaller, self-contained, auto-generated
+       tests.
+       * tests/gen-instspc-tests: New file, generates a distributed
+       Makefile.am snippet `tests/instspc-tests.am'.  This contains
+       rules to generate a host of new tests `instspc*.test', which
+       will take over the older `instspc.test'.
+       * tests/instspc.test: Moved to ...
+       * tests/instspc.sh: ... this, and modified (quite heavily) to
+       adapt to the new circumstances (it will be included by all the
+       newly generated `instspc*.test').
+       * tests/Makefile.am ($(srcdir)/instspc-tests.am): Include this
+       snippet, which (among the other things) defines ...
+       (instspc_tests): ... this new macro, containing the list of the
+       newly generated `instspc*.test' tests, and ...
+       (instspc_xfail_tests): ... this new macro, containing the list
+       of the `instspc*.test' tests expected to fail.
+       ($(instspc_tests:.test=.log)): New rule, registers the dependency
+       of all `instspc*.test' tests from the `instspc.sh' script.
+       (TESTS): Add `$(instspc_tests)', remove `instspc.test'.
+       (XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
+       (EXTRA_DIST): Distribute gen-instspc-tests and instspc.sh.
+       (MAINTAINERCLEANFILES): Added $(instspc_tests).
+       Other minor cosmetic changes.
+       * bootstrap: Generate instspc-tests.am.
+       * tests/.gitignore: Updated.
+
 2010-04-25  Ralf Wildenhues  <address@hidden>
 
        Warning and error message formatting cleanups.
diff --git a/bootstrap b/bootstrap
index 2a86345..2b19efd 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,8 +2,8 @@
 
 # This script helps bootstrap automake, when checked out from git.
 #
-# Copyright (C) 2002, 2003, 2004, 2007, 2008  Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2004, 2007, 2008, 2010 Free Software
+# Foundation, Inc.
 # written by Pavel Roskin <address@hidden> September 2002
 #
 # This program is free software; you can redistribute it and/or modify
@@ -124,9 +124,11 @@ dosubst m4/amversion.in m4/amversion.m4
 # Create temporary replacement for automake
 dosubst automake.in automake.tmp
 
-# Create tests/parallel-tests.am.
+# Create required makefile snippets.
 cd tests
+rm -f parallel-tests.am instspc-tests.am
 $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
+$BOOTSTRAP_SHELL ./gen-instspc-tests > instspc-tests.am
 cd ..
 
 # Run the autotools.
diff --git a/tests/.gitignore b/tests/.gitignore
index 61b0783..3791060 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,9 +1,12 @@
 aclocal-*
 automake-*
 defs
+instspc-tests.am
 parallel-tests.am
 *.dir
 *.log
 *.log-t
 *-p.test
-*-p.test-t
+instspc[0-9]*-build.test
+instspc[0-9]*-install.test
+*.test-t
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cff34c5..775d662 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,6 +16,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+MAINTAINERCLEANFILES =         ## updated later
+EXTRA_DIST = ChangeLog-old     ## likewise
+
 XFAIL_TESTS =                                  \
 all.test                                       \
 auxdir2.test                                   \
@@ -23,6 +26,7 @@ cond17.test                                   \
 gcj6.test                                      \
 txinfo5.test
 
+
 include $(srcdir)/parallel-tests.am
 
 $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
@@ -38,7 +42,22 @@ $(parallel_tests): Makefile.am
        } > address@hidden
        $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
 
-MAINTAINERCLEANFILES = $(parallel_tests)
+MAINTAINERCLEANFILES += $(parallel_tests) $(instspc_tests)
+EXTRA_DIST += gen-parallel-tests
+
+
+include $(srcdir)/instspc-tests.am
+
+$(srcdir)/instspc-tests.am: gen-instspc-tests Makefile.am
+       $(AM_V_GEN)(cd $(srcdir) && $(SHELL) ./gen-instspc-tests) >$@
+
+# All instspc*.test tests work by sourcing the instspc.sh script.
+$(instspc_tests:.test=.log): $(srcdir)/instspc.sh
+
+MAINTAINERCLEANFILES += $(parallel_tests) $(instspc_tests)
+EXTRA_DIST += gen-instspc-tests instspc.sh
+XFAIL_TESTS += $(instspc_xfail_tests)
+
 
 TESTS =        \
 aclibobj.test \
@@ -388,7 +407,6 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc.test \
 interp.test \
 interp2.test \
 java.test \
@@ -779,9 +797,11 @@ yacc7.test \
 yacc8.test \
 yaccpp.test \
 yaccvpath.test \
-$(parallel_tests)
+$(parallel_tests) \
+$(instspc_tests)
+
+EXTRA_DIST += $(TESTS)
 
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3ff9012..b9b1f7d 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -50,7 +50,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in \
-       $(srcdir)/parallel-tests.am
+       $(srcdir)/instspc-tests.am $(srcdir)/parallel-tests.am
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -250,13 +250,12 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-XFAIL_TESTS = \
-all.test                                       \
-auxdir2.test                                   \
-cond17.test                                    \
-gcj6.test                                      \
-txinfo5.test
-
+MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests) \
+       $(parallel_tests) $(instspc_tests)
+EXTRA_DIST = ChangeLog-old gen-parallel-tests gen-instspc-tests \
+       instspc.sh $(TESTS)
+XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test txinfo5.test \
+       $(instspc_xfail_tests)
 parallel_tests = \
 check-p.test \
 check10-p.test \
@@ -280,7 +279,59 @@ pr401-p.test \
 pr401b-p.test \
 pr401c-p.test
 
-MAINTAINERCLEANFILES = $(parallel_tests)
+instspc_tests = instspc1-build.test instspc1-install.test \
+       instspc2-build.test instspc2-install.test instspc3-build.test \
+       instspc3-install.test instspc4-build.test \
+       instspc4-install.test instspc5-build.test \
+       instspc5-install.test instspc6-build.test \
+       instspc6-install.test instspc7-build.test \
+       instspc7-install.test instspc8-build.test \
+       instspc8-install.test instspc9-build.test \
+       instspc9-install.test instspc10-build.test \
+       instspc10-install.test instspc11-build.test \
+       instspc11-install.test instspc12-build.test \
+       instspc12-install.test instspc13-build.test \
+       instspc13-install.test instspc14-build.test \
+       instspc14-install.test instspc15-build.test \
+       instspc15-install.test instspc16-build.test \
+       instspc16-install.test instspc17-build.test \
+       instspc17-install.test instspc18-build.test \
+       instspc18-install.test instspc19-build.test \
+       instspc19-install.test instspc20-build.test \
+       instspc20-install.test instspc21-build.test \
+       instspc21-install.test instspc22-build.test \
+       instspc22-install.test instspc23-build.test \
+       instspc23-install.test instspc24-build.test \
+       instspc24-install.test instspc25-build.test \
+       instspc25-install.test instspc26-build.test \
+       instspc26-install.test instspc27-build.test \
+       instspc27-install.test instspc28-build.test \
+       instspc28-install.test instspc29-build.test \
+       instspc29-install.test instspc30-build.test \
+       instspc30-install.test instspc31-build.test \
+       instspc31-install.test instspc32-build.test \
+       instspc32-install.test instspc33-build.test \
+       instspc33-install.test instspc34-build.test \
+       instspc34-install.test instspc35-build.test \
+       instspc35-install.test instspc36-build.test \
+       instspc36-install.test instspc37-build.test \
+       instspc37-install.test instspc38-build.test \
+       instspc38-install.test instspc39-build.test \
+       instspc39-install.test instspc40-build.test \
+       instspc40-install.test instspc41-build.test \
+       instspc41-install.test instspc42-build.test \
+       instspc42-install.test instspc43-build.test \
+       instspc43-install.test instspc44-build.test \
+       instspc44-install.test instspc45-build.test \
+       instspc45-install.test
+instspc_xfail_tests = instspc2-build.test instspc2-install.test \
+       instspc3-build.test instspc3-install.test instspc4-build.test \
+       instspc4-install.test instspc6-build.test instspc7-build.test \
+       instspc7-install.test instspc22-build.test \
+       instspc25-build.test instspc25-install.test \
+       instspc34-build.test instspc34-install.test \
+       instspc40-build.test instspc43-build.test \
+       instspc43-install.test
 TESTS = \
 aclibobj.test \
 aclocal.test \
@@ -629,7 +680,6 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc.test \
 interp.test \
 interp2.test \
 java.test \
@@ -1020,9 +1070,9 @@ yacc7.test \
 yacc8.test \
 yaccpp.test \
 yaccvpath.test \
-$(parallel_tests)
+$(parallel_tests) \
+$(instspc_tests)
 
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
@@ -1030,7 +1080,7 @@ all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .html .log .test
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am 
$(am__configure_deps)
+$(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 \
            *$$dep*) \
@@ -1390,6 +1440,552 @@ $(parallel_tests): Makefile.am
        } > address@hidden
        $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
 
+instspc1-build.test instspc1-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''!'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc2-build.test instspc2-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''"'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc3-build.test instspc3-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${sh}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc4-build.test instspc4-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${dl}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc5-build.test instspc5-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''%'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc6-build.test instspc6-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''&'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc7-build.test instspc7-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${sq}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc8-build.test instspc8-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''('\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc9-build.test instspc9-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\'')'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc10-build.test instspc10-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''*'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc11-build.test instspc11-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''+'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc12-build.test instspc12-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\'','\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc13-build.test instspc13-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''-'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc14-build.test instspc14-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\'':'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc15-build.test instspc15-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\'';'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc16-build.test instspc16-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''<'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc17-build.test instspc17-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''='\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc18-build.test instspc18-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''>'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc19-build.test instspc19-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''?'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc20-build.test instspc20-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc21-build.test instspc21-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''['\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc22-build.test instspc22-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''\'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc23-build.test instspc23-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\'']'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc24-build.test instspc24-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''^'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc25-build.test instspc25-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''`'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc26-build.test instspc26-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''{'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc27-build.test instspc27-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''|'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc28-build.test instspc28-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc29-build.test instspc29-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''~'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc30-build.test instspc30-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${bs}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc31-build.test instspc31-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${cr}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc32-build.test instspc32-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${ff}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc33-build.test instspc33-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${ht}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc34-build.test instspc34-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${lf}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc35-build.test instspc35-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''$${sp}'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc36-build.test instspc36-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@<:@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc37-build.test instspc37-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@:>@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc38-build.test instspc38-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@S|@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc39-build.test instspc39-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@%:@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc40-build.test instspc40-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''@&t@'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc41-build.test instspc41-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''a$${sp}b'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc42-build.test instspc42-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''a$${sp}$${sp}b'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc43-build.test instspc43-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''a$${lf}b'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc44-build.test instspc44-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''...'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+instspc45-build.test instspc45-install.test: instspc-tests.am
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+       echo weird_chars=\''a:'\'; \
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+
+$(srcdir)/instspc-tests.am: gen-instspc-tests Makefile.am
+       $(AM_V_GEN)(cd $(srcdir) && $(SHELL) ./gen-instspc-tests) >$@
+
+# All instspc*.test tests work by sourcing the instspc.sh script.
+$(instspc_tests:.test=.log): $(srcdir)/instspc.sh
+
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
diff --git a/tests/gen-instspc-tests b/tests/gen-instspc-tests
new file mode 100755
index 0000000..eb3bdb7
--- /dev/null
+++ b/tests/gen-instspc-tests
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Generate instspc-tests.am.
+#
+# Copyright (C) 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/>.
+
+# Generate a Makefile fragment which defines:
+#  1. Rules to generate tests that we can building from, and/or install
+#     to, directories having in their name shell/make metacharacters,
+#     control characters, white spaces, autoconf quadrigraphs, or other
+#     suspicious/problematic tokens.
+#  2. The macro $(instspc_tests), containing the list of the tests
+#     generated by the makefile fragment.
+#  3. The macro $(xfail_instspc_test), containing the list of those
+#     generated tests expected to fail.
+
+# Original report from James Amundson about file names with spaces.
+# Other characters added by Paul Eggert.
+
+set -e # abort on unhandled errors
+
+# Defined to help avoiding headaches with multiple escaping into
+# backquotes, below.
+escape_dollar() { sed 's/\$/$$/g'; }
+
+cat <<'END'
+## Generated by gen-instspc-tests.  DO NOT EDIT!
+instspc_tests =
+instspc_xfail_tests =
+END
+
+count=0
+# Some of these contain symbolic reperesentations of problematic
+# characters, which could easily confuse make (e.g. `#', `$' or
+# newline).  They will be properly expanded by instspc.sh.
+for weird_chars in \
+  '!' '"' '${sh}' '${dl}' '%' '&' '${sq}' '(' ')' '*' '+' ',' '-' \
+  ':' ';' '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '{' '|' '}' '~' \
+  '${bs}' '${cr}' '${ff}' '${ht}' '${lf}' '${sp}' \
+  '@<:@' '@:>@' '@S|@' '@%:@' '@&t@' \
+  'a${sp}b' 'a${sp}${sp}b' 'a${lf}b' '...' 'a:'
+do
+  count=`expr $count + 1`
+  # Simply naming the tests using incremental numbers seems to
+  # be the best policy.
+  tst=instspc$count
+  # We have to escape `$' in makefiles.
+  case "$weird_chars" in
+    *\$*) weird_escaped=`printf '%s' "$weird_chars" | escape_dollar`;;
+    *) weird_escaped=$weird_chars;;
+  esac
+  echo # separate sections for different tests
+  echo "$tst-build.test $tst-install.test: instspc-tests.am"
+  cat <<'END'
+       $(AM_V_at)rm -f $@ address@hidden
+       $(AM_V_GEN) { \
+         action=`echo $@ | sed -e 's/\.test$$//' -e s/^.*-//;`; \
+         echo '#!/bin/sh'; \
+         echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
+         echo action=$$action; \
+END
+  # leading tab here
+  echo "       echo weird_chars=\\''$weird_escaped'\\'; \\"
+  cat <<'END'
+         echo ". '$(srcdir)/instspc.sh'"; \
+       } > address@hidden
+       $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
+END
+  echo "instspc_tests += $tst-build.test $tst-install.test"
+  # Some of the above "weird" file names cannot be used as a build
+  # directory on a POSIX host.  This list should be empty, but is
+  # not due to limitations in Autoconf, Automake, Make, M4, or the
+  # shell.
+  case $weird_chars in
+    \"|'${sh}'|'${dl}'|'${sq}'|\&|\\|\`|'${lf}'|'@&t@'|'a${lf}b')
+      echo "instspc_xfail_tests += $tst-build.test";;
+  esac
+  # Similarly, some of the "weird" file names cannot be used as an
+  # install directory on a POSIX host.  This list should ideally
+  # also be empty.
+  case $weird_chars in
+    \"|'${sh}'|'${dl}'|'${sq}'|\`|'${lf}'|'a${lf}b')
+      echo "instspc_xfail_tests += $tst-install.test";;
+  esac
+done
diff --git a/tests/instspc.test b/tests/instspc.sh
old mode 100755
new mode 100644
similarity index 53%
rename from tests/instspc.test
rename to tests/instspc.sh
index 414b3e5..c7ac044
--- a/tests/instspc.test
+++ b/tests/instspc.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 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
@@ -14,7 +14,14 @@
 # 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 installation to directory with shell metacharacters succeed.
+# Check that building from, or installing to, directories with shell
+# metacharacters succeed.
+
+# This script is expected to be sourced by specific, individual tests,
+# which, before its inclusion, should properly define the variable
+# `$weird_chars' and `$action' (this last one to either "build"
+# or "install").
+
 # Original report from James Amundson about file names with spaces.
 # Other characters added by Paul Eggert.
 
@@ -23,13 +30,73 @@
 # file names (Issue observed with ltmain.sh (GNU libtool) 1.5a (1.1323
 # 2003/11/10 21:06:47))
 
-
 required='gcc'
 . ./defs || Exit 1
 
 set -e
 
-# Set up files that won't change each time through the loop.
+# This file will be sourced by many tests, so avoid cluttering up
+# the verbose logs too much.
+set +x
+echo "INFO: disable shell traces"
+
+echo "INFO: \$action=$action"
+echo "INFO: \$weird_chars='$weird_chars'"
+
+# Sanity check 1.
+if test -z "$weird_chars"; then
+  echo "$me: FATAL: \$weird_chars unset or empty"
+  Exit 1
+fi
+
+# Sanity check 2.
+case $action in
+  "") echo "$me: FATAL: \$action unset or empty"; Exit 1;;
+  build|install) ;;
+  *) echo "$me: FATAL: invalid \$action: '$action'"; Exit 1;;
+esac
+
+# Some control characters that are white space.
+bs='' # back space
+cr='
' # carriage return
+ff='' # form feed
+ht='   ' # horizontal tab
+lf='
+'  # line feed (aka newline)
+sp=' ' # space
+
+# Some other character that might be problematic in makefiles.
+dl=\$ # dollar
+sq=\' # single quote
+sh=\# # sharp
+
+# Avoid headaches with backslashes into backquotes.
+subst_spaces() {
+  printf '%s' "$*" | sed -e 's/\${sp}/ /g' -e 's/\${lf}/#/g' | tr "#" "$lf"
+}
+
+# Now we might have to perform some substitutions in the given "weird
+# file name".  This is necessary, because some "unusual" characters
+# can easily wreak havoc in makefiles (see the comments in the script
+# `gen-instspc-tests' for more information).
+case $weird_chars in
+  *\#*)
+    echo "$me: invalid \$weird_chars: '$weird_chars'" >&2; Exit 1;;
+  '${bs}'|'${cr}'|'${ff}'|'${ht}'|'${lf}'|'${sp}'|'${dl}'|'${sq}'|'${sh}')
+    eval "weird_chars=$weird_chars";;
+  *'${sp}'*|*'${lf}'*)
+    weird_chars=`subst_spaces "$weird_chars"`;;
+  *\$*)
+    echo "$me: invalid \$weird_chars: '$weird_chars'" >&2; Exit 1;;
+esac
+
+echo "INFO: enable shell traces"
+set -x
+
+# Skip if this system doesn't support this characters in file names.
+mkdir "./$weird_chars" || Exit 77
+
+mkdir sub1
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
@@ -78,6 +145,7 @@ nobase_fooexec_LIBRARIES = sub/libnobase.a
 sub_libbase_a_SOURCES = source.c
 sub_libnobase_a_SOURCES = source.c
 
+:PHONY: test-install-sep
 test-install-sep: install
        test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
        test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
@@ -100,88 +168,19 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-# Some control characters that are white space:
-# back space, carriage return, form feed, horizontal tab, line feed, space
-bs=''
-cr='
'
-ff=''
-ht='   '
-lf='
-'
-sp=' '
-
-build_failures=
-install_failures=
-
-for file in \
-  '!' '"' '#' '$' '%' '&' \' '(' ')' '*' '+' ',' '-' ':' ';' \
-  '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '{' '|' '}' '~' \
-  "$bs" "$cr" "$ff" "$ht" "$lf" "$sp" \
-  '@<:@' '@:>@' '@S|@' '@%:@' '@&t@' \
-  "a${sp}b" "a${sp}${sp}b" "a${lf}b" ... a:
-do
-  for test in build install; do
-    case $test in
-    build)
-      build=$file
-      dest=`pwd`/sub1;;
-    install)
-      build=sub1
-      dest=`pwd`/$file;;
-    esac
-
-    # Make sure this system supports this character in file names.
-    mkdir sub1 "./$file" || Exit 77
-
-    cd "$build"
-
-    ../configure --prefix "/$file-prefix" &&
-    $MAKE &&
-    DESTDIR=$dest file=$file $MAKE -e test-install-sep ||
-      eval "${test}_failures=\"\$${test}_failures$lf\$file\""
-
-    cd ..
-
-    rm -fr sub1 "./$file"
-  done
-done
-
-# The list of the above file names that cannot be used as a build directory
-# on a POSIX host.  This list should be empty, but is not due to limitations
-# in Autoconf, Automake, Make, M4, or the shell.
-expected_build_failures='
-"
-#
-$
-&
-'\''
-\
-`
-'"$lf"'
-@&t@
-a'"${lf}"'b'
-
-# Similarly, the list of file names that cannot be used as an install directory
-# on a POSIX host.  This list should also be empty.
-expected_install_failures='
-"
-#
-$
-'\''
-`
-'"$lf"'
-a'"${lf}"'b'
-
-fail=0
-for test in build install; do
-  eval failures=\$${test}_failures
-  case $failures in
-  ?*)
-    cat >&2 <<EOF
-$0: $test test failed for the following file names:$failures
-EOF
-    eval test \"\$failures\" = \"\$expected_${test}_failures\" || fail=1
-  esac
-done
+case $action in
+  build)
+    build=$weird_chars
+    dest=`pwd`/sub1;;
+  install)
+    build=sub1
+    dest=`pwd`/$weird_chars;;
+esac
+
+cd "./$build"
+
+../configure --prefix "/$weird_chars-prefix"
+$MAKE
+DESTDIR="$dest" file="$weird_chars" $MAKE -e test-install-sep
 
-Exit $fail
+:
-- 
1.6.5


reply via email to

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