0N/A# This program runs ksh regression tests
1879N/A# shtests [ name=value ... ] [ --all | --compile ] [ --time ] [
a.sh b.sh ... ]
0N/Atimesensitive='*@(options|sigchld|subshell).sh'
0N/Aunset DISPLAY ENV FIGNORE HISTFILE
1879N/A -*) echo $0: $1: invalid option >&2
0N/Aelse export VMDEBUG=$vmdebug
0N/A[[ $VMDEBUG ]] || timesensitive=.
0N/Aexport LANG LC_ALL PATH PWD SHELL
304N/A*/*) d=$PWD/`dirname $0`;;
304N/A*) SHELL=$(whence $SHELL);;
304N/Athen SHCOMP=${SHCOMP:-shcomp}
304N/A then tmp=$(mktemp -dt) || { echo mktemp -dt failed >&2; exit 1; }
304N/A trap "cd /; rm -rf $tmp" EXIT
304N/A elif [[ $compile != 1 ]]
304N/A then echo $0: --compile: $SHCOMP not found >&2
304N/Ado t=$(grep -c err_exit $i)
304N/A then echo test $i begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
304N/A if [[ $i == $timesensitive ]]
304N/A then echo test $i passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]"
304N/A echo test $i failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]"
0N/A if [[ $i == $timesensitive ]]
304N/A then export VMDEBUG=$vmdebug
304N/A echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
304N/A if $SHCOMP $i > $tmp/$o
304N/A then if [[ $i == $timesensitive ]]
304N/A then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]"
echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]"
if [[ $i == $timesensitive ]]
then export VMDEBUG=$vmdebug
echo test $o failed to compile ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T 1 $E ]"