]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: workaround for shells with broken 'set -e'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 6 Feb 2012 18:43:34 +0000 (19:43 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 6 Feb 2012 21:31:54 +0000 (22:31 +0100)
* tests/defs (gmake, native, rst2html): Some versions of the BSD
shell wrongly bail out when the 'errexit' shell flag is active and
the left-hand command in a "&&" list fails, if that list is the
*last* command of a "for" or "while" loop.  Work around this issue.
* tests/lex3.test: Likewise.
* tests/check12.test: Likewise.
* tests/yacc-basic.test: Likewise.
* tests/lex-noyywrap.test: Likewise.
* tests/parallel-tests2.test: Likewise.
* tests/lex-lib-external.test: Likewise.
* tests/check-no-test-driver.test: Likewise.
* tests/test-metadata-recheck.test: Likewise.
* tests/parallel-tests-dry-run-1.test: Likewise.
* tests/parallel-tests-dry-run-2.test: Likewise.
* tests/parallel-tests-unreadable.test: Likewise.
* tests/test-driver-custom-no-extra-driver.test: Likewise.

Problem revealed by spurious testsuite failures on a NetBSD 5.1
system and an OpenBSD 5.0 system.

13 files changed:
tests/check-no-test-driver.test
tests/check12.test
tests/defs
tests/lex-lib-external.test
tests/lex-noyywrap.test
tests/lex3.test
tests/parallel-tests-dry-run-1.test
tests/parallel-tests-dry-run-2.test
tests/parallel-tests-unreadable.test
tests/parallel-tests2.test
tests/test-driver-custom-no-extra-driver.test
tests/test-metadata-recheck.test
tests/yacc-basic.test

index 94069170ae9bbe4e1ac5d2fd9aad97456ef93083..19ba34c76f1ec78e5a93904d9092e6ac1a2ad3ce 100755 (executable)
@@ -29,6 +29,7 @@ for opts in '' '-a' '--add-missing --copy'; do
   $AUTOMAKE $opts
   $FGREP 'test-driver' Makefile.in && Exit 1
   find . | $FGREP 'test-driver' && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 :
index be4d84e9ad628b61f34ad4edd00fbebd09dbeae3..cf2623dcf0671a48ea1424fe7d33354aa0481035 100755 (executable)
@@ -202,6 +202,7 @@ for vpath in : false; do
     grep '^FAIL: b$' test-suite.log
     grep '^b\.test: exit status: 23$' test-suite.log
     grep '^a\.test' test-suite.log && Exit 1
+    : For shells with busted 'set -e'.
   else :; fi
   grep 'check-local failed :-(' local.log
 
index 40842cda7c4316a7a4f0f60b727f690bddad6c2a..ace83af0ff3fcd9c74736ebec152480fb1b08bb0 100644 (file)
@@ -742,7 +742,10 @@ do
         MAKE=$make_ am__using_gmake=''
         test "$MAKE" =  : && break
         echo "$me: determine whether $MAKE is GNU make"
-        using_gmake && break
+        # Don't use "&&" here, or a bug of 'set -e' present in some
+        # versions of the BSD shell will be triggered.  We add the
+        # dummy "else" branch for extra safety.
+        if using_gmake; then break; else :; fi
       done
       test "$MAKE" = : && skip_all_ "this test requires GNU make"
       export MAKE
@@ -870,7 +873,12 @@ do
       fi
       ;;
     native)
-      cross_compiling && skip_all_ "doesn't work in cross-compile mode"
+      # Don't use "&&" here, to avoid a bug of 'set -e' present in
+      # some (even relatively recent) versions of the BSD shell.
+      # We add the dummy "else" branch for extra safety.
+      if cross_compiling; then
+        skip_all_ "doesn't work in cross-compile mode"
+      else :; fi
       ;;
     python)
       # Python doesn't support --version, it has -V
@@ -898,7 +906,10 @@ do
       while :; do
         for r2h in $RST2HTML rst2html rst2html.py; do
           echo "$me: running $r2h --version"
-          $r2h --version && break 2
+          # Don't use "&&" here, or a bug of 'set -e' present in some
+          # versions of the BSD shell will be triggered.  We add the
+          # dummy "else" branch for extra safety.
+          if $r2h --version; then break 2; else :; fi
         done
         skip_all_ "no proper rst2html program found"
       done
index 5f0459482424f02e341383eb0660a20b2185166f..1fb000960afeb179d65280483e2413f40c5f3991 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
@@ -69,6 +69,7 @@ $MAKE all
 if cross_compiling; then :; else
   echo GOOD | ./lexer
   echo BAD | ./lexer && Exit 1
+  : For shells with busted 'set -e'.
 fi
 $MAKE distcheck
 
index 9431970f9046f89733fd8504606ceec7c340947a..98561f2d03ccdd8b0f47bf838cecce8e1bbb309b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 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
@@ -64,6 +64,7 @@ $MAKE
 if cross_compiling; then :; else
   echo GOOD | ./foo
   echo BAD | ./foo && Exit 1
+  : For shells with busted 'set -e'.
 fi
 
 # Sanity check on distribution.
index 46f0b9f9d9a6158bb0655432da14f7dc0104c1b9..01d96519b83685aaacc733ebf13bec628f67f24f 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 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
@@ -67,6 +67,7 @@ $MAKE
 if cross_compiling; then :; else
   echo GOOD | ./foo
   echo BAD | ./foo && Exit 1
+  : For shells with busted 'set -e'.
 fi
 
 # The generated file `foo.c' must be shipped.
index 4ed59f0d942de3b4778100b98ccedd7a6e9f24e0..27e62a080d97e36c5c173c19193683eef11cd4f6 100755 (executable)
@@ -51,7 +51,10 @@ none_exist ()
 {
   st=0
   for i in $*; do
-    { test -r $i || test -f $i; } && { echo File $i found; st=1; }
+    if test -r $i || test -f $i; then
+      echo File $i found
+      st=1
+    fi
   done
   test $st -eq 0
 }
index c81286e64ca3bb56dde2169e8f76615fa1583fad..11816891d8eb59459e15c1905542ae72517a8b12 100755 (executable)
@@ -83,6 +83,7 @@ for target in check recheck test-suite.log; do
   make_n_ $target
   grep '^:test-result: *FAIL' bar.trs
   grep 'this is bad' foo.log test-suite.log && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 chmod a-rw $files
index 2b4d077402497e8cc1d27fe8047211297a7d4145..425c31a326ad12e7bb8a6d65f3f5d5d8b1a2c122 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
@@ -70,6 +70,7 @@ for files in \
   grep '^SKIP: bar' test-suite.log
   grep '^barbarbar$' test-suite.log
   $EGREP ':.*foo|foofoofoo' test-suite.log && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 :
index a9ef964bc13b82b2094baecad9ddd2bc6a35d173..ab0eee27d0d27c5b7e761574935d3334ae24ae5e 100755 (executable)
@@ -27,7 +27,10 @@ am_parallel_tests=yes
 while :; do
   for r2h in $RST2HTML rst2html rst2html.py; do
     echo "$me: running $r2h --version"
-    $r2h --version && break 2
+    # Don't use "&&" here, or a bug of 'set -e' present in some
+    # versions of the BSD shell will be triggered.  We add the
+    # dummy "else" branch for extra safety.
+    if $r2h --version; then break 2; else :; fi
   done
   skip_all_ "no proper rst2html program found"
 done
index 1196e770ba9271bf95ecc50dc55eb9f1f5dce28d..18a94e4a418ab4eeda0572640f838fa12a188513 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
@@ -58,6 +58,7 @@ for opts in '' '--add-missing' '-a -c'; do
   $AUTOMAKE $opts
   $FGREP test-driver Makefile.in sub[12]/Makefile.in && Exit 1
   find . | $FGREP test-driver && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 :
index f3a3ef56a82eff76299490be2fe480fb9357e66b..1d34ff14c67a60d290b39d3487eae9636d258456 100755 (executable)
@@ -158,6 +158,7 @@ for iteration in 1 2; do
   ls -l
   for t in $rechecked; do test -f $t.run; done
   find . -name 'n-*.run' | grep . && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 :
index aef08c19afec0f64bacc78759066d9e948a458cd..ee153f4da04adceb3b7dae28d1df1dcf7804f29a 100755 (executable)
@@ -62,6 +62,7 @@ test -f parse.c
 if cross_compiling; then :; else
   echo a | ./foo
   echo b | ./foo && Exit 1
+  : For shells with busted 'set -e'.
 fi
 
 # The generated file `parse.c' must be shipped.