Merge branch 'fix-pr11806' into maint
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 6 Jul 2012 19:29:52 +0000 (21:29 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 6 Jul 2012 19:29:52 +0000 (21:29 +0200)
* fix-pr11806:
  lisp: better support of VPATH builds

19 files changed:
.gitignore
Makefile.am
configure.ac
defs
t/README
t/ax/test-runner.in [new file with mode: 0644]
t/list-of-tests.mk
t/parallel-tests-log-override-recheck.sh
t/parallel-tests9.sh
t/self-check-cleanup.tap [deleted file]
t/self-check-dir.tap
t/self-check-exit.tap
t/self-check-explicit-skips.sh
t/self-check-me.tap
t/self-check-reexec.tap [deleted file]
t/tap-recheck.sh
t/test-driver-custom-multitest-recheck.sh
t/test-driver-custom-multitest-recheck2.sh
t/yacc-deleted-headers.sh

index 130b390..2b9edac 100644 (file)
@@ -37,6 +37,7 @@
 /t/wrap/automake-1.*
 /defs-static
 /t/testsuite-part.am
+/t/ax/test-runner
 /t/*-w.tap
 /t/*-w.sh
 /t/depcomp-*.tap
index b745721..f55f6fb 100644 (file)
@@ -345,11 +345,6 @@ AM_TESTS_ENVIRONMENT = \
   ; do \
     eval test x"\$${$$v}" = x || unset $$v; \
   done;
-# The 'AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
-# re-execute themselves with the shell detected at configure time, since
-# we are already running them under it explicitly in our setup (see e.g.
-# the definition of TEST_LOG_COMPILER above).
-AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
 # We want warning messages and explanations for skipped tests to go to
 # the console if possible, so set up 'stderr_fileno_' properly.
 AM_TESTS_FD_REDIRECT = 9>&2
index 7d30762..10fa93d 100644 (file)
@@ -559,6 +559,7 @@ AC_SUBST([EXEEXT])
 ## ---------------------- ##
 
 AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([t/ax/test-runner], [chmod +x t/ax/test-runner])
 
 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
 AC_CONFIG_LINKS([defs:defs])
diff --git a/defs b/defs
index 143be66..df85746 100644 (file)
--- a/defs
+++ b/defs
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# *** IMPORTANT NOTE ***
-# This file should execute correctly with any system's /bin/sh (which
-# might be just a Bourne shell, non POSIX-conforming, like on Solaris
-# up to version 11 at least).
-
 # Source the shell static setup and variable definitions.
-. ./defs-static
-test $? -eq 0 || exit 99
-
-# Make sure we run with the shell detected at configure time or forced
-# by the user (unless the user forbids it).  That is assumed to be a
-# proper POSIX shell.
-case ${AM_TESTS_REEXEC-yes} in
-  n|no|false|0)
-    ;;
-  *)
-    # Ensure we can find ourselves.
-    if test ! -f "$argv0"; then
-      echo "$me: unable to find myself: '$argv0'" >&2
-      exit 99
-    fi
-    AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-    # Cannot simply do "opts=$-", since the content of $- is not
-    # portable among different shells.  So try to propagate only
-    # the portable and interesting options.
-    case $- in
-      *x*v*|*v*x) opts=-vx;;
-      *v*) opts=-v;;
-      *x*) opts=-x;;
-      *) opts=;;
-    esac
-    echo exec $AM_TEST_RUNNER_SHELL $opts "$argv0" "$*"
-    exec $AM_TEST_RUNNER_SHELL $opts "$argv0" ${1+"$@"}
-    # This should be dead code, unless some strange error happened. 
-    echo "$me: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
-    exit 99
-    ;;
-esac
+. ./defs-static; test $? -eq 0 || exit 99
 
 # Source the actual test initialization and setup code, and return
 # control to the test script that is sourcing us.
index fe86229..f96fefe 100644 (file)
--- a/t/README
+++ b/t/README
@@ -70,45 +70,39 @@ About the tests
   There are two kinds of tests in the Automake testsuite (both implemented
   as shell scripts).  The scripts with the '.sh' suffix are "simple"
   tests, their outcome completely determined by their exit status.  Those
-  with the '.tap' suffix use the TAP protocol.  If you want to run a test
-  by hand, you can do so directly if it is a simple test:
+  with the '.tap' suffix use the TAP protocol.
 
-    ./t/nogzip.sh
+  If you want to run a test by hand, you should be able to do so using the
+  'test-runner' script:
 
-  (it will be verbose by default), while if it is a TAP test you can pass
-  it to your preferred TAP runner, as in e.g.:
+      ./t/ax/test-runner t/nogzip.sh
+      ./t/ax/test-runner t/add-missing.tap
 
-    prove --verbose --merge ./t/add-missing.tap
-
-  The tests can also be run directly in a VPATH build, as with:
-
-    /path/to/srcdir/t/nogzip.sh
-    prove --verbose --merge /path/to/srcdir/t/add-missing.tap
+  This will run the test using the correct shell, and should also work in
+  VPATH builds.  Note that, to run the TAP tests this way, you'll need to
+  have the prove(1) utility available in $PATH.
 
 
 Supported shells
 ----------------
 
-  By default, the tests are run by the $SHELL detected at configure
-  time.  They also take care to re-execute themselves with that shell,
-  unless told not to.  So, to run the tests with a different shell, say
-  '/path/to/another/sh', the user must use:
-
-    AM_TESTS_REEXEC=no /path/to/another/sh ./t/foo.sh
-    AM_TESTS_REEXEC=no prove -v -e /path/to/another/sh ./t/bar.tap
+  By default, the tests are run by a proper shell detected at configure
+  time.  Here is how you can run the tests with a different shell, say
+  '/bin/my-sh':
 
-  to run a test directly, and:
+    # Running through the makefile test driver.
+    make check AM_TEST_RUNNER_SHELL=/bin/my-sh         (GNU make)
+    AM_TEST_RUNNER_SHELL=/bin/my-sh make -e check      (non-GNU make)
 
-    make check LOG_COMPILER=/path/to/sh         (GNU make)
-    LOG_COMPILER=/path/to/sh make -e check      (non-GNU make)
+    # Run a test directly from the command line.
+    AM_TEST_RUNNER_SHELL=/bin/my-sh ./t/ax/test-runner t/foo.sh
 
-  to run the test(s) through the makefile test driver.
 
-  The test scripts are written with portability in mind, so that they
-  should run with any decent Bourne-compatible shell.  However, it is
-  worth nothing that older versions of Zsh (pre-4.3) exhibited several
-  bugs and incompatibilities with our uses, and are thus not supported
-  for running Automake's test scripts.
+  The test scripts are written with portability in mind, and should run
+  with any decent POSIX shell.  However, it is worth nothing that older
+  versions of Zsh (pre-4.3) exhibited several bugs and incompatibilities
+  with our uses, and are thus not supported for running Automake's test
+  scripts.
 
 
 Reporting failures
diff --git a/t/ax/test-runner.in b/t/ax/test-runner.in
new file mode 100644 (file)
index 0000000..31f8e01
--- /dev/null
@@ -0,0 +1,62 @@
+#!@AM_TEST_RUNNER_SHELL@
+#
+# Copyright (C) 2012 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/>.
+
+# Run an Automake test from the command line.
+# Usage:
+
+set -e; set -u
+
+: ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'}
+: ${AM_PROVE_CMD='prove'}
+: ${AM_PROVEFLAGS='--merge --verbose'}
+: ${srcdir='@srcdir@'}
+
+error () { echo "$0: $*" >&2; exit 255; }
+
+# Some shell flags should be passed over to the test scripts.
+#while test $# -gt 0; do
+#  case $1 in
+#    --help) echo "Usage: $0 [SHELL-OPTIONS] TEST [TEST-OPTIONS]"; exit $?;;
+#    -*)
+#  esac
+#done
+
+test $# -gt 0 || error "missing argument"
+
+tst=$1; shift
+
+case $tst in
+   *.sh) wrapper () { exec "$@"; };;
+  *.tap) wrapper () { exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e "$@"; };;
+      *) error "test '$tst' has an unrecognized extension";;
+esac
+
+case $tst in
+  /*) ;;
+   *) if test -f ./$tst; then
+        tst=./$tst
+      # Support for VPATH build.
+      elif test -f $srcdir/$tst; then
+        tst=$srcdir/$tst
+      else
+        error "could not find test '$tst'"
+      fi
+      ;;
+esac
+
+wrapper "$AM_TEST_RUNNER_SHELL" "$tst" "$@"
+error "dead code reached"
index dd88819..53b2439 100644 (file)
@@ -956,7 +956,6 @@ t/reqd.sh \
 t/reqd2.sh \
 t/repeated-options.sh \
 t/rulepat.sh \
-t/self-check-cleanup.tap \
 t/self-check-configure-help.sh \
 t/self-check-dir.tap \
 t/self-check-env-sanitize.tap \
@@ -964,7 +963,6 @@ t/self-check-exit.tap \
 t/self-check-explicit-skips.sh \
 t/self-check-is_newest.tap \
 t/self-check-me.tap \
-t/self-check-reexec.tap \
 t/self-check-report.sh \
 t/self-check-seq.tap \
 t/self-check-is-blocked-signal.tap \
index 493fbfe..79c16fc 100755 (executable)
@@ -77,6 +77,8 @@ for x in stdout my.log; do
   $FGREP bazbaz $x
 done
 
+using_gmake || $sleep # Required by BSD make.
+
 chmod a-rw my.log
 BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log $MAKE -e recheck >stdout \
   && { cat stdout; exit 1; }
index 583c674..ea9dba6 100755 (executable)
@@ -59,12 +59,17 @@ $MAKE check >stdout && { cat stdout; exit 1; }
 cat stdout
 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
 
-$MAKE recheck >stdout && { cat stdout; exit 1; }
-cat stdout
-count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
-grep 'foo\.test' stdout && exit 1
-grep '^ERROR: bar\.test$' stdout
-grep '^FAIL: baz\.test$' stdout
+# Running this two times in a row should produce the same results the
+# second time.
+for i in 1 2; do
+  using_gmake || $sleep # Required by BSD make.
+  $MAKE recheck >stdout && { cat stdout; exit 1; }
+  cat stdout
+  count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
+  grep 'foo\.test' stdout && exit 1
+  grep '^ERROR: bar\.test$' stdout
+  grep '^FAIL: baz\.test$' stdout
+done
 
 # Ensure that recheck builds check_SCRIPTS, and that
 # recheck reruns nothing if check has not been run.
diff --git a/t/self-check-cleanup.tap b/t/self-check-cleanup.tap
deleted file mode 100755 (executable)
index 2c5a9a9..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-2012 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/>.
-
-# Sanity check for the automake testsuite.
-# Check creation/removal of temporary test working directory by './defs'.
-
-. ./defs || exit 1
-
-plan_ 43
-
-# We still need a little hack to make ./defs work outside automake's
-# tree 'tests' subdirectory.  Not a big deal.
-sed "s|^am_top_builddir=.*|am_top_builddir='$(pwd)'|" \
-  "$am_top_builddir"/defs-static >defs-static
-diff "$am_top_builddir"/defs-static defs-static \
-  && fatal_ "failed to edit defs-static"
-cp "$am_top_builddir"/defs .
-
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-keep_testdirs=; unset keep_testdirs
-
-if ln -s defs foo && test -h foo; then
-  have_symlinks=yes
-else
-  have_symlinks=no
-fi
-export have_symlinks # Is used also by spawned shells.
-
-# Don't let a failure poison all subsequent tests.
-do_clean_setup ()
-{
-  # Don't try to be smart and use find here, that has caused issues
-  # and extra ERROR results in the past.  Be dumb and safe.
-  for d in t t/* t/*/* t/*/*/*; do
-    test ! -d $d || chmod u+rwx $d || :
-  done
-  rm -rf t
-}
-
-do_clean_setup
-
-# Exporting 'keep_testdirs' to "yes" in the environment should cause
-# the cleanup code not to be run, so that the temporary directories
-# are left on disk.
-command_ok_ '"keep_testdirs=yes" causes testdir to be kept around' eval '
-     env keep_testdirs=yes \
-       $AM_TEST_RUNNER_SHELL -c ". ./defs && echo okok >foo" t/dummy.sh \
-     && test -f t/dummy.dir/foo \
-     && test okok = $(cat t/dummy.dir/foo)'
-
-do_clean_setup
-
-# Check that pre-test cleanup works also with directories with
-# "null" permissions, and containing broken symlinks.
-mkdir t t/dummy.dir t/dummy.dir/sub
-(
-  cd t/dummy.dir
-  touch file sub/file
-  if test $have_symlinks = yes; then
-    ln -s file symlink
-    ln -s none brokenlink
-  fi
-)
-chmod 000 t/dummy.dir/sub/* t/dummy.dir/file
-test $have_symlinks = yes && chmod 000 t/dummy.dir/symlink
-chmod 500 t/dummy.dir/sub t/dummy.dir
-command_ok_ "pre-cleanup can deal with low-perms testdir" \
-            $AM_TEST_RUNNER_SHELL -c  '. ./defs' t/dummy.sh
-command_ok_ "pre-cleanup removed low-perms testdir" \
-            test ! -e t/dummy.dir
-
-do_clean_setup
-
-# Check that post-test cleanup works also with directories with
-# "null" permissions, and containing broken symlinks.
-command_ok_ "post-cleanup can deal with low-perms testdir" \
-            $AM_TEST_RUNNER_SHELL -c  '
-  stderr_fileno_=2
-  . ./defs || exit 1
-  set -e
-  mkdir dir dir/sub
-  cd dir
-  touch file sub/file
-  if test $have_symlinks = yes; then
-    ln -s file symlink
-    ln -s none brokenlink
-  fi
-  cd ..
-  chmod 000 dir/sub/* dir/file
-  test $have_symlinks = yes && chmod 000 dir/symlink
-  chmod 500 dir/sub dir
-  :
-' t/dummy.sh
-command_ok_ "post-cleanup removed null-perms testdir" \
-            test ! -e t/dummy.dir
-
-do_clean_setup
-
-# Check that pre-test cleanup does not unduly change the permissions of
-# files to which symlinks in the temporary test directory point to.
-if test $have_symlinks = yes; then
-
-  mkdir dir
-  chmod 000 dir
-  : > file
-  chmod 000 file
-
-  mkdir t t/dummy.dir
-  (cd t/dummy.dir && ln -s ../../dir ../../file .)
-
-  command_ok_ "pre-cleanup with testdir with zero-perms symlinks" \
-               $AM_TEST_RUNNER_SHELL -c '. ./defs' t/dummy.sh
-  ls -l # For debugging.
-  command_ok_ "pre-cleanup chmod doesn't follow symlinks to files" \
-               eval 'ls -l file | grep "^----------.*file"'
-  command_ok_ "pre-cleanup chmod doesn't follow symlinks to dirs" \
-              eval 'ls -ld dir | grep "^d---------.*dir"'
-
-  command_ok_ "post-cleanup with testdir with zero-perms symlinks" \
-              $AM_TEST_RUNNER_SHELL -c '
-    ocwd=$(pwd) || exit 1
-    stderr_fileno_=2
-    . ./defs || exit 1
-    ln -s "$ocwd/dir" "$ocwd/file" .
-  ' t/dummy.sh
-  ls -l # For debugging.
-  command_ok_ "post-cleanup chmod doesn't follow symlinks to files" \
-               eval 'ls -l file | grep "^----------.*file"'
-  command_ok_ "post-cleanup chmod doesn't follow symlinks to dirs" \
-              eval 'ls -ld dir | grep "^d---------.*dir"'
-
-  chmod u+rwx dir file
-  rmdir dir
-  rm -f file
-
-else # $have_symlinks = no
-  skip_row_ 6 "symlinks not supported"
-fi
-
-do_clean_setup
-
-# Check that the cleanup trap does not remove the temporary
-# test directory in case of test failure, skip, hard-error,
-# or when receiving a signal.
-
-for st in 1 2 3 10 77 99 126 127 130 255; do
-  command_ok_ "exit trap doesn't clobber exit status $st" \
-              not $AM_TEST_RUNNER_SHELL -c "
-    stderr_fileno_=2
-    . ./defs
-    : > foo
-    exit $st
-  " t/dummy.sh
-  command_ok_ "testdir not removed if exiting with status $st" \
-              test -f t/dummy.dir/foo
-  do_clean_setup
-done
-
-for sig in 1 2 3 9 13 15; do
-  if is_blocked_signal $sig; then
-    skip_row_ 2 -r "signal $sig seems blocked"
-    continue
-  fi
-  command_ok_ "exit trap doesn't clobber signal $sig" \
-              not $AM_TEST_RUNNER_SHELL -c "
-    stderr_fileno_=2
-    . ./defs
-    : > foo
-    kill -$sig \$\$
-  " t/dummy.sh
-  command_ok_ "testdir not removed if getting signal $sig" \
-              test -f t/dummy.dir/foo
-  do_clean_setup
-done
-
-:
index 94555a6..2bc2ce0 100755 (executable)
@@ -24,7 +24,6 @@ am_create_testdir=no
 
 plan_ 5
 
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 keep_testdirs=; unset keep_testdirs
 
 # This needs to be consistent with what $AM_TEST_RUNNER_SHELL
index 4bc6710..0fbc9d8 100755 (executable)
@@ -29,8 +29,6 @@ plan_ 34
 # so that false positives remain very unlikely.
 set +e
 
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
 # It's especially important that the 'unset' is done before sourcing
 # ./defs, i.e., when 'set -e' is not active yet, for the benefit of shells
 # (like Bash 2.05 and Solaris 10 /bin/ksh) that returns a non-zero status
index 95ed313..eb60dc2 100755 (executable)
@@ -24,7 +24,6 @@ am_create_testdir=no
 set +e
 
 unset am_explicit_skips stderr_fileno_
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 
 # FIXME: this can be simplified when we improve our runtime checks on the
 # testsuite shell to ensure it supports "VAR=val shell_func" correctly.
index 717fe2e..9c3125e 100755 (executable)
@@ -22,8 +22,6 @@ am_create_testdir=no
 
 plan_ 12
 
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
 # This test becomes cumbersome if we keep the 'errexit' shell flag set.
 # And removing it is no big deal, as this test is a TAP-based one, so
 # that false positives remain very unlikely.
@@ -31,7 +29,11 @@ set +e
 
 do_check ()
 {
-  $AM_TEST_RUNNER_SHELL -c '. ./defs && echo me=$me' "$1" | grep "^me=$2$"
+  $AM_TEST_RUNNER_SHELL -c '
+    am_create_testdir=no # Do not pollute the top-level directory.
+    . ./defs
+    echo me=$me
+  ' "$1" | grep "^me=$2$"
   command_ok_ "me=$1" test $? -eq 0
 }
 
@@ -47,7 +49,12 @@ do_check abc. 'abc\.'
 
 # A definition of $me in the environment should be ignored.
 
-s=$(me=bad $AM_TEST_RUNNER_SHELL -c '. ./defs && echo me=$me' foo.sh)
+s=$(me=bad $AM_TEST_RUNNER_SHELL -c '
+  # Do not pollute the top-level directory.
+  am_create_testdir=no
+  . ./defs
+  echo me=$me
+' foo.sh)
 command_ok_ "override of \$me before ./defs causes no error" \
             test $? -eq 0
 
diff --git a/t/self-check-reexec.tap b/t/self-check-reexec.tap
deleted file mode 100755 (executable)
index f46797f..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-2012 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/>.
-
-# Sanity check for the automake testsuite.
-# Check that automatic re-execution of test script with the
-# configure-time $AM_TEST_RUNNER_SHELL.
-
-am_create_testdir=empty
-. ./defs || exit 1
-
-plan_ 32
-
-unset AM_TESTS_REEXEC BASH_VERSION || :
-
-cwd=$(pwd) || fatal_ "getting current working directory"
-cp "$am_top_builddir"/defs . || fatal_ "fetching 'defs' from top_builddir"
-
-#
-# Search for required bash and non-bash shells.
-#
-
-for bash_shell in \
-  "$SHELL" "$AM_TEST_RUNNER_SHELL" bash bash3 bash4 :
-do
-  test "$bash_shell" = : && break
-  $bash_shell --version || continue
-  $bash_shell -c 'test -n "$BASH_VERSION"' || continue
-  break
-done
-
-# This might not be optimal, but it's much better than writing wrapper
-# scripts acting as "fake" shells.
-for non_bash_shell in \
-  /bin/sh /bin/ksh sh ksh ash dash pdksh "$SHELL" "$AM_TEST_RUNNER_SHELL" :
-do
-  test "$non_bash_shell" = : && break
-  $non_bash_shell -c 'exit 0' || continue
-  # Be sure to reject also any shell that is Zsh "in disguise" (as can
-  # be found on some Debian systems, where /bin/ksh can be symlinked to
-  # /bin/zsh4).  This is required because our testsuite does not support
-  # older versions of Zsh, and that has caused spurious failures in the
-  # past.
-  $non_bash_shell -c 'test -n "$ZSH_VERSION$BASH_VERSION"' && continue
-  break
-done
-
-echo "bash_shell='$bash_shell'"
-echo "non_bash_shell='$non_bash_shell'"
-
-# This would denote an internal error.
-if test "$bash_shell" = : && test "$non_bash_shell" = :; then
-  fatal_ "we couldn't find a bash shell nor a non-bash one"
-fi
-
-#
-# Functions used throughout the test.
-#
-
-get_ddata ()
-{
-  case $1 in
-    ""|*/) dsep=;;
-        *) dsep=/;;
-  esac
-  case $1 in
-    "") dname="no dir";;
-    /*) dname="absolute dir";;
-     *) dname="dir '$1'";;
-  esac
-}
-
-get_sh ()
-{
-  case $1 in
-    bash) sh=$bash_shell;;
-    non-bash) sh=$non_bash_shell;;
-    *) fatal_ "get_sh: invalid shell type '$1'";;
-  esac
-}
-
-#
-# Check how to default, force or prevent a re-execution.
-#
-
-cat > need-bash.sh <<'END'
-#!/bin/false
-. ./defs
-# Ensure that the script gets re-executed with bash.  Also ensure that
-# non-standard syntax used after the inclusion of './defs' doesn't cause
-# non-bash shells to fail.
-# Subshell required to prevent some shells (e.g., Solaris 10 /bin/sh)
-# from only complaining on stderr but then exiting with exit status 0.
-(foo=abac && test xbxc = ${foo//a/x} && test -n "$BASH_VERSION")
-END
-
-sh_var=AM_TEST_RUNNER_SHELL
-sed -e "s|^am_top_builddir=.*|am_top_builddir='$cwd'|" \
-    -e "s|^$sh_var=.*$|$sh_var=bash; export $sh_var|" \
-    < "$am_top_builddir"/defs-static >defs-static
-
-do_reexec ()
-{
-  command_ok_ "re-exec if AM_TESTS_REEXEC=$1" \
-              env AM_TESTS_REEXEC="$1" $non_bash_shell need-bash.sh
-}
-
-dont_reexec ()
-{
-  command_ok_ "don't re-exec if AM_TESTS_REEXEC=$1" \
-              not env AM_TESTS_REEXEC="$1" $non_bash_shell need-bash.sh
-}
-
-if test "$bash_shell" = :; then
-  skip_row_ 10 -r "no bash shell found" AM_TESTS_REEXEC
-elif test "$non_bash_shell" = :; then
-  skip_row_ 10 -r "no non-bash shell found" AM_TESTS_REEXEC
-else
-  command_ok_ "re-exec if AM_TESTS_REEXEC unset" \
-              $non_bash_shell need-bash.sh
-  do_reexec ''
-  do_reexec yes
-  do_reexec y
-  do_reexec true
-  do_reexec 1
-  dont_reexec no
-  dont_reexec n
-  dont_reexec false
-  dont_reexec 0
-fi
-
-#
-# Check message about the re-execution.  Also check that arguments passed
-# to a test script are preserved by a re-exec, even in "corner" cases.
-#
-
-cat > dummy.sh <<'END'
-#!/bin/sh
-. ./defs
-:
-END
-
-cat > checkargs.sh <<'END'
-. ./defs
-test $# -eq 3 && test x"$1" = x'a' && test x"$2" = x && test x"$3" = x"-e"
-END
-
-chmod a+x dummy.sh checkargs.sh
-
-mkdir sub
-cp dummy.sh checkargs.sh defs sub
-sed -e "s|^am_top_builddir=.*|am_top_builddir='$cwd'|" \
-    <  "$am_top_builddir"/defs-static > defs-static
-sed -e "s|^am_top_builddir=.*|am_top_builddir='$cwd/sub'|" \
-    <  "$am_top_builddir"/defs-static > sub/defs-static
-
-check_preserve_args ()
-{
-  dir=$1; shift
-  get_ddata "$dir"
-  $sh "${dir}${dsep}checkargs.sh" a '' -e && r='ok' || r='not ok'
-  result_ "$r" "$sh re-exec preserving args [$dname]"
-}
-
-check_reexec_message ()
-{
-  dir=$1; shift
-  get_ddata "$dir"
-  $sh "${dir}${dsep}dummy.sh" "$@" \
-    | grep "^exec $AM_TEST_RUNNER_SHELL ${dir}${dsep}dummy\\.sh $*\$" \
-    && r='ok' || r='not ok'
-  result_ "$r" "$sh display re-exec message [$dname] [args: $*]"
-}
-
-./dummy.sh a b \
-  | grep "^exec $AM_TEST_RUNNER_SHELL \\./dummy\\.sh a b$" \
-  && r='ok' || r='not ok'
-result_ "$r" "direct run display re-exec message [args: a b]"
-
-./checkargs.sh a '' -e && r='ok' || r='not ok'
-result_ "$r" "direct re-exec preserving args"
-
-for sh_type in non-bash bash; do
-  get_sh $sh_type
-  if test "$sh" = :; then
-    skip_row_ 5 -r "no $sh_type shell available" "re-exec message"
-    skip_row_ 5 -r "no $sh_type shell available" "re-exec preserving args"
-    continue
-  fi
-  check_preserve_args ''
-  check_reexec_message '' a b c
-  check_preserve_args .
-  check_reexec_message .  a b c
-  cd sub
-  check_preserve_args ..
-  check_reexec_message .. a b c
-  cd ..
-  check_preserve_args "$cwd"
-  check_reexec_message "$cwd" a -b c-
-  check_preserve_args sub
-  check_reexec_message sub 1 2 3 4
-done
-
-:
index 877f70e..3c542ba 100755 (executable)
@@ -130,6 +130,7 @@ for vpath in : false; do
   count_test_results total=9 pass=3 fail=2 xpass=1 xfail=1 skip=1 error=1
 
   : Let us make b.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo OK > b.ok
   do_recheck --fail
   # a.test has been successful the first time, so no need to re-run it.
@@ -141,6 +142,7 @@ for vpath in : false; do
   count_test_results total=7 pass=2 fail=2 xpass=1 xfail=1 skip=1 error=0
 
   : Let us make the first part of c.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo OK > c.pass
   do_recheck --fail
   test ! -e a.run
@@ -150,6 +152,7 @@ for vpath in : false; do
   count_test_results total=5 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=0
 
   : Let us make also the second part of c.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo KO > c.xfail
   do_recheck --fail
   test ! -e a.run
@@ -160,6 +163,7 @@ for vpath in : false; do
 
   : Nothing changed, so only d.test should be run.
   for i in 1 2; do
+    using_gmake || $sleep # Required by BSD make.
     do_recheck --fail
     test ! -e a.run
     test ! -e b.run
@@ -169,6 +173,7 @@ for vpath in : false; do
   done
 
   : Let us make d.test run more testcases, and experience _more_ failures.
+  using_gmake || $sleep # Required by BSD make.
   echo 'test_count=9' > d.count
   unindent > d.extra <<'END'
     echo 'ok # SKIP s'
@@ -190,6 +195,7 @@ END
   count_test_results total=11 pass=2 fail=4 xpass=1 xfail=0 skip=2 error=2
 
   : Let us finally make d.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo 'test_count=1' > d.count
   echo : > d.extra
   do_recheck --pass
@@ -200,6 +206,7 @@ END
   count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=0
 
   : All tests have been successful or skipped, nothing should be re-run.
+  using_gmake || $sleep # Required by BSD make.
   do_recheck --pass
   test ! -e a.run
   test ! -e b.run
index ae31397..362abbf 100755 (executable)
@@ -107,6 +107,7 @@ for vpath in : false; do
   $srcdir/configure
 
   : A "make recheck" in a clean tree should run no tests.
+  using_gmake || $sleep # Required by BSD make.
   do_recheck --pass
   cat test-suite.log
   test ! -e a.run
@@ -131,6 +132,7 @@ for vpath in : false; do
   count_test_results total=9 pass=3 fail=2 xpass=1 xfail=1 skip=1 error=1
 
   : Let us make b.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo OK > b.ok
   do_recheck --fail
   # a.test has been successful the first time, so no need to re-run it.
@@ -142,6 +144,7 @@ for vpath in : false; do
   count_test_results total=7 pass=2 fail=2 xpass=1 xfail=1 skip=1 error=0
 
   : Let us make the first part of c.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo OK > c.pass
   do_recheck --fail
   test ! -e a.run
@@ -151,6 +154,7 @@ for vpath in : false; do
   count_test_results total=5 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=0
 
   : Let us make also the second part of c.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo KO > c.xfail
   do_recheck --fail
   test ! -e a.run
@@ -161,6 +165,7 @@ for vpath in : false; do
 
   : Nothing changed, so only d.test should be run.
   for i in 1 2; do
+    using_gmake || $sleep # Required by BSD make.
     do_recheck --fail
     test ! -e a.run
     test ! -e b.run
@@ -170,6 +175,7 @@ for vpath in : false; do
   done
 
   : Let us make d.test run more testcases, and experience _more_ failures.
+  using_gmake || $sleep # Required by BSD make.
   unindent > d.extra <<'END'
     echo SKIP: s
     echo FAIL: f 1
@@ -190,6 +196,7 @@ END
   count_test_results total=11 pass=2 fail=4 xpass=1 xfail=0 skip=2 error=2
 
   : Let us finally make d.test pass.
+  using_gmake || $sleep # Required by BSD make.
   echo : > d.extra
   do_recheck --pass
   test ! -e a.run
@@ -199,6 +206,7 @@ END
   count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=0
 
   : All tests have been successful or skipped, nothing should be re-run.
+  using_gmake || $sleep # Required by BSD make.
   do_recheck --pass
   test ! -e a.run
   test ! -e b.run
index 623cbad..b6f543a 100755 (executable)
@@ -105,6 +105,7 @@ for vpath in : false; do
   unset var
 
   : a.test was successful the first time, no need to re-run it.
+  using_gmake || $sleep # Required by BSD make.
   env TESTS=a.test $MAKE -e recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
@@ -114,6 +115,7 @@ for vpath in : false; do
   test ! -e c.run
 
   : b.test failed, it should be re-run.  And make it pass this time.
+  using_gmake || $sleep # Required by BSD make.
   echo OK > b.ok
   TEST_LOGS=b.log $MAKE -e recheck >stdout \
     || { cat stdout; exit 1; }
@@ -126,6 +128,7 @@ for vpath in : false; do
   rm -f *.run
 
   : No need to re-run a.test or b.test anymore.
+  using_gmake || $sleep # Required by BSD make.
   TEST_LOGS=b.log $MAKE -e recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
@@ -133,6 +136,7 @@ for vpath in : false; do
   test ! -e a.run
   test ! -e b.run
   test ! -e c.run
+  using_gmake || $sleep # Required by BSD make.
   TESTS='a.test b.test' $MAKE -e recheck >stdout \
     || { cat stdout; exit 1; }
   cat stdout
@@ -158,6 +162,7 @@ for vpath in : false; do
   : c.test contained and hard error the last time, so it should be re-run.
   : This time, make it pass
   # Use 'echo', not ':'; see comments above for why.
+  using_gmake || $sleep # Required by BSD make.
   echo dummy > c.ok
   env TESTS='c.test a.test' $MAKE -e recheck >stdout \
     || { cat stdout; exit 1; }
@@ -171,6 +176,7 @@ for vpath in : false; do
 
   : Nothing should be rerun anymore, as all tests have been eventually
   : successful.
+  using_gmake || $sleep # Required by BSD make.
   $MAKE recheck >stdout || { cat stdout; exit 1; }
   cat stdout
   count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
index d522b8c..952560d 100755 (executable)
@@ -44,7 +44,7 @@ BUILT_SOURCES = parse1.h p2-parse2.h
 # should be able to just declare dependencies directly instead
 # of relying on the BUILT_SOURCES hack, and things should still
 # work correctly.
-main3.@OBJEXT@: parse3.h
+main3.@OBJEXT@ parse3.@OBJEXT@: parse3.h
 
 .PHONY: clean-p3 build-p3
 build-p3: p3$(EXEEXT)