Files
mosh/src/tests/prediction-unicode.test
T
John Hood 477729b315 tests: improve robustness
Replace some blind timeouts with actual synchronization.
Improve performance on some slow tests.
Tweak some of the remaining timeouts.

This still isn't good enough to get 'make -j9 check'
working reliably on Cygwin for me; I think some Cygwin/
Windows scheduling issues remain.
2016-09-20 06:25:43 -04:00

93 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
#
# This is a regression test for a bug seen where mosh-client's
# prediction code would sometimes show "gück" when "glück" was typed.
# mosh-client would output a predicted Unicode input character
# first as an 8-bit character containing the lowest 8 bits of the
# Unicode code point, then redraw it correctly with its UTF-8 sequence
# when the prediction is validated. For many accented Latin
# characters, the 8-bit character is an illegal UTF-8 code sequence.
# Most terminal emulators will output the Unicode replacement
# character, which is only visible until validation. urxvt, however,
# draws no character and does not change the cursor location on an
# illegal UTF-8 sequence, causing this bug to be visible as ongoing
# display corruption. A subset of wide characters (including CJK)
# will show display corruption with all terminal emulators, because a
# narrow replacement character will be drawn when a wide character
# should have been.
#
# tmux draws a replacement character for invalid UTF-8, and we
# depend on that in this test.
#
# Another similar failing case is typing "faĩl". In this case the "ĩ"
# would be predicted as ")" before being replaced by the
# correct character.
#
. $(dirname $0)/e2e-test-subrs
PATH=$PATH:.:$srcdir
# Top-level wrapper.
if [ $# -eq 0 ]; then
e2e-test $0 tmux baseline mosh-args post
exit
fi
tmux_commands()
{
for x in $(seq 1 5); do
for y in $(seq 1 5); do
for i in "gl" ü "ck fa" ĩ "l "; do
printf "send-keys '%s'\n" "$i"
sleepf
done
done
printf "send-keys 0x0d\n"
done
printf "send-keys 0x0d\n"
sleep 1
printf "send-keys 0x04\n"
# Unreliable on Cygwin under load, it seems.
sleep 1
printf "send-keys 0x04\n"
# This will get killed by SIGPIPE.
while sleep 1; do
printf "show-options\n"
done
}
tmux_stdin()
{
tmux_commands | "$@"
exit
}
baseline()
{
# Just receive and toss input in canonical mode.
cat > /dev/null
}
post()
{
# Look for bad output: ')' or \374
if [ -n "$(env -u LC_ALL -u LC_CTYPE -u LANGUAGE LANG=C egrep "%output %0 (\)|$(printf \\374))" $(basename $0).d/baseline.tmux.log)" ]; then
exit 1
fi
exit 0
}
case $1 in
tmux)
shift;
tmux_stdin "$@";;
baseline)
baseline;;
mosh-args)
printf "%s\n" "--predict=always";;
post)
post;;
*)
fail "unknown test argument %s\n" $1;;
esac