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

Misc regression test fixes

src/cmd/ksh93/tests/basic.sh:
- Fix syntax error (unbalanced single quote) in two -c script
  invocations. It only failed to throw a syntax error due to a
  problematic hack in ksh that may be removed soon.
  See: https://github.com/ksh93/ksh/issues/199

src/cmd/ksh93/tests/builtins.sh,
src/cmd/ksh93/tests/io.sh:
- Redirect standard error on two ksh -i invocations to /dev/null
  to work around the test hanging on AIX.

src/cmd/ksh93/tests/comvario.sh:
- Remove duplicate copyright header.
- Fix warning format.

src/cmd/ksh93/tests/functions.sh:
- Fix the 'TERM signal sent to last process of function kills the
  script' test so that it works on AIX. We cannot rely on grepping
  'ps' output as the external 'sleep' command does not show the
  command name on AIX. Instead, find it by its parent PID.

src/cmd/ksh93/tests/locale.sh,
src/cmd/ksh93/tests/substring.sh:
- Rewrite the very broken multibyte locale tests (two outright
  syntax errors due to unbalanced quotes, and none of the tests
  actually worked).
- Since they set LC_ALL, move them to locale.sh.

src/cmd/ksh93/tests/variables.sh:
- Redirect stderr on some 'ulimit -t unlimited' invocations (which
  fork subshells as the intended side effect) to /dev/null in case
  that exceeds a system-defined limit.
This commit is contained in:
Martijn Dekker 2021-02-28 21:57:38 +00:00
parent 7ad274f8b6
commit 5d82004426
8 changed files with 45 additions and 44 deletions

View file

@ -36,8 +36,9 @@ read -n4 c < $0 2> /dev/null
ulimit -c 0
binecho=$(whence -p echo)
bin_echo=$(whence -p echo)
bin_sleep=$(whence -p sleep)
bin_kill=$(whence -p kill)
integer foo=33
bar=bye
@ -138,7 +139,7 @@ fi
if [[ $PWD != "$dir" ]]
then err_exit 'cd inside nested subshell changes $PWD'
fi
fun() "$binecho" hello
fun() "$bin_echo" hello
if [[ $(fun) != hello ]]
then err_exit one line functions not working
fi
@ -1126,7 +1127,15 @@ function gosleep
"$bin_sleep" 1
}
x=$(
(sleep .25; pid=; ps 2>/dev/null | grep sleep | read pid extra; [[ $pid ]] && kill -- "$pid") &
ulimit -t unlimited 2>/dev/null # fork this subshell
mysubpid=${.sh.pid} # this subshell's new PID (new 93u+m feature)
(
sleep .25
# kill 'gosleep' by getting the PIDs that have $mysubpid as their parent PID
# (which includes this background process itself, but that's fine as we're invoking external 'kill')
pids=$(UNIX95=1 ps -o ppid= -o pid= 2>/dev/null | awk -v p=$mysubpid '$1==p { print $2 }')
[[ -n $pids ]] && "$bin_kill" $pids
) &
gosleep 2> /dev/null
print ok
)