mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
tests/pty.sh: a couple of minor tweaks
src/cmd/ksh93/tests/pty.sh:
- init: Remove superfluous lineno=$LINENO assignments. They aren't
needed if we avoid alias expansion on the err_exit function call.
- In the test "vi mode file name completion", append the main
shell's PID to /tmp/fakehome to make a slightly less insecure
temporary directory name. Unfortunately we cannot use $tmp as
that uses $TMPDIR which may cause a false pass. (re: 4cecde1d
)
This commit is contained in:
parent
8ad56f90ab
commit
39692fc3f6
1 changed files with 6 additions and 7 deletions
|
@ -42,11 +42,11 @@ Command=${0##*/}
|
|||
integer Errors=0 lineno=1
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
whence -q pty || { lineno=$LINENO; err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; }
|
||||
whence -q pty || { err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; }
|
||||
|
||||
# On FreeBSD, the 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.
|
||||
stty_restore=$(stty -g) || { lineno=$LINENO; err\_exit "$LINENO" "could not save terminal state -- tests skipped"; exit 0; }
|
||||
stty_restore=$(stty -g) || { err\_exit "$LINENO" "could not save terminal state -- tests skipped"; exit 0; }
|
||||
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
|
||||
|
||||
|
@ -468,19 +468,18 @@ end_disabled
|
|||
|
||||
# err_exit #
|
||||
# Test file name completion in vi mode
|
||||
mkdir /tmp/fakehome
|
||||
tst $LINENO <<"!"
|
||||
mkdir "/tmp/fakehome_$$" && tst $LINENO <<!
|
||||
L vi mode file name completion
|
||||
|
||||
# Completing a file name in vi mode that contains '~' and has a
|
||||
# base name the same length as the home directory's parent directory
|
||||
# shouldn't fail.
|
||||
|
||||
w set -o vi; HOME=/tmp/fakehome; touch ~/testfile
|
||||
w set -o vi; HOME=/tmp/fakehome_$$; touch ~/testfile_$$
|
||||
w echo ~/tes\t
|
||||
u ^/tmp/fakehome/testfile\r?\n$
|
||||
u ^/tmp/fakehome_$$/testfile_$$\r?\n$
|
||||
!
|
||||
rm -r /tmp/fakehome
|
||||
rm -r "/tmp/fakehome_$$"
|
||||
|
||||
# err_exit #
|
||||
LC_ALL=C tst $LINENO <<"!"
|
||||
|
|
Loading…
Reference in a new issue