mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix xtrace (shtests -x) for the regression tests
src/cmd/ksh93/tests/{shtests,_common}:
- When xtrace is active, set SECONDS to the float type so that
the $SECONDS expansion in $PS4 shows fractional seconds.
src/cmd/ksh93/tests/*.sh:
- Various fixes to avoid command substitutions incorporating xtrace
output into their results. Sometimes this is done by avoiding a
preceding assignment on a command that redirects 2>&1 (as that
will also redirect the preceding assignment and its xtrace,
causing the command substitution to capture the xtrace); other
times it was easiest to just turn off xtrace outright within the
command substitution.
src/cmd/ksh93/tests/math.sh:
- Remove an obsolete 'fixme' note.
This commit is contained in:
parent
16080141c5
commit
c59d888394
11 changed files with 38 additions and 21 deletions
|
|
@ -23,8 +23,14 @@
|
|||
|
||||
set -o nounset
|
||||
|
||||
# ksh functions reset xtrace; remember it to re-enable it
|
||||
typeset -si xtrace=0
|
||||
[[ -o xtrace ]] && ((xtrace++))
|
||||
|
||||
function test_arithmetric_expression_accesss_array_element_through_nameref
|
||||
{
|
||||
((xtrace)) && set -x
|
||||
|
||||
compound out=( typeset stdout stderr ; integer res )
|
||||
compound -r -a tests=(
|
||||
(
|
||||
|
|
@ -62,12 +68,6 @@ function test_arithmetric_expression_accesss_array_element_through_nameref
|
|||
typeset cmd
|
||||
|
||||
for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do
|
||||
# fixme: This list should include "typeset -lX" and "typeset -X" but ast-ksh.2010-03-09 fails like this:
|
||||
# 'typeset -X -a z ; z[1][3]=90 ; function x { nameref nz=$1 ; print " $(( nz ))==$(( $nz ))" ; } ; x z[1][3]'
|
||||
# + typeset -X -a z
|
||||
# + z[1][3]=90
|
||||
# + x 'z[1][3]'
|
||||
# /home/test001/bin/ksh[1]: x: line 1: x1.68000000000000000000000000000000p: no parent
|
||||
for ty in \
|
||||
'typeset' \
|
||||
'integer' \
|
||||
|
|
@ -140,9 +140,9 @@ function test_arithmetric_expression_accesss_array_element_through_nameref
|
|||
esac
|
||||
|
||||
testname="${0}/${cmd}"
|
||||
#set -x
|
||||
((xtrace)) && set +x
|
||||
out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -o errexit -c "${cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
|
||||
#set +x
|
||||
((xtrace)) && set -x
|
||||
|
||||
[[ "${out.stdout}" == ${tst.stdoutpattern} ]] || err_exit "${testname}: Expected stdout to match $(printf '%q\n' "${tst.stdoutpattern}"), got $(printf '%q\n' "${out.stdout}")"
|
||||
[[ "${out.stderr}" == '' ]] || err_exit "${testname}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")"
|
||||
|
|
@ -156,6 +156,8 @@ function test_arithmetric_expression_accesss_array_element_through_nameref
|
|||
|
||||
function test_has_iszero
|
||||
{
|
||||
((xtrace)) && set -x
|
||||
|
||||
typeset str
|
||||
integer i
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue