let regression testsuite pass without existence of /usr/bin/env, env(1)

by writing appropriate shell replacements
This commit is contained in:
tg 2012-03-31 18:18:41 +00:00
parent 9646c98356
commit e2a258c527
1 changed files with 28 additions and 8 deletions

36
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.525 2012/03/29 19:22:55 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.526 2012/03/31 18:18:41 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -4520,6 +4520,9 @@ name: regression-42
description: description:
Can't use command line assignments to assign readonly parameters. Can't use command line assignments to assign readonly parameters.
stdin: stdin:
print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
done >env; chmod +x env; PATH=.:$PATH
foo=bar foo=bar
readonly foo readonly foo
foo=stuff env | grep '^foo' foo=stuff env | grep '^foo'
@ -4635,10 +4638,10 @@ name: regression-50
description: description:
Check that aliases do not use continuation prompt after trailing Check that aliases do not use continuation prompt after trailing
semi-colon. semi-colon.
file-setup: file 644 "env" file-setup: file 644 "envf"
PS1=Y PS1=Y
PS2=X PS2=X
env-setup: !ENV=./env! env-setup: !ENV=./envf!
need-ctty: yes need-ctty: yes
arguments: !-i! arguments: !-i!
stdin: stdin:
@ -4665,11 +4668,11 @@ expected-stdout:
name: regression-52 name: regression-52
description: description:
Check that globbing works in pipelined commands Check that globbing works in pipelined commands
file-setup: file 644 "env" file-setup: file 644 "envf"
PS1=P PS1=P
file-setup: file 644 "abc" file-setup: file 644 "abc"
stuff stuff
env-setup: !ENV=./env! env-setup: !ENV=./envf!
need-ctty: yes need-ctty: yes
arguments: !-i! arguments: !-i!
stdin: stdin:
@ -5202,6 +5205,9 @@ name: xxx-exec-environment-1
description: description:
Check to see if exec sets it's environment correctly Check to see if exec sets it's environment correctly
stdin: stdin:
print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
done >env; chmod +x env; PATH=.:$PATH
FOO=bar exec env FOO=bar exec env
expected-stdout-pattern: expected-stdout-pattern:
/(^|.*\n)FOO=bar\n/ /(^|.*\n)FOO=bar\n/
@ -5211,9 +5217,11 @@ description:
Check to make sure exec doesn't change environment if a program Check to make sure exec doesn't change environment if a program
isn't exec-ed isn't exec-ed
stdin: stdin:
sortprog=$(whence -p sort) || sortprog=cat print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
env | $sortprog | grep -v '^RANDOM=' >bar1 'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
FOO=bar exec; env | $sortprog | grep -v '^RANDOM=' >bar2 done >env; chmod +x env; PATH=.:$PATH
env >bar1
FOO=bar exec; env >bar2
cmp -s bar1 bar2 cmp -s bar1 bar2
--- ---
name: exec-function-environment-1 name: exec-function-environment-1
@ -5433,6 +5441,10 @@ name: exit-err-1
description: description:
Check some "exit on error" conditions Check some "exit on error" conditions
stdin: stdin:
print '#!'"$__progname"'\nexec "$1"' >env
print '#!'"$__progname"'\nexit 1' >false
chmod +x env false
PATH=.:$PATH
set -ex set -ex
env false && echo something env false && echo something
echo END echo END
@ -5446,6 +5458,11 @@ name: exit-err-2
description: description:
Check some "exit on error" edge conditions (POSIXly) Check some "exit on error" edge conditions (POSIXly)
stdin: stdin:
print '#!'"$__progname"'\nexec "$1"' >env
print '#!'"$__progname"'\nexit 1' >false
print '#!'"$__progname"'\nexit 0' >true
chmod +x env false
PATH=.:$PATH
set -ex set -ex
if env true; then if env true; then
env false && echo something env false && echo something
@ -8094,6 +8111,9 @@ description:
global environment. global environment.
Inspired by PR 2450. Inspired by PR 2450.
stdin: stdin:
print '#!'"$__progname"'\nunset RANDOM\nexport | while IFS= read -r' \
'RANDOM; do eval '\''print -r -- "$RANDOM=$'\''"$RANDOM"'\'\"\'\; \
done >env; chmod +x env; PATH=.:$PATH
function k { function k {
if [ x$FOO != xbar ]; then if [ x$FOO != xbar ]; then
echo 1 echo 1