shtests revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync: ksh regression test harness :
ca551aca153d6df494985b5281c573ba2e3eb474vboxsyncUSAGE_LICENSE="[-author?David Korn <dgk@research.att.com>][-author?Glenn Fowler <gsf@research.att.com>][-copyright?Copyright (c) 2000-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html]"
ca551aca153d6df494985b5281c573ba2e3eb474vboxsynccommand=shtests
ca551aca153d6df494985b5281c573ba2e3eb474vboxsyncsetslocale='*@(locale).sh'
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsynctimesensitive='*@(options|sigchld|subshell).sh'
ca551aca153d6df494985b5281c573ba2e3eb474vboxsyncvalgrindflags='--xml=yes --log-file=/dev/null --track-origins=yes --read-var-info=yes'
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync@(#)$Id: shtests (AT&T Research) 2012-05-29 $
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync'$USAGE_LICENSE$'
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[+NAME?shtests - ksh regression test harness]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[+DESCRIPTION?\bshtests\b is the \bksh\b(1) regression test harness for
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync \b$SHELL\b or \bksh\b if \bSHELL\b is not defined and exported. If
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync none of the \b--posix --utf8 --compile\b options are specified then
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync all three are enabled.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[+INPUT FILES?\bshtests\b regression test files are shell scripts that
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync run in an environment controlled by \bshtests\b. An identification
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync message is printed before and after each test on the standard output.
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync The default environment settings are:]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [+unset LANG]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [+unset LC_ALL]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [+LC_NUMERIC=C?\b.\b radix point assumed by all test scripts.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [+VMALLOC_OPTIONS=abort?\bvmalloc\b(1) arena checking enabled
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync with \babort(2)\b on error.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[c:compile?Run test scripts using \bshcomp\b(1).]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[d:debug?Enable \bshtests\b execution trace.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[l:locale?Disable \b--utf8\b and run the \b--posix\b and \b--compile\b
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync tests, if enabled, in the locale of the caller. This may cause invalid
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync regressions, especially for locales where \b.\b is not the radix
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[p:posix?Run the test scripts in the posix/C locale.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[t!:time?Include the current date/time in the test identification
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[u:utf8?Run the test scripts in the ast-specific C.UTF-8 locale.]
bd810d58866067df322ea7f4a4627d9bdebb70d3vboxsync[v!:vmalloc_options?Run tests with \bVMALLOC_OPTIONS=abort\b. Test
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync script names matching \b'$timesensitive$'\b are run with
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync \bVMALLOC_OPTIONS\b unset.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[V:valgrind?Set \b--novmalloc_options\b and run the test scripts with
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync \bvalgrind\b(1) on \bksh\b. If \b$SHELL-g\b exists and is executable
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync than it is used instead of \b$SHELL\b.]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync[x:trace?Enable script execution trace.]
061bebe04c5bfa05ed733d2a1204389c2a0c96a8vboxsync[ test.sh ... ] [ name=value ... ]
7f3bb583c97fd6f88c66f0047f1cd465afffefb4vboxsync[+SEE ALSO?\bksh\b(1), \bregress\b(1), \brt\b(1)]
ca551aca153d6df494985b5281c573ba2e3eb474vboxsyncfunction usage
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync getopts -a $command "$USAGE" OPT '--??long'
7f3bb583c97fd6f88c66f0047f1cd465afffefb4vboxsyncfunction valxml
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync typeset state=INIT data dir file fn line what
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync integer errors=0
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync #print === $1 ===; cat $1; print === ===
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync while read data
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync do case $state in
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync INIT) case $data in
d2e5354b92ecffb83d50e04ff040fa2e7bb8e24avboxsync state=ERROR
113e32cd5ad8ef067495b103da706e9494d30d37vboxsync ERROR) case $data in
bd810d58866067df322ea7f4a4627d9bdebb70d3vboxsync '<kind>'Leak*'</kind>')
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync '<kind>'*'</kind>')
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync what=UNKNOWN
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync FRAME) case $data in
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync '<dir>'*'</dir>')
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync dir=${data#'<dir>'}
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync dir=${dir%'</dir>'}
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync '<file>'*'</file>')
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync file=${data#'<file>'}
81b3101ea5e60964f67c97185bbd43dbf75c5ab5vboxsync file=${file%'</file>'}
81b3101ea5e60964f67c97185bbd43dbf75c5ab5vboxsync '<fn>'*'</fn>')
ebc248f21b276416f76e20da3add001aff9fc30avboxsync fn=${data#'<fn>'}
ebc248f21b276416f76e20da3add001aff9fc30avboxsync fn=${fn%'</fn>'}
061bebe04c5bfa05ed733d2a1204389c2a0c96a8vboxsync '<line>'*'</line>')
061bebe04c5bfa05ed733d2a1204389c2a0c96a8vboxsync line=${data#'<line>'}
061bebe04c5bfa05ed733d2a1204389c2a0c96a8vboxsync line=${line%'</line>'}
061bebe04c5bfa05ed733d2a1204389c2a0c96a8vboxsync '</frame>')
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [[ $dir ]] && dir+=/
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [[ $dir ]] && dir+=:
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [[ $line ]] && dir+=$line:
ca551aca153d6df494985b5281c573ba2e3eb474vboxsync [[ $fn ]] && dir+=$fn
PATH=/bin:/usr/bin
if [[ -d /usr/ucb ]]
then PATH=$PATH:/usr/ucb
if [[ $INSTALLROOT && -r $INSTALLROOT/bin/.paths ]]
then PATH=$INSTALLROOT/bin:$PATH
if [[ ${SHELL%/*} != $INSTALLROOT/bin ]]
then if whence $SHCOMP > /dev/null
valxml=$tmp/valgrind.xml
[[ $utf8 == 0 || $i == $setslocale ]] || locales+=" C.UTF-8"