mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
So, the pty regression tests on the Linux GitHub runner all failed. Let's test an assumption: the reason is that we need the stty builtin to properly set the pty state, because the OS-provided stty command does not work if there is no real tty. src/cmd/ksh93/data/builtins.c: - Compile in the stty built-in. This adds about 20k to the binary for a command that most users rarely need and even more rarely need to be built in, so only compile it in on non-release builds. src/cmd/ksh93/tests/pty.sh: - Skip the tests if we cannot either use the stty builtin or change the state of the real terminal to be compatible with the tests.
This commit is contained in:
parent
9ad9a1de44
commit
2e6c56df82
2 changed files with 11 additions and 4 deletions
|
@ -153,6 +153,10 @@ const struct shtable3 shtab_builtins[] =
|
|||
#if !_std_malloc && !_AST_std_malloc
|
||||
CMDLIST(vmstate)
|
||||
#endif
|
||||
#if !_AST_ksh_release
|
||||
/* The pty.sh regression tests need the stty builtin */
|
||||
CMDLIST(stty)
|
||||
#endif
|
||||
#endif
|
||||
#if SHOPT_REGRESS
|
||||
"__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__),
|
||||
|
|
|
@ -39,20 +39,23 @@ function err_exit
|
|||
}
|
||||
|
||||
alias err_exit='err_exit $lineno'
|
||||
alias warning='err\_exit $((Errors--,LINENO)) warning:'
|
||||
|
||||
Command=${0##*/}
|
||||
integer Errors=0 lineno=1
|
||||
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
whence -q pty || { err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; }
|
||||
whence -q pty || { warning "pty command not found -- tests skipped"; exit 0; }
|
||||
|
||||
# On FreeBSD, the OS-provided stty command does not appear to work correctly on a pty pseudoterminal.
|
||||
# To avoid a couple of false regressions, we have to set 'erase' and 'kill' on the real terminal.
|
||||
# On FreeBSD, or if there is no tty, the OS-provided stty command does not appear to work correctly on a pty pseudoterminal.
|
||||
# To avoid false regressions, we have to either use the stty builtin, or set 'erase' and 'kill' on the real terminal.
|
||||
if builtin stty 2>/dev/null
|
||||
then PATH=/opt/ast/bin:$PATH
|
||||
then PATH=/opt/ast/bin:$PATH # virtual path for ksh path-bound builtins, so child shells use the stty builtin
|
||||
elif test -t 1 2>/dev/null 1>/dev/tty && stty_restore=$(stty -g)
|
||||
then trap 'stty "$stty_restore"' EXIT # note: on ksh, the EXIT trap is also triggered for termination due to a signal
|
||||
stty erase ^H kill ^X
|
||||
else warning "cannot set tty state -- tests skipped"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
bintrue=$(whence -p true)
|
||||
|
|
Loading…
Reference in a new issue