[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {master} tests: workaround for shells with broken 'set -e'
From: |
Stefano Lattarini |
Subject: |
[FYI] {master} tests: workaround for shells with broken 'set -e' |
Date: |
Mon, 6 Feb 2012 22:24:08 +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/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.
---
tests/check-no-test-driver.test | 1 +
tests/check12.test | 1 +
tests/defs | 17 ++++++++++++++---
tests/lex-lib-external.test | 3 ++-
tests/lex-noyywrap.test | 5 +++--
tests/lex3.test | 5 +++--
tests/parallel-tests-dry-run-1.test | 5 ++++-
tests/parallel-tests-dry-run-2.test | 1 +
tests/parallel-tests-unreadable.test | 3 ++-
tests/parallel-tests2.test | 5 ++++-
tests/test-driver-custom-no-extra-driver.test | 3 ++-
tests/test-metadata-recheck.test | 1 +
12 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/tests/check-no-test-driver.test b/tests/check-no-test-driver.test
index 9406917..19ba34c 100755
--- a/tests/check-no-test-driver.test
+++ b/tests/check-no-test-driver.test
@@ -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
:
diff --git a/tests/check12.test b/tests/check12.test
index be4d84e..cf2623d 100755
--- a/tests/check12.test
+++ b/tests/check12.test
@@ -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
diff --git a/tests/defs b/tests/defs
index 40842cd..ace83af 100644
--- a/tests/defs
+++ b/tests/defs
@@ -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
diff --git a/tests/lex-lib-external.test b/tests/lex-lib-external.test
index 5f04594..1fb0009 100755
--- a/tests/lex-lib-external.test
+++ b/tests/lex-lib-external.test
@@ -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
diff --git a/tests/lex-noyywrap.test b/tests/lex-noyywrap.test
index 9431970..98561f2 100755
--- a/tests/lex-noyywrap.test
+++ b/tests/lex-noyywrap.test
@@ -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.
diff --git a/tests/lex3.test b/tests/lex3.test
index 46f0b9f..01d9651 100755
--- a/tests/lex3.test
+++ b/tests/lex3.test
@@ -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.
diff --git a/tests/parallel-tests-dry-run-1.test
b/tests/parallel-tests-dry-run-1.test
index 4ed59f0..27e62a0 100755
--- a/tests/parallel-tests-dry-run-1.test
+++ b/tests/parallel-tests-dry-run-1.test
@@ -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
}
diff --git a/tests/parallel-tests-dry-run-2.test
b/tests/parallel-tests-dry-run-2.test
index c81286e..1181689 100755
--- a/tests/parallel-tests-dry-run-2.test
+++ b/tests/parallel-tests-dry-run-2.test
@@ -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
diff --git a/tests/parallel-tests-unreadable.test
b/tests/parallel-tests-unreadable.test
index 2b4d077..425c31a 100755
--- a/tests/parallel-tests-unreadable.test
+++ b/tests/parallel-tests-unreadable.test
@@ -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
:
diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test
index a9ef964..ab0eee2 100755
--- a/tests/parallel-tests2.test
+++ b/tests/parallel-tests2.test
@@ -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
diff --git a/tests/test-driver-custom-no-extra-driver.test
b/tests/test-driver-custom-no-extra-driver.test
index 1196e77..18a94e4 100755
--- a/tests/test-driver-custom-no-extra-driver.test
+++ b/tests/test-driver-custom-no-extra-driver.test
@@ -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
:
diff --git a/tests/test-metadata-recheck.test b/tests/test-metadata-recheck.test
index f3a3ef5..1d34ff1 100755
--- a/tests/test-metadata-recheck.test
+++ b/tests/test-metadata-recheck.test
@@ -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
:
--
1.7.7.3
- [FYI] {master} tests: workaround for shells with broken 'set -e',
Stefano Lattarini <=