diff options
| author | David E. O'Brien <obrien@FreeBSD.org> | 2010-10-19 23:57:34 +0000 |
|---|---|---|
| committer | David E. O'Brien <obrien@FreeBSD.org> | 2010-10-19 23:57:34 +0000 |
| commit | 6a0cb08c2f6f8610df85476efc11fe82190b71f4 (patch) | |
| tree | 7a0e4c8c8198a0e7318888d2653eee4f4884b8d5 /tools/regression | |
| parent | 89aca56485c43982e5f7e4fc03307355e326ad57 (diff) | |
Notes
Diffstat (limited to 'tools/regression')
| -rw-r--r-- | tools/regression/bin/sh/Makefile | 5 | ||||
| -rw-r--r-- | tools/regression/bin/sh/builtins/exec1.0 | 2 | ||||
| -rw-r--r-- | tools/regression/bin/sh/builtins/trap1.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/builtins/var-assign.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/errors/backquote-error1.0 | 2 | ||||
| -rw-r--r-- | tools/regression/bin/sh/errors/option-error.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/errors/redirection-error.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/errors/redirection-error2.2 | 2 | ||||
| -rw-r--r-- | tools/regression/bin/sh/execution/fork1.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/execution/fork2.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/execution/func1.0 | 4 | ||||
| -rw-r--r-- | tools/regression/bin/sh/expansion/question1.0 | 26 | ||||
| -rw-r--r-- | tools/regression/bin/sh/expansion/set-u1.0 | 46 | ||||
| -rw-r--r-- | tools/regression/bin/sh/parameters/mail1.0 | 2 | ||||
| -rw-r--r-- | tools/regression/bin/sh/parameters/mail2.0 | 2 | ||||
| -rw-r--r-- | tools/regression/bin/sh/parameters/pwd1.0 | 8 | ||||
| -rw-r--r-- | tools/regression/bin/sh/regress.sh | 8 | ||||
| -rw-r--r-- | tools/regression/bin/sh/regress.t | 8 |
18 files changed, 77 insertions, 62 deletions
diff --git a/tools/regression/bin/sh/Makefile b/tools/regression/bin/sh/Makefile index 2c9ca5943505..82b9c09f2c2e 100644 --- a/tools/regression/bin/sh/Makefile +++ b/tools/regression/bin/sh/Makefile @@ -1,4 +1,7 @@ # $FreeBSD$ +# Allow one to specify the 'sh' to regress. +SH?= /bin/sh + all: - sh regress.sh + env SH=${SH} ${SH} regress.sh diff --git a/tools/regression/bin/sh/builtins/exec1.0 b/tools/regression/bin/sh/builtins/exec1.0 index 94af2a08f3cd..dd30a4c9aa93 100644 --- a/tools/regression/bin/sh/builtins/exec1.0 +++ b/tools/regression/bin/sh/builtins/exec1.0 @@ -12,7 +12,7 @@ failure() { ) [ $? = 0 ] || failure $LINENO ( - exec sh -c 'exit 42' + exec ${SH} -c 'exit 42' echo bad ) [ $? = 42 ] || failure $LINENO diff --git a/tools/regression/bin/sh/builtins/trap1.0 b/tools/regression/bin/sh/builtins/trap1.0 index 1a87f4cb7f8c..313f6a387678 100644 --- a/tools/regression/bin/sh/builtins/trap1.0 +++ b/tools/regression/bin/sh/builtins/trap1.0 @@ -4,11 +4,11 @@ test "$(trap 'echo trapped' EXIT; :)" = trapped || exit 1 test "$(trap 'echo trapped' EXIT; /usr/bin/true)" = trapped || exit 1 -result=$(sh -c 'trap "echo trapped" EXIT; /usr/bin/false') +result=$(${SH} -c 'trap "echo trapped" EXIT; /usr/bin/false') test $? -eq 1 || exit 1 test "$result" = trapped || exit 1 -result=$(sh -c 'trap "echo trapped" EXIT; exec /usr/bin/false') +result=$(${SH} -c 'trap "echo trapped" EXIT; exec /usr/bin/false') test $? -eq 1 || exit 1 test -z "$result" || exit 1 diff --git a/tools/regression/bin/sh/builtins/var-assign.0 b/tools/regression/bin/sh/builtins/var-assign.0 index 2e57a3190ca1..ace39c042d5f 100644 --- a/tools/regression/bin/sh/builtins/var-assign.0 +++ b/tools/regression/bin/sh/builtins/var-assign.0 @@ -44,12 +44,12 @@ set -e set -- ${SPECIAL} for cmd in "$@" do - sh -c "VAR=1; VAR=0 ${cmd}; exit \${VAR}" >/dev/null 2>&1 + ${SH} -c "VAR=1; VAR=0 ${cmd}; exit \${VAR}" >/dev/null 2>&1 done # For other built-ins and utilites they do not. set -- ${UTILS} for cmd in "$@" do - sh -c "VAR=0; VAR=1 ${cmd}; exit \${VAR}" >/dev/null 2>&1 + ${SH} -c "VAR=0; VAR=1 ${cmd}; exit \${VAR}" >/dev/null 2>&1 done diff --git a/tools/regression/bin/sh/errors/backquote-error1.0 b/tools/regression/bin/sh/errors/backquote-error1.0 index 2a40c88e1be7..43e33034af9f 100644 --- a/tools/regression/bin/sh/errors/backquote-error1.0 +++ b/tools/regression/bin/sh/errors/backquote-error1.0 @@ -1,4 +1,4 @@ # $FreeBSD$ -echo 'echo `for` echo ".BAD"CODE.' | sh +m -i 2>&1 | grep -q BADCODE && exit 1 +echo 'echo `for` echo ".BAD"CODE.' | ${SH} +m -i 2>&1 | grep -q BADCODE && exit 1 exit 0 diff --git a/tools/regression/bin/sh/errors/option-error.0 b/tools/regression/bin/sh/errors/option-error.0 index f599d59072cc..b4b44c4a4062 100644 --- a/tools/regression/bin/sh/errors/option-error.0 +++ b/tools/regression/bin/sh/errors/option-error.0 @@ -35,12 +35,12 @@ UTILS="alias -y,\ set -- ${SPECIAL} for cmd in "$@" do - sh -c "${cmd}; exit 0" 2>/dev/null && exit 1 + ${SH} -c "${cmd}; exit 0" 2>/dev/null && exit 1 done # Other utilities must not abort. set -- ${UTILS} for cmd in "$@" do - sh -c "${cmd}; exit 0" 2>/dev/null || exit 1 + ${SH} -c "${cmd}; exit 0" 2>/dev/null || exit 1 done diff --git a/tools/regression/bin/sh/errors/redirection-error.0 b/tools/regression/bin/sh/errors/redirection-error.0 index d11118a9c9fa..cb8c0b113c13 100644 --- a/tools/regression/bin/sh/errors/redirection-error.0 +++ b/tools/regression/bin/sh/errors/redirection-error.0 @@ -42,12 +42,12 @@ UTILS="alias,\ set -- ${SPECIAL} for cmd in "$@" do - sh -c "${cmd} > /; exit 0" 2>/dev/null && exit 1 + ${SH} -c "${cmd} > /; exit 0" 2>/dev/null && exit 1 done # Other utilities must not abort. set -- ${UTILS} for cmd in "$@" do - sh -c "${cmd} > /; exit 0" 2>/dev/null || exit 1 + ${SH} -c "${cmd} > /; exit 0" 2>/dev/null || exit 1 done diff --git a/tools/regression/bin/sh/errors/redirection-error2.2 b/tools/regression/bin/sh/errors/redirection-error2.2 index 2117ecf07700..32bccd8e784a 100644 --- a/tools/regression/bin/sh/errors/redirection-error2.2 +++ b/tools/regression/bin/sh/errors/redirection-error2.2 @@ -1,4 +1,4 @@ # $FreeBSD$ # sh should fail gracefully on this bad redirect -sh -c 'echo 1 >&$a' 2>/dev/null +${SH} -c 'echo 1 >&$a' 2>/dev/null diff --git a/tools/regression/bin/sh/execution/fork1.0 b/tools/regression/bin/sh/execution/fork1.0 index 3ed5de2ec1f1..225a82593231 100644 --- a/tools/regression/bin/sh/execution/fork1.0 +++ b/tools/regression/bin/sh/execution/fork1.0 @@ -1,7 +1,7 @@ # $FreeBSD$ -result=$(sh -c 'ps -p $$ -o comm=') +result=$(${SH} -c 'ps -p $$ -o comm=') test "$result" = "ps" || exit 1 -result=$(sh -c 'ps -p $$ -o comm=; :') +result=$(${SH} -c 'ps -p $$ -o comm=; :') test "$result" = "sh" || exit 1 diff --git a/tools/regression/bin/sh/execution/fork2.0 b/tools/regression/bin/sh/execution/fork2.0 index 35ea3a34df9a..62a25379123c 100644 --- a/tools/regression/bin/sh/execution/fork2.0 +++ b/tools/regression/bin/sh/execution/fork2.0 @@ -1,9 +1,9 @@ # $FreeBSD$ -result=$(sh -c '(/bin/sleep 1)& sleep 0.1; ps -p $! -o comm=; kill $!') +result=$(${SH} -c '(/bin/sleep 1)& sleep 0.1; ps -p $! -o comm=; kill $!') test "$result" = sleep || exit 1 -result=$(sh -c '{ trap "echo trapped" EXIT; (/usr/bin/true); } & wait') +result=$(${SH} -c '{ trap "echo trapped" EXIT; (/usr/bin/true); } & wait') test "$result" = trapped || exit 1 exit 0 diff --git a/tools/regression/bin/sh/execution/func1.0 b/tools/regression/bin/sh/execution/func1.0 index 317b00588686..29fcc077b592 100644 --- a/tools/regression/bin/sh/execution/func1.0 +++ b/tools/regression/bin/sh/execution/func1.0 @@ -1,4 +1,4 @@ # $FreeBSD$ -MALLOC_OPTIONS=J sh -c 'g() { g() { :; }; :; }; g' && -MALLOC_OPTIONS=J sh -c 'g() { unset -f g; :; }; g' +MALLOC_OPTIONS=J ${SH} -c 'g() { g() { :; }; :; }; g' && +MALLOC_OPTIONS=J ${SH} -c 'g() { unset -f g; :; }; g' diff --git a/tools/regression/bin/sh/expansion/question1.0 b/tools/regression/bin/sh/expansion/question1.0 index 355af624aa6d..663c68d2046d 100644 --- a/tools/regression/bin/sh/expansion/question1.0 +++ b/tools/regression/bin/sh/expansion/question1.0 @@ -6,17 +6,17 @@ set -- ${x?} { [ "$#" = 2 ] && [ "$1" = a ] && [ "$2" = b ]; } || exit 1 unset x (echo ${x?abcdefg}) 2>&1 | grep -q abcdefg || exit 1 -sh -c 'unset foo; echo ${foo?}' 2>/dev/null && exit 1 -sh -c 'foo=; echo ${foo:?}' 2>/dev/null && exit 1 -sh -c 'foo=; echo ${foo?}' >/dev/null || exit 1 -sh -c 'foo=1; echo ${foo:?}' >/dev/null || exit 1 -sh -c 'echo ${!?}' 2>/dev/null && exit 1 -sh -c ':& echo ${!?}' >/dev/null || exit 1 -sh -c 'echo ${#?}' >/dev/null || exit 1 -sh -c 'echo ${*?}' 2>/dev/null && exit 1 -sh -c 'echo ${*?}' sh x >/dev/null || exit 1 -sh -c 'echo ${1?}' 2>/dev/null && exit 1 -sh -c 'echo ${1?}' sh x >/dev/null || exit 1 -sh -c 'echo ${2?}' sh x 2>/dev/null && exit 1 -sh -c 'echo ${2?}' sh x y >/dev/null || exit 1 +${SH} -c 'unset foo; echo ${foo?}' 2>/dev/null && exit 1 +${SH} -c 'foo=; echo ${foo:?}' 2>/dev/null && exit 1 +${SH} -c 'foo=; echo ${foo?}' >/dev/null || exit 1 +${SH} -c 'foo=1; echo ${foo:?}' >/dev/null || exit 1 +${SH} -c 'echo ${!?}' 2>/dev/null && exit 1 +${SH} -c ':& echo ${!?}' >/dev/null || exit 1 +${SH} -c 'echo ${#?}' >/dev/null || exit 1 +${SH} -c 'echo ${*?}' 2>/dev/null && exit 1 +${SH} -c 'echo ${*?}' ${SH} x >/dev/null || exit 1 +${SH} -c 'echo ${1?}' 2>/dev/null && exit 1 +${SH} -c 'echo ${1?}' ${SH} x >/dev/null || exit 1 +${SH} -c 'echo ${2?}' ${SH} x 2>/dev/null && exit 1 +${SH} -c 'echo ${2?}' ${SH} x y >/dev/null || exit 1 exit 0 diff --git a/tools/regression/bin/sh/expansion/set-u1.0 b/tools/regression/bin/sh/expansion/set-u1.0 index a66bfc9dc99b..763eb7dcfc8f 100644 --- a/tools/regression/bin/sh/expansion/set-u1.0 +++ b/tools/regression/bin/sh/expansion/set-u1.0 @@ -1,29 +1,29 @@ # $FreeBSD$ -sh -uc 'unset foo; echo $foo' 2>/dev/null && exit 1 -sh -uc 'foo=; echo $foo' >/dev/null || exit 1 -sh -uc 'foo=1; echo $foo' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1 +${SH} -uc 'foo=; echo $foo' >/dev/null || exit 1 +${SH} -uc 'foo=1; echo $foo' >/dev/null || exit 1 # -/+/= are unaffected by set -u -sh -uc 'unset foo; echo ${foo-}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo+}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo=}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 1 # length/trimming are affected -sh -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 1 -sh -uc 'foo=; echo ${#foo}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 1 -sh -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 1 -sh -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 1 -sh -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 1 -sh -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 1 -sh -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 1 +${SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 1 +${SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 1 +${SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 1 -sh -uc 'echo $!' 2>/dev/null && exit 1 -sh -uc ':& echo $!' >/dev/null || exit 1 -sh -uc 'echo $#' >/dev/null || exit 1 -sh -uc 'echo $1' 2>/dev/null && exit 1 -sh -uc 'echo $1' sh x >/dev/null || exit 1 -sh -uc 'echo $2' sh x 2>/dev/null && exit 1 -sh -uc 'echo $2' sh x y >/dev/null || exit 1 +${SH} -uc 'echo $!' 2>/dev/null && exit 1 +${SH} -uc ':& echo $!' >/dev/null || exit 1 +${SH} -uc 'echo $#' >/dev/null || exit 1 +${SH} -uc 'echo $1' 2>/dev/null && exit 1 +${SH} -uc 'echo $1' ${SH} x >/dev/null || exit 1 +${SH} -uc 'echo $2' ${SH} x 2>/dev/null && exit 1 +${SH} -uc 'echo $2' ${SH} x y >/dev/null || exit 1 exit 0 diff --git a/tools/regression/bin/sh/parameters/mail1.0 b/tools/regression/bin/sh/parameters/mail1.0 index 26308eadbdc4..5791a5accc7c 100644 --- a/tools/regression/bin/sh/parameters/mail1.0 +++ b/tools/regression/bin/sh/parameters/mail1.0 @@ -4,7 +4,7 @@ goodfile=/var/empty/sh-test-goodfile mailfile=/var/empty/sh-test-mailfile T=$(mktemp sh-test.XXXXXX) || exit -MAIL=$mailfile ktrace -i -f "$T" sh -c "[ -s $goodfile ]" 2>/dev/null +MAIL=$mailfile ktrace -i -f "$T" ${SH} -c "[ -s $goodfile ]" 2>/dev/null if ! grep -q $goodfile "$T"; then # ktrace problem rc=0 diff --git a/tools/regression/bin/sh/parameters/mail2.0 b/tools/regression/bin/sh/parameters/mail2.0 index e3b7da341328..343c99de9b27 100644 --- a/tools/regression/bin/sh/parameters/mail2.0 +++ b/tools/regression/bin/sh/parameters/mail2.0 @@ -4,7 +4,7 @@ goodfile=/var/empty/sh-test-goodfile mailfile=/var/empty/sh-test-mailfile T=$(mktemp sh-test.XXXXXX) || exit -ENV=$goodfile MAIL=$mailfile ktrace -i -f "$T" sh +m -i </dev/null >/dev/null 2>&1 +ENV=$goodfile MAIL=$mailfile ktrace -i -f "$T" ${SH} +m -i </dev/null >/dev/null 2>&1 if ! grep -q $goodfile "$T"; then # ktrace problem rc=0 diff --git a/tools/regression/bin/sh/parameters/pwd1.0 b/tools/regression/bin/sh/parameters/pwd1.0 index d54303065ed5..0099379a9d3c 100644 --- a/tools/regression/bin/sh/parameters/pwd1.0 +++ b/tools/regression/bin/sh/parameters/pwd1.0 @@ -3,9 +3,9 @@ cd / || exit 3 failures=0 -[ "$(PWD=foo sh -c 'pwd')" = / ] || : $((failures += 1)) -[ "$(PWD=/var/empty sh -c 'pwd')" = / ] || : $((failures += 1)) -[ "$(PWD=/var/empty/foo sh -c 'pwd')" = / ] || : $((failures += 1)) -[ "$(PWD=/bin/ls sh -c 'pwd')" = / ] || : $((failures += 1)) +[ "$(PWD=foo ${SH} -c 'pwd')" = / ] || : $((failures += 1)) +[ "$(PWD=/var/empty ${SH} -c 'pwd')" = / ] || : $((failures += 1)) +[ "$(PWD=/var/empty/foo ${SH} -c 'pwd')" = / ] || : $((failures += 1)) +[ "$(PWD=/bin/ls ${SH} -c 'pwd')" = / ] || : $((failures += 1)) exit $((failures != 0)) diff --git a/tools/regression/bin/sh/regress.sh b/tools/regression/bin/sh/regress.sh index a6889af50129..f4c389aa81df 100644 --- a/tools/regression/bin/sh/regress.sh +++ b/tools/regression/bin/sh/regress.sh @@ -1,12 +1,18 @@ # $FreeBSD$ +if [ -z "${SH}" ]; then + echo '${SH} is not set, please correct and re-run.' + exit 1 +fi +export SH=${SH} + COUNTER=1 do_test() { local c c=${COUNTER} COUNTER=$((COUNTER+1)) - sh $1 > tmp.stdout 2> tmp.stderr + ${SH} $1 > tmp.stdout 2> tmp.stderr if [ $? -ne $2 ]; then echo "not ok ${c} - ${1} # wrong exit status" rm tmp.stdout tmp.stderr diff --git a/tools/regression/bin/sh/regress.t b/tools/regression/bin/sh/regress.t index c36d8342d32a..2ae4fdb84a48 100644 --- a/tools/regression/bin/sh/regress.t +++ b/tools/regression/bin/sh/regress.t @@ -1,6 +1,12 @@ #!/bin/sh # $FreeBSD$ +if [ -z "${SH}" ]; then + echo '${SH} is not set, please correct and re-run.' + exit 1 +fi +export SH=${SH} + cd `dirname $0` -sh regress.sh +${SH} regress.sh |
