]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Overhauled and modularized tests in `instspc.test'.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 6 Jun 2010 16:38:27 +0000 (18:38 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 4 Nov 2010 10:25:15 +0000 (11:25 +0100)
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 length, making it very difficult to find
out the reason for 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/instspc.test: Removed.
* tests/instspc-tests.sh: New script, fullfilling a double role:
1. it generates a Makefile.am snippet `tests/instspc-tests.am',
containing the definition of a list of new tests which will take
over the older `instspc.test', and
2. it is sourced by said generated tests with proper parameters
pre-set, to run the "meat" of the checks.
This apparent abuse is indeed required because the test generation
code and test execution code are inevitably interwined.
* 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)): New rule, generates the `instspc*.test' tests.
($(instspc_tests:.test=.log)): New rule, registers the dependency
of all `instspc*.test' tests on the `instspc-tests.sh' script.
(TESTS): Add `$(instspc_tests)', remove `instspc.test'.
(XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
(EXTRA_DIST): Distribute instspc-tests.sh.
(MAINTAINERCLEANFILES): Added $(instspc_tests).
Other minor cosmetic changes.
* bootstrap: Generate instspc-tests.am.
* tests/.gitignore: Updated.

ChangeLog
bootstrap
tests/.gitignore
tests/Makefile.am
tests/Makefile.in
tests/instspc-tests.sh [new file with mode: 0755]
tests/instspc.test [deleted file]

index 5fff04a04220a74c984520a1836a6126e3937cd8..2d0a1457ccbb628cc2be6fcb8f1f0b1c88fc503a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2010-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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 length, making it very difficult to find
+       out the reason for 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/instspc.test: Removed.
+       * tests/instspc-tests.sh: New script, fulfilling a double role:
+       1. it generates a Makefile.am snippet `tests/instspc-tests.am',
+       containing the definition of a list of new tests which will take
+       over the older `instspc.test', and
+       2. it is sourced by said generated tests with proper parameters
+       pre-set, to run the "meat" of the checks.
+       This apparent abuse is indeed required because the test generation
+       code and test execution code are inevitably intertwined.
+       * 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)): New rule, generates the `instspc*.test' tests.
+       ($(instspc_tests:.test=.log)): New rule, registers the dependency
+       of all `instspc*.test' tests on the `instspc-tests.sh' script.
+       (TESTS): Add `$(instspc_tests)', remove `instspc.test'.
+       (XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
+       (EXTRA_DIST): Distribute instspc-tests.sh.
+       (MAINTAINERCLEANFILES): Added $(instspc_tests).
+       Other minor cosmetic changes.
+       * bootstrap: Generate instspc-tests.am.
+       * tests/.gitignore: Updated.
+
 2010-11-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Add FAQ entry for bug reporting instructions.
index 9f1a8d824dc8538ade6919fde811f8228b7e6e64..41f1f4e753405a237c8c4081256b5e5d751c501c 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -103,9 +103,10 @@ 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
 $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
+$BOOTSTRAP_SHELL ./instspc-tests.sh --generate-makefile > instspc-tests.am
 cd ..
 
 # Run the autotools.
index 61b0783a596e5ade243882d7a2fb11f5809219a9..ff89b406c1541e57d36e3d11fc873a48a66ed81f 100644 (file)
@@ -1,9 +1,12 @@
 aclocal-*
 automake-*
 defs
+instspc-tests.am
 parallel-tests.am
 *.dir
 *.log
 *.log-t
 *-p.test
-*-p.test-t
+instspc-*-build.test
+instspc-*-install.test
+*.test-t
index 66732933105aba78ad3de84a5b3fdebe902483b4..b25865b921a48123a2625b553bb3a3943588e67e 100644 (file)
@@ -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 =
+EXTRA_DIST = ChangeLog-old
+
 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
@@ -51,7 +55,44 @@ $(parallel_tests): Makefile.am
        } > $@-t
        $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@
 
-MAINTAINERCLEANFILES = $(parallel_tests)
+MAINTAINERCLEANFILES += $(parallel_tests)
+EXTRA_DIST += gen-parallel-tests
+
+
+include $(srcdir)/instspc-tests.am
+
+$(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 $$srcdir.'; \
+           echo 'am_skip_defs=yes'; \
+           echo '. ./defs || exit 99'; \
+           echo 'test -n "$$srcdir" || exit 99 # sanity check'; \
+           echo; \
+           echo "instspc_test_name='$$name'"; \
+           echo "instspc_action='test-$$action'"; \
+           echo ". \$$srcdir/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.
+$(instspc_tests:.test=.log): instspc-tests.sh
+
+MAINTAINERCLEANFILES += $(instspc_tests)
+EXTRA_DIST += instspc-tests.sh
+XFAIL_TESTS += $(instspc_xfail_tests)
+
 
 TESTS = \
 aclibobj.test \
@@ -429,7 +470,7 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc.test \
+$(instspc_tests) \
 interp.test \
 interp2.test \
 java.test \
@@ -835,7 +876,8 @@ yflags.test \
 yflags2.test \
 $(parallel_tests)
 
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
+EXTRA_DIST += $(TESTS)
+
 
 # Each test case depends on defs, aclocal, and automake.
 $(TEST_LOGS): defs aclocal-$(APIVERSION) automake-$(APIVERSION)
index 3bc699f70a2d18a2a5c6465bc24d11f33483d042..18f825bb27abe7c3ebe0b9ba41987bc2cdd452d5 100644 (file)
@@ -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 \
@@ -279,20 +279,79 @@ 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)
+EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.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 check11-p.test \
        check2-p.test check3-p.test check4-p.test check5-p.test \
        check6-p.test check7-p.test check8-p.test check9-p.test \
        color-p.test color2-p.test comment9-p.test dejagnu-p.test \
        exeext4-p.test maken3-p.test maken4-p.test pr401-p.test \
        pr401b-p.test pr401c-p.test
-MAINTAINERCLEANFILES = $(parallel_tests)
+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
 TESTS = \
 aclibobj.test \
 aclocal.test \
@@ -669,7 +728,7 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc.test \
+$(instspc_tests) \
 interp.test \
 interp2.test \
 java.test \
@@ -1075,12 +1134,11 @@ yflags.test \
 yflags2.test \
 $(parallel_tests)
 
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 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*) \
@@ -1444,6 +1502,34 @@ $(parallel_tests): Makefile.am
        } > $@-t
        $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@
 
+$(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 $$srcdir.'; \
+           echo 'am_skip_defs=yes'; \
+           echo '. ./defs || exit 99'; \
+           echo 'test -n "$$srcdir" || exit 99 # sanity check'; \
+           echo; \
+           echo "instspc_test_name='$$name'"; \
+           echo "instspc_action='test-$$action'"; \
+           echo ". \$$srcdir/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.
+$(instspc_tests:.test=.log): instspc-tests.sh
+
 # Each test case depends on defs, aclocal, and automake.
 $(TEST_LOGS): defs aclocal-$(APIVERSION) automake-$(APIVERSION)
 
diff --git a/tests/instspc-tests.sh b/tests/instspc-tests.sh
new file mode 100755 (executable)
index 0000000..90087eb
--- /dev/null
@@ -0,0 +1,301 @@
+#! /bin/sh
+# 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/>.
+
+#
+# Driver script to generate and 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 double role:
+#   1. It generates a Makefile.am snippet, containing the definition
+#      of proper lists of tests.
+#   2. It is sourced by said generated tests with proper parameters
+#      pre-set, to run the "meat" of the checks.
+# This setup might seem 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.
+#
+
+# Be more Bourne compatible (snippet copied from `tests/defs.in').
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+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
+elif test x"$instspc_action" = x"generate-makefile"; then
+  :
+else
+  case $instspc_action in
+    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;;
+    *)
+      echo "$0: invalid action: '$instspc_action'"
+      exit 99;;
+  esac
+fi
+
+# Helper subroutine for test data definition.
+# Usage: define_problematic_string NAME STRING
+define_problematic_string ()
+{
+  tst=$1
+  shift
+  eval "instspc__$tst=\$1" || exit 99
+  shift
+  instspc_names_list="$instspc_names_list $tst"
+  # Some of the "problematic" characters cannot be used in the name of
+  # a build or install directory on a POSIX host.  These lists should
+  # be empty, but are not due to limitations in Autoconf, Automake, Make,
+  # M4, or the shell.
+  case " $* " in *' fail-build '*|*' build-fail '*)
+    instspc_xfail_builds_list="$instspc_xfail_builds_list $tst";;
+  esac
+  case " $* " in *' fail-install '*|*' install-fail '*)
+    instspc_xfail_installs_list="$instspc_xfail_installs_list $tst";;
+  esac
+}
+
+# Be sure to avoid interferences from the environment.
+instspc_names_list=''
+instspc_xfail_builds_list=''
+instspc_xfail_installs_list=''
+
+
+# ================= #
+#  Test data begin  #
+# ----------------- #
+
+# Some control characters that are white space.
+bs='\b'   # back space
+cr='\r'   # carriage return
+ff='\f'   # form feed
+ht='   ' # horizontal tab
+lf='
+'         # line feed (aka newline)
+
+# Hack to save typing and make code visually clearer.
+def=define_problematic_string
+
+$def    squote          \'          fail-build  fail-install
+$def    dquote          '"'         fail-build  fail-install
+$def    bquote          '`'         fail-build  fail-install
+$def    sharp           '#'         fail-build  fail-install
+$def    dollar          '$'         fail-build  fail-install
+$def    bang            '!'
+$def    bslash          '\'         fail-build
+$def    ampersand       '&'         fail-build
+$def    percent         '%'
+$def    leftpar         '('
+$def    rightpar        ')'
+$def    pipe            '|'
+$def    caret           '^'
+$def    tilde           '~'
+$def    qmark           '?'
+$def    star            '*'
+$def    plus            '+'
+$def    minus           '-'
+$def    comma           ','
+$def    colon           ':'
+$def    semicol         ';'
+$def    equal           '='
+$def    less            '<'
+$def    more            '>'
+$def    at              '@'
+$def    lqbrack         '['
+$def    rqbrack         ']'
+$def    lcbrack         '{'
+$def    rcbrack         '}'
+$def    space           ' '
+$def    tab             "$ht"
+$def    linefeed        "$lf"       fail-build  fail-install
+$def    backspace       "$bs"
+$def    formfeed        "$ff"
+$def    carriageret     "$cr"
+$def    quadrigraph0    '@&t@'      fail-build
+$def    quadrigraph1    '@<:@'
+$def    quadrigraph2    '@:>@'
+$def    quadrigraph3    '@S|@'
+$def    quadrigraph4    '@%:@'
+$def    a_b             'a b'
+$def    a__b            'a  b'
+$def    a_lf_b          "a${lf}b"   fail-build  fail-install
+$def    dotdotdot       '...'
+$def    dosdrive        'a:'
+$def    miscglob1       '?[a-z]*'
+$def    miscglob2       '.*?[0-9]'
+
+unset def
+
+# --------------- #
+#  Test data end  #
+# =============== #
+
+
+if test x"$instspc_action" = x"generate-makefile"; then
+  # We must generate a makefile fragment on stdout.  It must refer
+  # to all tests at once, hence the loop below.
+  echo '## Generated by instspc-tests.sh.  DO NOT EDIT!'
+  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"
+  done
+  for test_name in $instspc_xfail_builds_list; do
+    echo "instspc_xfail_tests += instspc-$test_name-build.test"
+  done
+  for test_name in $instspc_xfail_installs_list; do
+    echo "instspc_xfail_tests += instspc-$test_name-install.test"
+  done
+  exit 0
+fi
+
+###  If we are still here, we have to run a test ...
+
+# We'll need the full setup provided by `tests/defs'.  Temporarly disable
+# the errexit flag, since the setup code might not be prepared to deal
+# with it.
+set +e
+. ./defs || Exit 99
+set -e
+
+eval "instspc_test_string=\${instspc__$instspc_test_name}" || Exit 99
+if test x"$instspc_test_string" = x; then
+  echo "$me: invalid test name: '$instspc_test_name'" >&2
+  Exit 99
+fi
+
+# Skip if this system doesn't support these characters in file names.
+mkdir "./$instspc_test_string" || Exit 77
+
+mkdir sub sub1
+
+cat >> configure.in << 'EOF'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+EOF
+
+: > sub/base.h
+: > sub/nobase.h
+: > sub/base.dat
+: > sub/nobase.dat
+: > sub/base.sh
+: > sub/nobase.sh
+
+cat > source.c << 'EOF'
+int
+main (int argc, char **argv)
+{
+  return 0;
+}
+EOF
+cp source.c source2.c
+
+cat > Makefile.am << 'EOF'
+foodir = $(prefix)/foo
+fooexecdir = $(prefix)/foo
+
+foo_HEADERS = sub/base.h
+nobase_foo_HEADERS = sub/nobase.h
+
+dist_foo_DATA = sub/base.dat
+nobase_dist_foo_DATA = sub/nobase.dat
+
+dist_fooexec_SCRIPTS = sub/base.sh
+nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
+
+fooexec_PROGRAMS = sub/base
+nobase_fooexec_PROGRAMS = sub/nobase
+sub_base_SOURCES = source.c
+sub_nobase_SOURCES = source.c
+
+fooexec_LIBRARIES = sub/libbase.a
+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'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+case $instspc_action in
+  test-build)
+    build=$instspc_test_string
+    dest=`pwd`/sub1
+    ;;
+  test-install)
+    build=sub1
+    dest=`pwd`/$instspc_test_string
+    ;;
+  *)
+    echo "$me: internal error: invalid action '$instspc_action'"
+    Exit 99
+    ;;
+esac
+
+cd "./$build"
+
+../configure --prefix "/$instspc_test_string-prefix"
+$MAKE
+DESTDIR="$dest" file="$instspc_test_string" $MAKE -e test-install-sep
+
+:
diff --git a/tests/instspc.test b/tests/instspc.test
deleted file mode 100755 (executable)
index 414b3e5..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004, 2005  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/>.
-
-# Check that installation to directory with shell metacharacters succeed.
-# Original report from James Amundson about file names with spaces.
-# Other characters added by Paul Eggert.
-
-# This is mostly the same input as nobase.test, but we do not use
-# libtool libraries, because Libtool does not preserve space in
-# 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.
-
-cat >> configure.in <<'EOF'
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_OUTPUT
-EOF
-
-mkdir sub
-
-: > sub/base.h
-: > sub/nobase.h
-: > sub/base.dat
-: > sub/nobase.dat
-: > sub/base.sh
-: > sub/nobase.sh
-
-cat >source.c <<'EOF'
-int
-main (int argc, char **argv)
-{
-  return 0;
-}
-EOF
-cp source.c source2.c
-
-cat > Makefile.am << 'EOF'
-foodir = $(prefix)/foo
-fooexecdir = $(prefix)/foo
-
-foo_HEADERS = sub/base.h
-nobase_foo_HEADERS = sub/nobase.h
-
-dist_foo_DATA = sub/base.dat
-nobase_dist_foo_DATA = sub/nobase.dat
-
-dist_fooexec_SCRIPTS = sub/base.sh
-nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
-
-fooexec_PROGRAMS = sub/base
-nobase_fooexec_PROGRAMS = sub/nobase
-sub_base_SOURCES = source.c
-sub_nobase_SOURCES = source.c
-
-fooexec_LIBRARIES = sub/libbase.a
-nobase_fooexec_LIBRARIES = sub/libnobase.a
-sub_libbase_a_SOURCES = source.c
-sub_libnobase_a_SOURCES = source.c
-
-test-install-sep: install
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
-EOF
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-# Some control characters that are white space:
-# back space, carriage return, form feed, horizontal tab, line feed, space
-bs='\b'
-cr='\r'
-ff='\f'
-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
-
-Exit $fail