automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, testsuite-work, updated. v1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, testsuite-work, updated. v1.11-915-g29ce220
Date: Wed, 08 Jun 2011 08:25:09 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=29ce2209d36afba7d2cc672ee86fc00020872005

The branch, testsuite-work has been updated
       via  29ce2209d36afba7d2cc672ee86fc00020872005 (commit)
       via  7df1a9bd2b5e981e957aaf269fc15f980a993394 (commit)
       via  2838ad57693eec3e8467460e61e1c0d98ec53d3b (commit)
       via  0fe3c3285ba595cf5ce585b61f9f423714a66d96 (commit)
      from  dbd622e2f26758c598d8d7aec3cbf619093ea106 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 29ce2209d36afba7d2cc672ee86fc00020872005
Merge: dbd622e 7df1a9b
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jun 8 10:19:18 2011 +0200

    Merge branch 'tests-more-shells' into testsuite-work

commit 7df1a9bd2b5e981e957aaf269fc15f980a993394
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jun 6 16:12:59 2011 +0200

    tests: `lib/' shell scripts transparently tested also with $SHELL
    
    With the previous commit, the user could prefer the use of $SHELL
    over /bin/sh in some tests checking the Automake-provided shell
    scripts by manually exporting `test_prefer_config_shell' to "yes"
    in the environment.  With this commit, we ensure that such tests
    *always* and *transparently* run using both $SHELL and /bin/sh
    to execute the checked scripts.  The `test_prefer_config_shell'
    variable becomes an internal detail, and is no more meant to be
    manually defined or overridden.
    
    * tests/defs-static.in: Check that `test_prefer_config_shell' is
    not exported in the environment.  Error out if this is the case.
    * tests/config-shell-tests.sh: New file, driver script to run
    checks on the shell scripts in `lib/' using the $SHELL determined
    at configure time instead of the default system shell /bin/sh.
    * Makefile.am (TESTS_EXTENSIONS): Add `.shtst'.
    (SHTST_LOG_COMPILER): Define, it calls `config-shell-tests.sh'.
    (config_shell_tests): Define to a list of tests that wraps other
    `*.test' tests using `config-shell-tests.sh'.
    ($(config_shell_tests)): Dummy dependency declaration required
    in order to have make actually produce expected log files from
    the `.shtst.log' suffix rule.
    (EXTRA_DIST): Distribute `config-shell-tests.sh'.
    (TESTS): Add `$(config_shell_tests)'.
    * tests/self-check-env-sanitize.test: Update, by checking that
    `test_prefer_config_shell' isn't exported in the environment.

commit 2838ad57693eec3e8467460e61e1c0d98ec53d3b
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jun 6 14:40:22 2011 +0200

    tests: can use also $SHELL to check shell scripts from `lib/'
    
    * tests/ar-lib.test: If the variable `$test_prefer_config_shell'
    is set to "yes", run the script under test with configure-time
    determined $SHELL, rather than with /bin/sh.
    The `$test_prefer_config_shell' variable defaults to empty, but
    can be overridden at runtime by the user, thus allowing more
    coverage.
    * tests/compile.test: Likewise.
    * tests/compile2.test: Likewise.
    * tests/compile3.test: Likewise.
    * tests/compile4.test: Likewise.
    * tests/compile5.test: Likewise.
    * tests/compile6.test: Likewise.
    * tests/instsh2.test: Likewise.
    * tests/instsh3.test: Likewise.
    * tests/mkinst3.test: Likewise.
    * tests/missing.test: Likewise.
    * tests/missing2.test: Likewise.
    * tests/missing3.test: Likewise.
    * tests/missing5.test: Likewise.
    * tests/defs (get_shell_script): New subroutine, factoring out
    code common to the tests above.
    (xsi-lib-shell): If `$test_prefer_config_shell' is set to "yes",
    check that $SHELL, not /bin/sh, supports XSI constructs, as we
    expect the test will use $SHELL and not /bin/sh to run the
    script being tested.

commit 0fe3c3285ba595cf5ce585b61f9f423714a66d96
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jun 6 11:32:19 2011 +0200

    tests defs: better requirements for XSI shells
    
    This change avoids potential spurious failures with tests using
    the requirement 'xsi-shell' to mean that they want */bin/sh* (not
    $SHELL) to be XSI-conforming.  This idiom used to work before
    commit `v1.11-874-g1321be7' (as back then the test scripts were
    unconditionally run with /bin/sh), but has become inconsistent
    now that the test scripts re-execute themselves with configure
    determined $SHELL.
    
    The described spurious failures have already occurred in practice,
    for examples on Solaris systems which also had GNU Bash installed.
    
    From a suggestion by Peter Rosin.  See discussion at:
    <http://lists.gnu.org/archive/html/automake-patches/2011-06/msg00016.html>
    
    * tests/defs (xsi-shell): Now check that $SHELL, rather than the
    shell currently running the test script, is an XSI shell.
    (xsi-bin-sh): New requirement, checking that /bin/sh (which can
    differ from $SHELL) is an XSI shell.
    (xsi-lib-shell): New requirement, checking that the shell that
    should be used to test the Automake-provided scripts from `lib/'
    is an XSI shell.  For the moment, this is just an alias for
    `xsi-bin-sh'.
    (require_xsi): New subroutine, used to factor out code common to
    the requirements above.
    ($xsi_shell_code): New variable, contains shell code supposed to
    work only with XSI shells.  Used by the new subroutine above.
    * tests/ar-lib.test ($required): Require 'xsi-lib-shell' instead
    of 'xsi-shell', since the script we test here is run with /bin/sh,
    not with $SHELL.
    * tests/compile3.test: Likewise.
    * tests/compile6.test: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   89 ++++++++++++++++++++
 tests/Makefile.am                                  |   30 +++++++
 tests/Makefile.in                                  |   41 ++++++++-
 tests/ar-lib.test                                  |    4 +-
 tests/compile.test                                 |    2 +-
 tests/compile2.test                                |    2 +-
 tests/compile3.test                                |    4 +-
 tests/compile4.test                                |    2 +
 tests/compile5.test                                |    2 +-
 tests/compile6.test                                |    4 +-
 tests/{parallel-tests.sh => config-shell-tests.sh} |   13 ++--
 tests/defs                                         |   57 ++++++++++---
 tests/defs-static.in                               |    4 +-
 tests/instsh2.test                                 |    3 +
 tests/instsh3.test                                 |    2 +
 tests/missing.test                                 |    2 +
 tests/missing2.test                                |    2 +
 tests/missing3.test                                |    2 +
 tests/missing5.test                                |    2 +
 tests/mkinst3.test                                 |    2 +-
 tests/self-check-env-sanitize.test                 |    4 +-
 21 files changed, 240 insertions(+), 33 deletions(-)
 copy tests/{parallel-tests.sh => config-shell-tests.sh} (81%)

diff --git a/ChangeLog b/ChangeLog
index 058bd67..e1fc269 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,92 @@
+2011-06-07  Stefano Lattarini  <address@hidden>
+
+       tests: `lib/' shell scripts transparently tested also with $SHELL
+       With the previous commit, the user could prefer the use of $SHELL
+       over /bin/sh in some tests checking the Automake-provided shell
+       scripts by manually exporting `test_prefer_config_shell' to "yes"
+       in the environment.  With this commit, we ensure that such tests
+       *always* and *transparently* run using both $SHELL and /bin/sh
+       to execute the checked scripts.  The `test_prefer_config_shell'
+       variable becomes an internal detail, and is no more meant to be
+       manually defined or overridden.
+       * tests/defs-static.in: Check that `test_prefer_config_shell' is
+       not exported in the environment.  Error out if this is the case.
+       * tests/config-shell-tests.sh: New file, driver script to run
+       checks on the shell scripts in `lib/' using the $SHELL determined
+       at configure time instead of the default system shell /bin/sh.
+       * Makefile.am (TESTS_EXTENSIONS): Add `.shtst'.
+       (SHTST_LOG_COMPILER): Define, it calls `config-shell-tests.sh'.
+       (config_shell_tests): Define to a list of tests that wraps other
+       `*.test' tests using `config-shell-tests.sh'.
+       ($(config_shell_tests)): Dummy dependency declaration required
+       in order to have make actually produce expected log files from
+       the `.shtst.log' suffix rule.
+       (EXTRA_DIST): Distribute `config-shell-tests.sh'.
+       (TESTS): Add `$(config_shell_tests)'.
+       * tests/self-check-env-sanitize.test: Update, by checking that
+       `test_prefer_config_shell' isn't exported in the environment.
+
+2011-06-07  Stefano Lattarini  <address@hidden>
+
+       tests: can use also $SHELL to check shell scripts from `lib/'
+       * tests/ar-lib.test: If the variable `$test_prefer_config_shell'
+       is set to "yes", run the script under test with configure-time
+       determined $SHELL, rather than with /bin/sh.
+       The `$test_prefer_config_shell' variable defaults to empty, but
+       can be overridden at runtime by the user, thus allowing more
+       coverage.
+       * tests/compile.test: Likewise.
+       * tests/compile2.test: Likewise.
+       * tests/compile3.test: Likewise.
+       * tests/compile4.test: Likewise.
+       * tests/compile5.test: Likewise.
+       * tests/compile6.test: Likewise.
+       * tests/instsh2.test: Likewise.
+       * tests/instsh3.test: Likewise.
+       * tests/mkinst3.test: Likewise.
+       * tests/missing.test: Likewise.
+       * tests/missing2.test: Likewise.
+       * tests/missing3.test: Likewise.
+       * tests/missing5.test: Likewise.
+       * tests/defs (get_shell_script): New subroutine, factoring out
+       code common to the tests above.
+       (xsi-lib-shell): If `$test_prefer_config_shell' is set to "yes",
+       check that $SHELL, not /bin/sh, supports XSI constructs, as we
+       expect the test will use $SHELL and not /bin/sh to run the
+       script being tested.
+
+2011-06-07  Stefano Lattarini  <address@hidden>
+
+       tests defs: better requirements for XSI shells
+       This change avoids potential spurious failures with tests using
+       the requirement 'xsi-shell' to mean that they want */bin/sh* (not
+       $SHELL) to be XSI-conforming.  This idiom used to work before
+       commit `v1.11-874-g1321be7' (as back then the test scripts were
+       unconditionally run with /bin/sh), but has become inconsistent
+       now that the test scripts re-execute themselves with configure
+       determined $SHELL.
+       The described spurious failures have already occurred in practice,
+       for examples on Solaris systems which also had GNU Bash installed.
+       From a suggestion by Peter Rosin.  See discussion at:
+       
<http://lists.gnu.org/archive/html/automake-patches/2011-06/msg00016.html>
+       * tests/defs (xsi-shell): Now check that $SHELL, rather than the
+       shell currently running the test script, is an XSI shell.
+       (xsi-bin-sh): New requirement, checking that /bin/sh (which can
+       differ from $SHELL) is an XSI shell.
+       (xsi-lib-shell): New requirement, checking that the shell that
+       should be used to test the Automake-provided scripts from `lib/'
+       is an XSI shell.  For the moment, this is just an alias for
+       `xsi-bin-sh'.
+       (require_xsi): New subroutine, used to factor out code common to
+       the requirements above.
+       ($xsi_shell_code): New variable, contains shell code supposed to
+       work only with XSI shells.  Used by the new subroutine above.
+       * tests/ar-lib.test ($required): Require 'xsi-lib-shell' instead
+       of 'xsi-shell', since the script we test here is run with /bin/sh,
+       not with $SHELL.
+       * tests/compile3.test: Likewise.
+       * tests/compile6.test: Likewise.
+
 2011-06-05  Stefano Lattarini  <address@hidden>
 
        tests: fix typo-related error in auxdir2.test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d863b28..91f1a9b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -93,6 +93,35 @@ $(depmod_tests:.depmod=.log): depmod-tests.sh depmod-data.log
 $(depmod_tests):
 
 
+TEST_EXTENSIONS += .shtst
+SHTST_LOG_COMPILER = $(SHELL) $(srcdir)/config-shell-tests.sh
+EXTRA_DIST += config-shell-tests.sh
+
+# FIXME: this list might probably be made auto-generated, like
+# $(parallel_tests) is...  But would that worth the hassle?
+config_shell_tests = \
+  ar-lib-w.shtst \
+  compile-w.shtst \
+  compile2-w.shtst \
+  compile3-w.shtst \
+  compile4-w.shtst \
+  compile5-w.shtst \
+  compile6-w.shtst \
+  instsh2-w.shtst \
+  instsh3-w.shtst \
+  mkinst3-w.shtst \
+  missing-w.shtst \
+  missing2-w.shtst \
+  missing3-w.shtst \
+  missing5-w.shtst
+
+# All `*-w.shtst' tests work by sourcing the script `config-shell-tests.sh'.
+$(config_shell_tests:.shtst=.log): config-shell-tests.sh
+# This dummy declaration is required to have make actually produce
+# expected log files from the `.shtst.log' suffix rule.
+$(config_shell_tests):
+
+
 # Some testsuite-influential variables should be overridable from the
 # test scripts, but not from the environment.
 # We want warning messages and explanations for skipped tests to go to
@@ -112,6 +141,7 @@ AM_TESTS_ENVIRONMENT = \
 
 TESTS = \
   $(handwritten_tests) \
+  $(config_shell_tests) \
   $(parallel_tests) \
   $(depmod_tests) \
   $(instspc_tests)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index d2975d7..eba4d1c 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -198,9 +198,12 @@ PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) 
$(AM_PTEST_LOG_FLAGS) \
 am__test_logs4 = $(am__test_logs3:.instspc.log=.log)
 INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \
        $(INSTSPC_LOG_FLAGS)
-TEST_LOGS = $(am__test_logs4:.depmod.log=.log)
+am__test_logs5 = $(am__test_logs4:.depmod.log=.log)
 DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \
        $(DEPMOD_LOG_FLAGS)
+TEST_LOGS = $(am__test_logs5:.shtst.log=.log)
+SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \
+       $(SHTST_LOG_FLAGS)
 TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
@@ -303,8 +306,9 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 MAINTAINERCLEANFILES = 
 EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \
-       instspc-tests.sh depmod-tests.sh $(handwritten_tests)
-TEST_EXTENSIONS = .test .ptest .instspc .depmod
+       instspc-tests.sh depmod-tests.sh config-shell-tests.sh \
+       $(handwritten_tests)
+TEST_EXTENSIONS = .test .ptest .instspc .depmod .shtst
 # Run the tests with the shell detected at configure time.
 TEST_LOG_COMPILER = $(SHELL)
 XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
@@ -382,6 +386,26 @@ depmod_tests = depcomp-gcc3.depmod depcomp-gcc.depmod \
        depcomp-cpp.depmod depcomp-msvisualcpp.depmod \
        depcomp-msvcmsys.depmod
 DEPMOD_LOG_COMPILER = $(SHELL) $(srcdir)/depmod-tests.sh
+SHTST_LOG_COMPILER = $(SHELL) $(srcdir)/config-shell-tests.sh
+
+# FIXME: this list might probably be made auto-generated, like
+# $(parallel_tests) is...  But would that worth the hassle?
+config_shell_tests = \
+  ar-lib-w.shtst \
+  compile-w.shtst \
+  compile2-w.shtst \
+  compile3-w.shtst \
+  compile4-w.shtst \
+  compile5-w.shtst \
+  compile6-w.shtst \
+  instsh2-w.shtst \
+  instsh3-w.shtst \
+  mkinst3-w.shtst \
+  missing-w.shtst \
+  missing2-w.shtst \
+  missing3-w.shtst \
+  missing5-w.shtst
+
 
 # Some testsuite-influential variables should be overridable from the
 # test scripts, but not from the environment.
@@ -402,6 +426,7 @@ AM_TESTS_ENVIRONMENT = \
 
 TESTS = \
   $(handwritten_tests) \
+  $(config_shell_tests) \
   $(parallel_tests) \
   $(depmod_tests) \
   $(instspc_tests)
@@ -1367,7 +1392,7 @@ am__tdf = diff-in-tests-lists.tmp
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .depmod .html .instspc .log .ptest .test
+.SUFFIXES: .depmod .html .instspc .log .ptest .shtst .test
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am 
$(srcdir)/instspc-tests.am $(srcdir)/depmod-tests.am 
$(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -1545,6 +1570,8 @@ recheck recheck-html:
        @p='$<'; $(am__check_pre) $(INSTSPC_LOG_COMPILE) "$$tst" 
$(am__check_post)
 .depmod.log:
        @p='$<'; $(am__check_pre) $(DEPMOD_LOG_COMPILE) "$$tst" 
$(am__check_post)
+.shtst.log:
+       @p='$<'; $(am__check_pre) $(SHTST_LOG_COMPILE) "$$tst" $(am__check_post)
 
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -1757,6 +1784,12 @@ $(depmod_tests:.depmod=.log): depmod-tests.sh 
depmod-data.log
 # expected log files from the `.depmod.log' suffix rule.
 $(depmod_tests):
 
+# All `*-w.shtst' tests work by sourcing the script `config-shell-tests.sh'.
+$(config_shell_tests:.shtst=.log): config-shell-tests.sh
+# This dummy declaration is required to have make actually produce
+# expected log files from the `.shtst.log' suffix rule.
+$(config_shell_tests):
+
 .PHONY: maintainer-check-list-of-tests
 maintainer-check-list-of-tests:
         @if diff -u /dev/null /dev/null >/dev/null 2>&1; then \
diff --git a/tests/ar-lib.test b/tests/ar-lib.test
index 7168ecd..6f6625d 100755
--- a/tests/ar-lib.test
+++ b/tests/ar-lib.test
@@ -16,10 +16,10 @@
 
 # Make sure `ar-lib' wraps the Microsoft Library Manager (lib) correctly
 
-required=xsi-shell
+required=xsi-lib-shell
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/ar-lib" .
+get_shell_script ar-lib
 
 # Use a dummy lib, since lib isn't readily available on all systems.
 cat >lib <<'END'
diff --git a/tests/compile.test b/tests/compile.test
index 8427bad..0ba9ddf 100755
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -18,7 +18,7 @@
 
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/compile" .
+get_shell_script compile
 
 # -o 'a  c' should not be stripped because 'a  c' is not an object
 # (it does not matter whether touch creates ./-- or not)
diff --git a/tests/compile2.test b/tests/compile2.test
index a466dc4..180fcc3 100755
--- a/tests/compile2.test
+++ b/tests/compile2.test
@@ -18,7 +18,7 @@
 
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/compile" .
+get_shell_script compile
 
 cat >mycc <<'END'
 source_seen=no
diff --git a/tests/compile3.test b/tests/compile3.test
index f949d1c..b703f66 100755
--- a/tests/compile3.test
+++ b/tests/compile3.test
@@ -16,10 +16,10 @@
 
 # Make sure `compile' wraps the Microsoft C/C++ compiler (cl) correctly
 
-required=xsi-shell
+required=xsi-lib-shell
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/compile" .
+get_shell_script compile
 
 # Use a dummy cl, since cl isn't readily available on all systems
 cat >cl <<'END'
diff --git a/tests/compile4.test b/tests/compile4.test
index cf8d6cb..c7e8a0e 100755
--- a/tests/compile4.test
+++ b/tests/compile4.test
@@ -20,6 +20,8 @@
 required='cl'
 . ./defs || Exit 1
 
+get_shell_script compile
+
 mkdir sub
 
 cat >sub/foo.c <<'EOF'
diff --git a/tests/compile5.test b/tests/compile5.test
index cd8baee..2b4eeb0 100755
--- a/tests/compile5.test
+++ b/tests/compile5.test
@@ -19,7 +19,7 @@
 
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/compile" .
+get_shell_script compile
 
 # Use a dummy cl, since cl isn't readily available on all systems
 cat >cl <<'END'
diff --git a/tests/compile6.test b/tests/compile6.test
index 02feb4b..fff1487 100755
--- a/tests/compile6.test
+++ b/tests/compile6.test
@@ -16,10 +16,10 @@
 
 # Make sure `compile' searches libraries correctly
 
-required=xsi-shell
+required=xsi-lib-shell
 . ./defs || Exit 1
 
-cp "$top_testsrcdir/lib/compile" .
+get_shell_script compile
 
 # Use a dummy cl, since cl isn't readily available on all systems
 cat >cl <<'END'
diff --git a/tests/parallel-tests.sh b/tests/config-shell-tests.sh
similarity index 81%
copy from tests/parallel-tests.sh
copy to tests/config-shell-tests.sh
index b6bbff3..150287e 100755
--- a/tests/parallel-tests.sh
+++ b/tests/config-shell-tests.sh
@@ -14,8 +14,8 @@
 # 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 checks the on the `parallel-tests' semantics
-# by wrapping tests that use the generic "Simple Tests" driver.
+# Driver script to run checks on Automake-provided shell scripts using
+# configure-time $SHELL instead of the system shell /bin/sh.
 
 set -e
 
@@ -27,16 +27,17 @@ test -n "$testsrcdir" || fatal_ "\$testsrcdir is empty or 
undefined"
 
 case $#,$1 in
   0,) fatal_ "missing argument";;
-  1,*-p.ptest) test_name=`expr /"$1" : '.*/\(.*\)-p\.ptest'`;;
+  1,*-w.shtst) test_name=`expr /"$1" : '.*/\(.*\)-w\.shtst'`;;
   1,*) fatal_ "invalid argument \`$1'";;
   *) fatal_ "too many arguments";;
 esac
 
-# Run the test with Automake's parallel-tests driver enabled.
-parallel_tests=yes
+# Run the test using configure-time $SHELL, not /bin/sh, to run the
+# checked shell scripts.
+test_prefer_config_shell=yes
 # This is required to have the wrapped test use a proper temporary
 # directory to run into.
-me=$test_name-p
+me=$test_name-w
 # In the spirit of VPATH, we prefer a test in the build tree
 # over one in the source tree.
 if test -f "./$test_name.test"; then
diff --git a/tests/defs b/tests/defs
index ea036f8..e8ff92e 100644
--- a/tests/defs
+++ b/tests/defs
@@ -283,6 +283,41 @@ unindent ()
 }
 sed_unindent_prog="" # Avoid interferences from the environment.
 
+# get_shell_script SCRIPT-NAME
+# -----------------------------
+# Fetch an Automake-provided test script from the `lib/' directory into
+# the current directory, and, if the `$test_prefer_config_shell' variable
+# is set to "yes", modify its shebang line to use $SHELL instead of
+# /bin/sh.
+get_shell_script ()
+{
+  if test x"$test_prefer_config_shell" = x"yes"; then
+    sed "1s|#!.*|#! $SHELL|" "$top_testsrcdir/lib/$1" > "$1"
+    chmod a+x "$1"
+  else
+    cp "$top_testsrcdir/lib/$1" .
+  fi
+  sed 10q "$1" # For debugging.
+}
+
+# require_xsi SHELL
+# -----------------
+# Skip the test if the given shell fails to support common XSI constructs.
+require_xsi ()
+{
+  test $# -eq 1 || framework_failure_ "require_xsi needs exactly one arg"
+  echo "$me: trying some XSI constructs with $1"
+  $1 -c "$xsi_shell_code" || skip_ "$1 lacks XSI features"
+}
+# Shell code supposed to work only with XSI shells.  Keep this in sync
+# with libtool.m4:_LT_CHECK_SHELL_FEATURES.
+xsi_shell_code='
+  _lt_dummy="a/b/c"
+  test 
"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval '\''test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5'\'
+
 
 ## ----------------------------------------------------------- ##
 ##  Checks for required tools, and additional setups (if any)  ##
@@ -316,6 +351,17 @@ do
       test "$FC"  = false && skip_ "no Fortran compiler available";;
     fortran77)
       test "$F77" = false && skip_ "no Fortran 77 compiler available";;
+    xsi-shell)
+      require_xsi "$SHELL";;
+    xsi-bin-sh)
+      require_xsi "/bin/sh";;
+    xsi-lib-shell)
+      if test x"$test_prefer_config_shell" = x"yes"; then
+        require_xsi "$SHELL"
+      else
+        require_xsi "/bin/sh"
+      fi
+      ;;
     bzip2)
       # Do not use --version, bzip2 still tries to compress stdin.
       echo "$me: running bzip2 --help"
@@ -509,17 +555,6 @@ do
       texi2dvi -o /dev/null --version \
         || skip_ "required program \`texi2dvi' not available"
       ;;
-    xsi-shell)
-      # Try some XSI features.
-      # Keep this in sync with libtool.m4:_LT_CHECK_SHELL_FEATURES.
-      echo "$me: trying some XSI constructs"
-      ( _am_dummy="a/b/c"
-       test 
"${_am_dummy##*/},${_am_dummy%/*},${_am_dummy#??}"${_am_dummy%"$_am_dummy"}, \
-               = c,a/b,b/c, \
-       && eval 'test $(( 1 + 1 )) -eq 2 \
-       && test "${#_am_dummy}" -eq 5' ) \
-          || skip_ "the shell lacks some required XSI features"
-      ;;
     flex)
       # Since flex is required, we pick LEX for ./configure.
       LEX=flex
diff --git a/tests/defs-static.in b/tests/defs-static.in
index 53d9f93..17ed284 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -70,7 +70,9 @@ fi
 # Check that the environment is properly sanitized.
 # Having variables exported to the empty string is OK, since our code
 # treats such variables as if they were unset.
-for var in me required parallel_tests original_AUTOMAKE original_ACLOCAL; do
+for var in me required parallel_tests test_prefer_config_shell \
+           original_AUTOMAKE original_ACLOCAL
+do
   if eval "test x\"\$$var\" != x" && env | grep "^$var=" >/dev/null; then
     echo "$argv0: variable \`$var' is set in the environment:" \
          "this is unsafe" >&2
diff --git a/tests/instsh2.test b/tests/instsh2.test
index 2019b35..f86c414 100755
--- a/tests/instsh2.test
+++ b/tests/instsh2.test
@@ -18,6 +18,9 @@
 # Various install-sh checks
 
 . ./defs || Exit 1
+
+get_shell_script install-sh
+
 # Basic errors
 ./install-sh && Exit 1
 ./install-sh -m 644 dest && Exit 1
diff --git a/tests/instsh3.test b/tests/instsh3.test
index da50419..2cdf4a9 100755
--- a/tests/instsh3.test
+++ b/tests/instsh3.test
@@ -23,6 +23,8 @@ required=non-root
 touch -t $old_timestamp foo \
   || skip_ "touch utility doesn't accept '-t' option"
 
+get_shell_script install-sh
+
 ./install-sh -d d1
 
 # Do not change the timestamps when using -C.
diff --git a/tests/missing.test b/tests/missing.test
index 2e6d8d3..8e080eb 100755
--- a/tests/missing.test
+++ b/tests/missing.test
@@ -25,6 +25,8 @@ EOF
 
 : > Makefile.am
 
+get_shell_script missing
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
diff --git a/tests/missing2.test b/tests/missing2.test
index 88e6b27..9844958 100755
--- a/tests/missing2.test
+++ b/tests/missing2.test
@@ -28,6 +28,8 @@ EOF
 
 : > Makefile.am
 
+get_shell_script missing
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
diff --git a/tests/missing3.test b/tests/missing3.test
index 21b5e4f..328212c 100755
--- a/tests/missing3.test
+++ b/tests/missing3.test
@@ -18,6 +18,8 @@
 
 . ./defs || Exit 1
 
+get_shell_script missing
+
 # b7cb8259 assumed not to exist.
 
 ./missing b7cb8259 --version 2>stderr && { cat stderr >&2; Exit 1; }
diff --git a/tests/missing5.test b/tests/missing5.test
index 010b344..b618bd1 100755
--- a/tests/missing5.test
+++ b/tests/missing5.test
@@ -19,6 +19,8 @@
 
 . ./defs || Exit 1
 
+get_shell_script missing
+
 # these programs may be invoked by `missing'
 needed_tools='chmod find sed test touch'
 needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'`
diff --git a/tests/mkinst3.test b/tests/mkinst3.test
index 0082b53..3572ab2 100755
--- a/tests/mkinst3.test
+++ b/tests/mkinst3.test
@@ -23,7 +23,7 @@ mkdir '~a b' && mkdir '~a b/-x  y' \
   || skip_ "directory names with spaces and metacharacters not accepted"
 rm -rf '~a b'
 
-cp "$top_testsrcdir/lib/mkinstalldirs" .
+get_shell_script mkinstalldirs
 
 # Test mkinstalldirs with the installed mkdir.
 
diff --git a/tests/self-check-env-sanitize.test 
b/tests/self-check-env-sanitize.test
index 169f003..9dc97be 100755
--- a/tests/self-check-env-sanitize.test
+++ b/tests/self-check-env-sanitize.test
@@ -23,7 +23,9 @@
 set -x
 exec 5>&1
 
-for var in me parallel_tests required original_AUTOMAKE original_ACLOCAL; do
+for var in me parallel_tests required original_AUTOMAKE original_ACLOCAL \
+           test_prefer_config_shell
+do
   env "$var=foo" $SHELL -c '. ./defs' foo.test && exit 1
   env "$var=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
     | grep "foo\.test:.* variable \`$var'.* in the environment.*unsafe" || 
exit 1


hooks/post-receive
-- 
GNU Automake



reply via email to

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