]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: use TAP for `instspc*' tests, related simplifications
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 6 Aug 2011 10:35:05 +0000 (12:35 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 6 Aug 2011 11:22:16 +0000 (13:22 +0200)
* tests/instspc-tests.sh: Delete this complex and multifarious
script, moving all it checks it used to perform into ...
* tests/instspc.tap: ... this TAP-based test script.
* tests/instspc-data.test: Deleted.
* tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include
nor generate it anymore.
(EXTRA_DIST): Don't distribute instspc-tests.sh anymore.
(TEST_EXTENSIONS): Remove '.instspc'.
(INSTSPC_LOG_COMPILER): Deleted.
(XFAIL_TESTS): Remove $(instspc_xfail_tests).
(instspc-data.log, $(instspc_tests:.instspc=.log)): Delete
dependencies for these files, which are not used anymore.
($(instspc_tests)): Delete this dummy dependency declaration.
(TESTS): Remove $(instspc_tests).
(handwritten_tests): Remove instspc-data.test, add instspc.tap.
* bootstrap: Don't generate tests/instspc-tests.am anymore.

ChangeLog
bootstrap
tests/Makefile.am
tests/Makefile.in
tests/instspc-data.test [deleted file]
tests/instspc.tap [moved from tests/instspc-tests.sh with 53% similarity]

index 6f58794f852666bce78afd1ec3c0546f1e2371b7..2af559c0460d20ece7088b90b1afaf2392975c87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use TAP for `instspc*' tests, related simplifications
+       * tests/instspc-tests.sh: Delete this complex and multifarious
+       script, moving all it checks it used to perform into ...
+       * tests/instspc.tap: ... this TAP-based test script.
+       * tests/instspc-data.test: Deleted.
+       * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include
+       nor generate it anymore.
+       (EXTRA_DIST): Don't distribute instspc-tests.sh anymore.
+       (TEST_EXTENSIONS): Remove '.instspc'.
+       (INSTSPC_LOG_COMPILER): Deleted.
+       (XFAIL_TESTS): Remove $(instspc_xfail_tests).
+       (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete
+       dependencies for these files, which are not used anymore.
+       ($(instspc_tests)): Delete this dummy dependency declaration.
+       (TESTS): Remove $(instspc_tests).
+       (handwritten_tests): Remove instspc-data.test, add instspc.tap.
+       * bootstrap: Don't generate tests/instspc-tests.am anymore.
+
 2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: do fd redirections with $(AM_TESTS_FD_REDIRECT)
index aafc6eb3faadf3cb83c380238c0c1a93248ed3cc..1abf39b63dad70c21080592a27b9b17416f9b171 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -107,7 +107,6 @@ dosubst automake.in automake.tmp
 cd tests
 $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
 $BOOTSTRAP_SHELL ./gen-config-shell-tests > config-shell-tests.am
-$BOOTSTRAP_SHELL ./instspc-tests.sh --generate-makefile > instspc-tests.am
 $BOOTSTRAP_SHELL ./depmod-tests.sh --generate-makefile > depmod-tests.am
 cd ..
 
index 6a404c7f5cc2e576a906d9961f8f4eb287383f22..182e987140ef1e268d2a6fefbf039dae7ac287ad 100644 (file)
@@ -66,28 +66,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh
 $(parallel_tests):
 
 
-include $(srcdir)/instspc-tests.am
-
-TEST_EXTENSIONS += .instspc
-INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh
-EXTRA_DIST += instspc-tests.sh
-
-$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am
-       $(AM_V_GEN)($(am__cd) $(srcdir) \
-         && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@
-
-# 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:.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):
-
-XFAIL_TESTS += $(instspc_xfail_tests)
-
-
 include $(srcdir)/depmod-tests.am
 
 $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am
@@ -149,12 +127,14 @@ TESTS = \
   $(handwritten_tests) \
   $(config_shell_tests) \
   $(parallel_tests) \
-  $(depmod_tests) \
-  $(instspc_tests)
+  $(depmod_tests)
 
 EXTRA_DIST += $(handwritten_tests)
 
 handwritten_tests = \
+## This test should take a long time, so put it first to improve
+## performance on concurrent testsuite runs.
+instspc.tap \
 aclocal.test \
 aclocal3.test \
 aclocal4.test \
@@ -577,7 +557,6 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc-data.test \
 interp.test \
 interp2.test \
 java.test \
index c79e5232c26ca2a41a25a61963b5c4a41dfc9dc5..47a1b695bc565322c17cdb96e64eb75710aa0f3c 100644 (file)
@@ -53,8 +53,7 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/aclocal.in $(srcdir)/automake.in \
        $(srcdir)/config-shell-tests.am $(srcdir)/defs \
        $(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \
-       $(srcdir)/instspc-tests.am $(srcdir)/parallel-tests.am \
-       $(top_srcdir)/CheckListOfTests.am
+       $(srcdir)/parallel-tests.am $(top_srcdir)/CheckListOfTests.am
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -187,15 +186,11 @@ am__test_logs4 = $(am__test_logs3:.ptest.log=.log)
 PTEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver
 PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \
        $(PTEST_LOG_FLAGS)
-am__test_logs5 = $(am__test_logs4:.instspc.log=.log)
-INSTSPC_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver
-INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \
-       $(INSTSPC_LOG_FLAGS)
-am__test_logs6 = $(am__test_logs5:.depmod.log=.log)
+am__test_logs5 = $(am__test_logs4:.depmod.log=.log)
 DEPMOD_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver
 DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \
        $(DEPMOD_LOG_FLAGS)
-TEST_LOGS = $(am__test_logs6:.shtst.log=.log)
+TEST_LOGS = $(am__test_logs5:.shtst.log=.log)
 SHTST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver
 SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \
        $(SHTST_LOG_FLAGS)
@@ -298,25 +293,32 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-TEST_EXTENSIONS = .test .tap .ptest .instspc .depmod .shtst
+TEST_EXTENSIONS = .test .tap .ptest .depmod .shtst
 TAP_LOG_DRIVER = $(PERL) $(top_srcdir)/lib/tap-driver
 TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string `printf \
        '\043%%\043\n'`
 MAINTAINERCLEANFILES = 
 EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \
-       instspc-tests.sh depmod-tests.sh gen-config-shell-tests \
-       config-shell-tests.sh $(handwritten_tests) tap-functions.sh \
-       plain-functions.sh trivial-test-driver \
-       testsuite-summary-checks.sh extract-testsuite-summary \
-       tap-setup.sh tap-summary-aux.sh
+       depmod-tests.sh gen-config-shell-tests config-shell-tests.sh \
+       $(handwritten_tests) tap-functions.sh plain-functions.sh \
+       trivial-test-driver testsuite-summary-checks.sh \
+       extract-testsuite-summary tap-setup.sh tap-summary-aux.sh
 
 # Run the tests with the shell detected at configure time.
 TEST_LOG_COMPILER = $(SHELL)
-XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
-       override-conditional-2.test pr8365-remake-timing.test \
-       yacc-dist-nobuild-subdir.test tap-plan-corner2.test \
-       tap-message-0.test tap-signal.test txinfo5.test \
-       $(instspc_xfail_tests)
+XFAIL_TESTS = \
+all.test \
+auxdir2.test \
+cond17.test \
+gcj6.test \
+override-conditional-2.test \
+pr8365-remake-timing.test \
+yacc-dist-nobuild-subdir.test \
+tap-plan-corner2.test \
+tap-message-0.test \
+tap-signal.test \
+txinfo5.test
+
 parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \
        check-fd-redirect-p.ptest check-subst-prog-p.ptest \
        check-subst-p.ptest check-tests-in-builddir-p.ptest \
@@ -327,58 +329,6 @@ parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \
        maken3-p.ptest maken4-p.ptest posixsubst-tests-p.ptest \
        tests-environment-p.ptest
 PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh
-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
 depmod_tests = depcomp-gcc3.depmod depcomp-gcc.depmod \
        depcomp-hp.depmod depcomp-sgi.depmod depcomp-aix.depmod \
        depcomp-icc.depmod depcomp-hp2.depmod depcomp-tru64.depmod \
@@ -416,10 +366,10 @@ TESTS = \
   $(handwritten_tests) \
   $(config_shell_tests) \
   $(parallel_tests) \
-  $(depmod_tests) \
-  $(instspc_tests)
+  $(depmod_tests)
 
 handwritten_tests = \
+instspc.tap \
 aclocal.test \
 aclocal3.test \
 aclocal4.test \
@@ -842,7 +792,6 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc-data.test \
 interp.test \
 interp2.test \
 java.test \
@@ -1508,8 +1457,8 @@ am__tdf = diff-in-tests-lists.tmp
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .depmod .html .instspc .log .ptest .shtst .tap .test .trs
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/instspc-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
+.SUFFIXES: .depmod .html .log .ptest .shtst .tap .test .trs
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -1732,11 +1681,6 @@ recheck recheck-html:
        --log-file '$*.log' --trs-file '$*.trs' \
        $(am__common_driver_flags) $(AM_PTEST_LOG_DRIVER_FLAGS) $(PTEST_LOG_DRIVER_FLAGS) -- $(PTEST_LOG_COMPILE) "$$tst" \
        $(AM_TESTS_FD_REDIRECT)
-.instspc.log:
-       @p='$<'; $(am__check_pre) $(INSTSPC_LOG_DRIVER) --test-name "$$f" \
-       --log-file '$*.log' --trs-file '$*.trs' \
-       $(am__common_driver_flags) $(AM_INSTSPC_LOG_DRIVER_FLAGS) $(INSTSPC_LOG_DRIVER_FLAGS) -- $(INSTSPC_LOG_COMPILE) "$$tst" \
-       $(AM_TESTS_FD_REDIRECT)
 .depmod.log:
        @p='$<'; $(am__check_pre) $(DEPMOD_LOG_DRIVER) --test-name "$$f" \
        --log-file '$*.log' --trs-file '$*.trs' \
@@ -1933,19 +1877,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh
 # expected log files from the `.ptest.log' suffix rule.
 $(parallel_tests):
 
-$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am
-       $(AM_V_GEN)($(am__cd) $(srcdir) \
-         && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@
-
-# 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:.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):
-
 $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am
        $(AM_V_GEN)($(am__cd) $(srcdir) \
          && $(SHELL) ./depmod-tests.sh --generate-makefile) >$@
diff --git a/tests/instspc-data.test b/tests/instspc-data.test
deleted file mode 100755 (executable)
index 7b222ff..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# 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/>.
-
-# 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.
-# FIXME: we employ useless quoting below to please maintainer-check.
-. ./defs-static || 'exit' 99
-
-# Sanity check.
-if test x"$testsrcdir" = x; then
-  echo "$0: \$testsrcdir not set after sourcing of ./defs-static" >&2
-  # FIXME: we employ useless quoting below to please maintainer-check.
-  'exit' 99
-fi
-
-exec $SHELL $testsrcdir/instspc-tests.sh --generate-data
similarity index 53%
rename from tests/instspc-tests.sh
rename to tests/instspc.tap
index 9c6c968633baebf6af93d1f169bb58f5244d0dfd..ed57eb29d721d7cb00f287376351e2151398ba66 100755 (executable)
 # 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 run tests checking that building from, or installing
-# to, directories with shell metacharacters succeed.
-#
+# Check 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 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').
-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
-# We need this early.  It will be overridden when we source ./defs below,
-# which will offer a more proper implementation.
-fatal_ () { echo "$0: $*" >&2; exit 99; }
-
-case $# in
-  0) fatal_ "missing argument";;
-  1) ;;
-  *) fatal_ "too many arguments";;
-esac
-
-case $1 in
-  --generate-makefile|--generate-data)
-    instspc_action=`expr x"$1" : x'--\(.*\)'`
-    ;;
-  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'`
-    ;;
-  *)
-    fatal_ "invalid argument '$1'"
-    ;;
-esac
+. ./defs || Exit 99
 
 # Helper subroutine for test data definition.
 # Usage: define_problematic_string NAME STRING
 define_problematic_string ()
 {
-  tst=$1
-  shift
+  tst=$1; shift
   eval "instspc__$tst=\$1" \
     || fatal_ "define_problematic_string: bad argument: '$tst'"
   shift
@@ -94,16 +42,34 @@ define_problematic_string ()
   esac
 }
 
-# Helper subroutines for creation of input data files.
+# Be sure to avoid interferences from the environment.
+instspc_names_list=''
+instspc_xfail_builds_list=''
+instspc_xfail_installs_list=''
+
+expected_to_fail ()
+{
+   case $1 in
+     build)
+       case " $instspc_xfail_builds_list " in
+         *" $2 "*) return 0 ;;
+                *) return 1 ;;
+       esac;;
+     dest)
+       case " $instspc_xfail_installs_list " in
+         *" $2 "*) return 0 ;;
+                *) return 1 ;;
+       esac;;
+    esac
+    fatal_ "incorrect 'expected_to_fail' usage"
+}
 
+# Helper subroutines for creation of input data files.
 create_input_data ()
 {
   mkdir sub
 
-  unindent > configure.in << 'EOF'
-    AC_INIT([instspc], [1.0])
-    AM_INIT_AUTOMAKE
-    AC_CONFIG_FILES([Makefile])
+  unindent >> configure.in << 'EOF'
     AC_PROG_CC
     AC_PROG_RANLIB
     AC_OUTPUT
@@ -147,8 +113,8 @@ EOF
     sub_libbase_a_SOURCES = source.c
     sub_libnobase_a_SOURCES = source.c
 
-    .PHONY: test-install-sep
-    test-install-sep: install
+    .PHONY: test-inst
+    test-inst: 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'
@@ -169,16 +135,8 @@ EOF
   $ACLOCAL
   $AUTOCONF
   $AUTOMAKE -a
-
-  : > success
 }
 
-# Be sure to avoid interferences from the environment.
-instspc_names_list=''
-instspc_xfail_builds_list=''
-instspc_xfail_installs_list=''
-
-
 # ================= #
 #  Test data begin  #
 # ----------------- #
@@ -248,96 +206,61 @@ unset def
 #  Test data end  #
 # =============== #
 
+ocwd=`pwd` || fatal_ "cannot get current working directory"
 
-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 += 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 += build-$test_name.instspc"
-  done
-  for test_name in $instspc_xfail_installs_list; do
-    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.  Also pre-set `$me' for `tests/defs', so that different calls
-# to `instspc-tests.sh' won't try to use the same temporary directory.
-# The actual tests require a C compiler, so require it for them; but do
-# not require it when generating data, as it's not needed then.
-if test x"$instspc_action" = x"generate-data"; then
-  me=instspc-data
-else
-  required=cc
-  me=$instspc_action-$instspc_test_name
-fi
-set +e
-. ./defs || Exit 99
-set -e
-
-# The directory set up by the `generate-data' action should contain all
-# the files we need.  So remove the other files created by ./defs.  And
-# check we really are in a temporary `*.dir' directory in the build tree,
-# since the last thing we want is to remove some random user files!
-test -f ../defs-static && test -f ../defs \
-  && case `pwd` in *.dir) :;; *) false;; esac \
-  || fatal_ "running from the wrong directory"
-rm -f *
-
-if test x"$instspc_action" = x"generate-data"; then
-  # We must *not* remove the test directory, since its contents must be
-  # used by following dependent tests.
-  keep_testdirs=yes
-  create_input_data
-  Exit 0
-fi
-
-###  If we are still here, we have to run a test ...
-
-eval "instspc_test_string=\${instspc__$instspc_test_name}" \
-  && test x"$instspc_test_string" != x \
-  || fatal_ "invalid test name: '$instspc_test_name'"
-
-if test ! -f ../instspc-data.dir/success; then
-  framework_failure_ "instspc-data.test failure"
-fi
-
-# Skip if this system doesn't support these characters in file names.
-mkdir "./$instspc_test_string" || Exit 77
-
-case $instspc_action in
-  test-build)
-    dest=`pwd`/_dest
-    relbuilddir=../..
-    cd "./$instspc_test_string"
-    ;;
-  test-install)
-    dest=`pwd`/$instspc_test_string
-    relbuilddir=..
-    ;;
-  *)
-    fatal_ "invalid action '$instspc_action'"
-    ;;
-esac
-
-$relbuilddir/instspc-data.dir/configure \
-  --prefix "/$instspc_test_string-prefix"
-$MAKE
-# Some make implementations eliminate leading and trailing whitespace
-# from macros passed on the command line, and some eliminate leading
-# whitespace from macros set from environment variables, so prepend
-# './' and use the latter here.
-# Tru64 sh -e needs '|| Exit' in order to work correctly.
-DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-install-sep \
-  || Exit 1
+create_input_data
+
+for test_name in $instspc_names_list; do
+
+  eval "instspc_test_string=\${instspc__$test_name}" \
+    && test x"$instspc_test_string" != x \
+    || fatal_ "invalid test name: '$test_name'"
+
+  # Skip the next checks if this system doesn't support the required
+  # characters in file names.
+
+  mkdir "./$instspc_test_string" || \
+    skip_row_ 2 -r "mkdir failed" "$test_name"
+
+  for where in build dest; do
+
+    case $where in
+      build)
+        build=./$instspc_test_string
+        dest=$ocwd/dest-$test_name
+        ;;
+      dest)
+        build=build-$test_name
+        dest=$ocwd/$instspc_test_string
+        mkdir "$build" || fatal_ "cannot create '$build'"
+        ;;
+      *)
+        fatal_ "invalid where '$where'"
+        ;;
+    esac
+
+    cd "$build" || fatal_ "cannot chdir into '$build'"
+
+    # Some make implementations eliminate leading and trailing whitespace
+    # from macros passed on the command line, and some eliminate leading
+    # whitespace from macros set from environment variables, so prepend
+    # './' and use the latter here.
+    r=ok
+    ../configure --prefix "/$instspc_test_string-prefix" \
+      && $MAKE all \
+      && DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-inst \
+      || r='not ok'
+
+    tap_text="$test_name in ${where}dir"
+    if expected_to_fail "$where" "$test_name"; then
+      tap_text="$tap_text # TODO long-standing limitation"
+    fi
+    result_ "$r" "$tap_text"
+
+    cd "$ocwd" || fatal_ "cannot chdir back to test directory"
+
+  done # $instspc_action
+
+done # $test_name
 
 :