extend and fix the errexit tests:

* Debian pdksh fails #3 (trap) and #6 (BSD make)
* AT&T ksh93 passes all
* zsh does not pass them literally, but the actual functionality
  checked is right there
* dash fails #3 (trap) and does not pass #6 due to missing [[
* GNU bash 2 (MirPorts) and 3 (Debian) fails #6 (BSD make)
* oksh-current passes all
This commit is contained in:
tg
2009-03-22 15:47:23 +00:00
parent 820df9fcfb
commit 7c77d9369c

62
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.262 2009/03/21 11:09:35 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.263 2009/03/22 15:47:23 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -4227,7 +4227,7 @@ expected-stderr:
---
name: errexit-2
description:
Check some "exit on error" edge conditions needed for make(1)
Check some "exit on error" edge conditions (POSIXly)
stdin:
set -ex
if /usr/bin/env true; then
@ -4235,10 +4235,11 @@ stdin:
fi
echo END
expected-stdout:
END
expected-stderr:
+ /usr/bin/env true
+ /usr/bin/env false
expected-exit: e != 0
+ echo END
---
name: errexit-3
description:
@ -4257,6 +4258,61 @@ expected-stdout:
EXIT
expected-exit: e != 0
---
name: errexit-4
description:
"set -e" test suite (POSIX)
stdin:
set -e
echo pre
if true ; then
false && echo foo
fi
echo bar
expected-stdout:
pre
bar
---
name: errexit-5
description:
"set -e" test suite (POSIX)
stdin:
set -e
foo() {
while [ "$1" ]; do
for E in $x; do
[ "$1" = "$E" ] && { shift ; continue 2 ; }
done
x="$x $1"
shift
done
echo $x
}
echo pre
foo a b b c
echo post
expected-stdout:
pre
a b c
post
---
name: errexit-6
description:
"set -e" test suite (BSD make)
category: os:mirbsd
stdin:
mkdir zd zd/a zd/b
printf 'all:\n\t@echo eins\n\t@exit 42\n' >zd/a/Makefile
printf 'all:\n\t@echo zwei\n' >zd/b/Makefile
wd=$(pwd)
set -e
for entry in a b; do ( set -e; if [[ -d $wd/zd/$entry.i386 ]]; then _newdir_="$entry.i386"; else _newdir_="$entry"; fi; if [[ -z $_THISDIR_ ]]; then _nextdir_="$_newdir_"; else _nextdir_="$_THISDIR_/$_newdir_"; fi; _makefile_spec_=; [[ ! -f $wd/zd/$_newdir_/Makefile.bsd-wrapper ]] || _makefile_spec_="-f Makefile.bsd-wrapper"; subskipdir=; for skipdir in ; do subentry=${skipdir#$entry}; if [[ $subentry != $skipdir ]]; then if [[ -z $subentry ]]; then echo "($_nextdir_ skipped)"; break; fi; subskipdir="$subskipdir ${subentry#/}"; fi; done; if [[ -z $skipdir || -n $subentry ]]; then echo "===> $_nextdir_"; cd $wd/zd/$_newdir_; make SKIPDIR="$subskipdir" $_makefile_spec_ _THISDIR_="$_nextdir_" all; fi; ) done 2>&1 | sed "s!$wd!WD!g"
expected-stdout:
===> a
eins
*** Error code 42
Stop in WD/zd/a (line 2 of Makefile).
---
name: test-stlt-1
description:
Check that test also can handle string1 < string2 etc.