mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +00:00
shtests: fix loose ends
src/cmd/ksh93/tests/variables.sh: - Tolerate a bit more time for the SECONDS verification test. src/cmd/ksh93/tests/subshell.sh: - Replace unportable 'head -c 1' by 'dd bs=1 count=1' - Remove unnecessary uses of 'whence'. src/cmd/ksh93/tests/builtins.sh: - Add a regression test for a weirdly specific 'whence' bug exposed by the aforementioned unneccessary uses of 'whence', which only shows up on my old Power Mac G5 running Mac OS X 10.3. For all I know it's a compiler bug, but let's add a more clear failure for it here, in case that happens anywhere else. (cherry picked from commit c3898bd1e6e40874845771d33a5b37220ef0b06e)
This commit is contained in:
parent
712261c89b
commit
fb652a7e50
3 changed files with 9 additions and 3 deletions
|
@ -679,5 +679,12 @@ expect=$'*: times: incorrect syntax'
|
|||
actual=$(set +x; eval 'times Extra Args' 2>&1)
|
||||
[[ $actual == $expect ]] || err_exit "times with args: expected $(printf %q "$expect"), got $(printf %q "$actual"))"
|
||||
|
||||
# ======
|
||||
# 'whence' builtin
|
||||
PATH=$tmp:$PATH $SHELL <<-\EOF || err_exit "'whence' gets wrong path on init"
|
||||
wc=$(whence wc)
|
||||
[[ -x $wc ]]
|
||||
EOF
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
|
@ -613,8 +613,7 @@ printf=$(whence -p printf)
|
|||
$SHELL 2> /dev/null -c '( PATH=/bin; set -o restricted) ; exit 0' || err_exit 'restoring PATH when a subshell enables restricted exits not working'
|
||||
|
||||
$SHELL <<- \EOF
|
||||
wc=$(whence wc) head=$(whence head)
|
||||
print > /dev/null $( ( $head -c 1 /dev/zero | ( $wc -c) 3>&1 ) 3>&1) &
|
||||
print > /dev/null $( ( dd if=/dev/zero bs=1 count=1 2>/dev/null | ( wc -c) 3>&1 ) 3>&1) &
|
||||
pid=$!
|
||||
sleep .2
|
||||
kill -9 $! 2> /dev/null && err_exit '/dev/zero in command substitution hangs'
|
||||
|
|
|
@ -440,7 +440,7 @@ function foo
|
|||
|
||||
}
|
||||
x=$(foo)
|
||||
(( x >.001 && x < .01 ))
|
||||
(( x >.001 && x < 1 ))
|
||||
'
|
||||
} 2> /dev/null || err_exit 'SECONDS not working in function'
|
||||
cat > $tmp/script <<-\!
|
||||
|
|
Loading…
Reference in a new issue