From 5289908373dba0a99d9cfa2640403088bc79ec1f Mon Sep 17 00:00:00 2001 From: obrien Date: Tue, 12 Oct 2010 18:20:38 +0000 Subject: Allow one to regression test 'sh' changes without having to install a potentially bad /bin/sh first. --- tools/regression/bin/sh/Makefile | 5 ++- tools/regression/bin/sh/builtins/command8.0 | 2 +- tools/regression/bin/sh/builtins/exec1.0 | 2 +- tools/regression/bin/sh/builtins/exec2.0 | 2 +- tools/regression/bin/sh/builtins/fc1.0 | 2 +- tools/regression/bin/sh/builtins/fc2.0 | 2 +- tools/regression/bin/sh/builtins/trap1.0 | 4 +- tools/regression/bin/sh/builtins/var-assign.0 | 4 +- tools/regression/bin/sh/builtins/var-assign2.0 | 4 +- tools/regression/bin/sh/errors/assignment-error1.0 | 8 ++-- tools/regression/bin/sh/errors/backquote-error1.0 | 2 +- tools/regression/bin/sh/errors/backquote-error2.0 | 6 +-- tools/regression/bin/sh/errors/option-error.0 | 4 +- tools/regression/bin/sh/errors/redirection-error.0 | 4 +- .../regression/bin/sh/errors/redirection-error2.2 | 2 +- .../regression/bin/sh/errors/redirection-error3.0 | 4 +- tools/regression/bin/sh/execution/fork1.0 | 4 +- tools/regression/bin/sh/execution/fork2.0 | 4 +- tools/regression/bin/sh/execution/func1.0 | 4 +- tools/regression/bin/sh/execution/redir2.0 | 2 +- tools/regression/bin/sh/expansion/question1.0 | 26 ++++++------ tools/regression/bin/sh/expansion/set-u1.0 | 46 +++++++++++----------- tools/regression/bin/sh/parameters/mail1.0 | 2 +- tools/regression/bin/sh/parameters/mail2.0 | 2 +- tools/regression/bin/sh/parameters/pwd1.0 | 8 ++-- tools/regression/bin/sh/parameters/pwd2.0 | 8 ++-- tools/regression/bin/sh/regress.sh | 8 +++- tools/regression/bin/sh/regress.t | 8 +++- 28 files changed, 97 insertions(+), 82 deletions(-) (limited to 'tools') diff --git a/tools/regression/bin/sh/Makefile b/tools/regression/bin/sh/Makefile index 2c9ca59..82b9c09 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/command8.0 b/tools/regression/bin/sh/builtins/command8.0 index 949ffed..9e3a2b6 100644 --- a/tools/regression/bin/sh/builtins/command8.0 +++ b/tools/regression/bin/sh/builtins/command8.0 @@ -22,7 +22,7 @@ set -e set -- ${SPECIAL} for cmd in "$@" do - sh -c "v=:; while \$v; do v=false; command ${cmd}; done" >/dev/null + ${SH} -c "v=:; while \$v; do v=false; command ${cmd}; done" >/dev/null done while :; do diff --git a/tools/regression/bin/sh/builtins/exec1.0 b/tools/regression/bin/sh/builtins/exec1.0 index 94af2a0..dd30a4c 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/exec2.0 b/tools/regression/bin/sh/builtins/exec2.0 index a04bf34..3dcb6c4 100644 --- a/tools/regression/bin/sh/builtins/exec2.0 +++ b/tools/regression/bin/sh/builtins/exec2.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/fc1.0 b/tools/regression/bin/sh/builtins/fc1.0 index 59d10ef..ab7a387 100644 --- a/tools/regression/bin/sh/builtins/fc1.0 +++ b/tools/regression/bin/sh/builtins/fc1.0 @@ -8,7 +8,7 @@ T=$(mktemp -d sh-test.XXXXXX) cd $T mkfifo input output error -HISTFILE=/dev/null sh +m -i output 2>error & +HISTFILE=/dev/null ${SH} +m -i output 2>error & { # Syntax error echo ')' >&3 diff --git a/tools/regression/bin/sh/builtins/fc2.0 b/tools/regression/bin/sh/builtins/fc2.0 index 4f696d4..7eb92ac 100644 --- a/tools/regression/bin/sh/builtins/fc2.0 +++ b/tools/regression/bin/sh/builtins/fc2.0 @@ -8,7 +8,7 @@ T=$(mktemp -d sh-test.XXXXXX) cd $T mkfifo input output error -HISTFILE=/dev/null sh +m -i output 2>error & +HISTFILE=/dev/null ${SH} +m -i output 2>error & exec 3>input { # Command not found, containing slash diff --git a/tools/regression/bin/sh/builtins/trap1.0 b/tools/regression/bin/sh/builtins/trap1.0 index 1a87f4c..313f6a3 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 2e57a31..ace39c0 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/builtins/var-assign2.0 b/tools/regression/bin/sh/builtins/var-assign2.0 index b7dbaf7..eafec89 100644 --- a/tools/regression/bin/sh/builtins/var-assign2.0 +++ b/tools/regression/bin/sh/builtins/var-assign2.0 @@ -45,11 +45,11 @@ set -e set -- ${SPECIAL} for cmd in "$@" do - sh -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 + ${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 done set -- ${UTILS} for cmd in "$@" do - sh -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 + ${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 done diff --git a/tools/regression/bin/sh/errors/assignment-error1.0 b/tools/regression/bin/sh/errors/assignment-error1.0 index c999b41..00eaed9 100644 --- a/tools/regression/bin/sh/errors/assignment-error1.0 +++ b/tools/regression/bin/sh/errors/assignment-error1.0 @@ -16,15 +16,15 @@ SPECIAL="break,\ unset foo" # If there is no command word, the shell must abort on an assignment error. -sh -c "readonly a=0; a=2; exit 0" 2>/dev/null && exit 1 +${SH} -c "readonly a=0; a=2; exit 0" 2>/dev/null && exit 1 # Special built-in utilities must abort on an assignment error. set -- ${SPECIAL} for cmd in "$@" do - sh -c "readonly a=0; a=2 ${cmd}; exit 0" 2>/dev/null && exit 1 + ${SH} -c "readonly a=0; a=2 ${cmd}; exit 0" 2>/dev/null && exit 1 done # Other utilities must not abort; we currently still execute them. -sh -c 'readonly a=0; a=1 true; exit $a' 2>/dev/null || exit 1 -sh -c 'readonly a=0; a=1 command :; exit $a' 2>/dev/null || exit 1 +${SH} -c 'readonly a=0; a=1 true; exit $a' 2>/dev/null || exit 1 +${SH} -c 'readonly a=0; a=1 command :; exit $a' 2>/dev/null || exit 1 diff --git a/tools/regression/bin/sh/errors/backquote-error1.0 b/tools/regression/bin/sh/errors/backquote-error1.0 index 2a40c88..43e3303 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/backquote-error2.0 b/tools/regression/bin/sh/errors/backquote-error2.0 index 977c055..5b49e2b 100644 --- a/tools/regression/bin/sh/errors/backquote-error2.0 +++ b/tools/regression/bin/sh/errors/backquote-error2.0 @@ -1,7 +1,7 @@ # $FreeBSD$ -sh -c 'echo `echo .BA"DCODE.` +${SH} -c 'echo `echo .BA"DCODE.` echo ".BAD"CODE.' 2>&1 | grep -q BADCODE && exit 1 -echo '`"`' | sh -n 2>/dev/null && exit 1 -echo '`'"'"'`' | sh -n 2>/dev/null && exit 1 +echo '`"`' | ${SH} -n 2>/dev/null && exit 1 +echo '`'"'"'`' | ${SH} -n 2>/dev/null && 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 f599d59..b4b44c4 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 d11118a..cb8c0b1 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 2117ecf..32bccd8 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/errors/redirection-error3.0 b/tools/regression/bin/sh/errors/redirection-error3.0 index 93f526c..8a07d03 100644 --- a/tools/regression/bin/sh/errors/redirection-error3.0 +++ b/tools/regression/bin/sh/errors/redirection-error3.0 @@ -44,11 +44,11 @@ UTILS="alias,\ set -- ${SPECIAL} for cmd in "$@" do - sh -c "command ${cmd} > /; exit 0" 2>/dev/null || exit 1 + ${SH} -c "command ${cmd} > /; exit 0" 2>/dev/null || exit 1 done set -- ${UTILS} for cmd in "$@" do - sh -c "command ${cmd} > /; exit 0" 2>/dev/null || exit 1 + ${SH} -c "command ${cmd} > /; exit 0" 2>/dev/null || exit 1 done diff --git a/tools/regression/bin/sh/execution/fork1.0 b/tools/regression/bin/sh/execution/fork1.0 index 3ed5de2..225a825 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 35ea3a3..62a2537 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 317b005..29fcc07 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/execution/redir2.0 b/tools/regression/bin/sh/execution/redir2.0 index 6976624..1588105 100644 --- a/tools/regression/bin/sh/execution/redir2.0 +++ b/tools/regression/bin/sh/execution/redir2.0 @@ -10,7 +10,7 @@ brokenpipe=0 mkfifo fifo1 fifo2 { { - exec sh -c 'exec &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 a66bfc9..763eb7d 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 26308ea..5791a5a 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 e3b7da3..343c99d 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 2>&1 +ENV=$goodfile MAIL=$mailfile ktrace -i -f "$T" ${SH} +m -i /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 d543030..0099379 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/parameters/pwd2.0 b/tools/regression/bin/sh/parameters/pwd2.0 index 29b5531..2297f8b 100644 --- a/tools/regression/bin/sh/parameters/pwd2.0 +++ b/tools/regression/bin/sh/parameters/pwd2.0 @@ -12,13 +12,13 @@ cd link [ "$PWD" = "$TP/link" ] [ "$(pwd)" = "$TP/link" ] [ "$(pwd -P)" = "$TP/test1" ] -[ "$(sh -c pwd)" = "$TP/link" ] -[ "$(sh -c pwd\ -P)" = "$TP/test1" ] +[ "$(${SH} -c pwd)" = "$TP/link" ] +[ "$(${SH} -c pwd\ -P)" = "$TP/test1" ] cd .. [ "$(pwd)" = "$TP" ] cd -P link [ "$PWD" = "$TP/test1" ] [ "$(pwd)" = "$TP/test1" ] [ "$(pwd -P)" = "$TP/test1" ] -[ "$(sh -c pwd)" = "$TP/test1" ] -[ "$(sh -c pwd\ -P)" = "$TP/test1" ] +[ "$(${SH} -c pwd)" = "$TP/test1" ] +[ "$(${SH} -c pwd\ -P)" = "$TP/test1" ] diff --git a/tools/regression/bin/sh/regress.sh b/tools/regression/bin/sh/regress.sh index a6889af..f4c389a 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 c36d834..2ae4fdb 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 -- cgit v1.1