1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Adjust readonly regression tests for freezes (#267)

src/cmd/ksh93/tests/readonly.sh:
- Use a 'ulimit --cpu' as a workaround to close down hung processes
  that might be caused due to a couple of known bugs (recursion and
  type variable function)
  Discussion: https://github.com/ksh93/ksh/issues/264
- Adjust tests so xtrace can be used
- Use integer n within for loop
This commit is contained in:
hyenias 2021-04-11 14:57:40 -04:00 committed by GitHub
parent d50d3d7c4c
commit 6629c22308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -314,12 +314,12 @@ rtests=(
)
)
typeset -i i
typeset -i i n
n=${#rtests[@]}
for ((i=0; i<$n; i++))
ulimit --cpu 3 2>/dev/null
for ((i=0; i<n; i++))
do
got=$(
((.sh.version < 20210404)) && ulimit -t unlimited 2>/dev/null # fork to dodge an arith recursion detection bug
trap "${rtests[$i].res}" EXIT
eval "${rtests[$i].ini}"
eval "${rtests[$i].chg}" 2>&1
@ -327,7 +327,7 @@ do
[[ $got == *$': is read only\n'* ]] || err_exit "Readonly variable did not warn for rtests[$i]: "\
"setup='${rtests[$i].ini}', change='${rtests[$i].chg}'"
got=${got#*$': is read only\n'}
[[ ${rtests[$i].exp} == "$got" ]] || err_exit "Readonly variable changed on rtests[$i]: "\
[[ $got == *"${rtests[$i].exp}" ]] || err_exit "Readonly variable changed on rtests[$i]: "\
"expected '${rtests[$i].exp}', got '$got'"
done
unset i n got rtests