From 6629c22308e03b94574f09b07d3bfbcf809d1d2a Mon Sep 17 00:00:00 2001 From: hyenias <58673227+hyenias@users.noreply.github.com> Date: Sun, 11 Apr 2021 14:57:40 -0400 Subject: [PATCH] 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 --- src/cmd/ksh93/tests/readonly.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/ksh93/tests/readonly.sh b/src/cmd/ksh93/tests/readonly.sh index 64b35f5e2..63c978396 100755 --- a/src/cmd/ksh93/tests/readonly.sh +++ b/src/cmd/ksh93/tests/readonly.sh @@ -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/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