]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests defs: better requirements for XSI shells
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 6 Jun 2011 09:32:19 +0000 (11:32 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 7 Jun 2011 10:08:25 +0000 (12:08 +0200)
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.

ChangeLog
tests/ar-lib.test
tests/compile3.test
tests/compile6.test
tests/defs

index 569f44add93d96ef5abd45f2cd292dbbf1dcb451..744a9939f06c6336113bf7762b79114f3fd5e04e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2011-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        self tests: fix another spurious failure
index 7168ecd3a5c9417511a8283f2e44ef6f25ea4274..9936c0e8d4dbbb8cb39bc63abb7f1bf0370f9078 100755 (executable)
@@ -16,7 +16,7 @@
 
 # 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" .
index f949d1c2de4fb5c066db2e5dec161e9624b80bb9..61cde6bfbfac47160b58ed3ce806246da1c4da0d 100755 (executable)
@@ -16,7 +16,7 @@
 
 # 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" .
index 02feb4b6dddd5109410d9df9b17e4421cd0edd83..ca1c671783d8fb7542d3cd5abd6d6cd09a8834f1 100755 (executable)
@@ -16,7 +16,7 @@
 
 # Make sure `compile' searches libraries correctly
 
-required=xsi-shell
+required=xsi-lib-shell
 . ./defs || Exit 1
 
 cp "$top_testsrcdir/lib/compile" .
index ea036f87c76711aa9ac38888d21c9363e66911a2..55596cf749ed935840bb0d8dd5ac99d47aac944e 100644 (file)
@@ -283,6 +283,24 @@ unindent ()
 }
 sed_unindent_prog="" # Avoid interferences from the environment.
 
+# 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 +334,12 @@ 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)
+      require_xsi "/bin/sh";;
     bzip2)
       # Do not use --version, bzip2 still tries to compress stdin.
       echo "$me: running bzip2 --help"
@@ -509,17 +533,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