Add tests to run Mosh repeatedly.
This commit is contained in:
@@ -24,6 +24,8 @@ displaytests = \
|
||||
emulation-wrap-across-frames.test \
|
||||
prediction-unicode.test \
|
||||
pty-deadlock.test \
|
||||
repeat.test \
|
||||
repeat-with-input.test \
|
||||
server-network-timeout.test \
|
||||
server-signal-timeout.test \
|
||||
window-resize.test \
|
||||
|
||||
+11
-2
@@ -174,6 +174,8 @@ for i in $test_args; do
|
||||
tmux=1;;
|
||||
client)
|
||||
client=1;;
|
||||
server)
|
||||
server=1;;
|
||||
post)
|
||||
post=1;;
|
||||
mosh-args)
|
||||
@@ -197,11 +199,17 @@ if [ -n "$client" ]; then
|
||||
client_wrapper="${test_script} client"
|
||||
fi
|
||||
|
||||
server_wrapper="\"${srcdir}/e2e-test-server\""
|
||||
if [ -n "$server" ]; then
|
||||
server_wrapper="\"${srcdir}/${test_script}\" server"
|
||||
fi
|
||||
tmux_stdin="${srcdir}/hold-stdin"
|
||||
if [ -n "$tmux" ]; then
|
||||
tmux_stdin="${test_script} tmux"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
for run in $server_tests; do
|
||||
log "Running server test %s.\n" "$run"
|
||||
# These three variables are for the benefit of the mosh-client and mosh-server wrappers.
|
||||
@@ -210,7 +218,6 @@ for run in $server_tests; do
|
||||
export MOSH_E2E_TEST="$PWD/${test_dir}/${run}"
|
||||
# XXX need to quote special chars in server pathname here somehow
|
||||
sut="../../scripts/mosh --client=${srcdir}/mosh-client --server=${srcdir}/mosh-server --local --bind-server=127.0.0.1 ${mosh_args} 127.0.0.1"
|
||||
testarg=$run
|
||||
if [ "$run" = "direct" ]; then
|
||||
sut=""
|
||||
fi
|
||||
@@ -218,7 +225,7 @@ for run in $server_tests; do
|
||||
# XXX tmux 1.8 requires shell command as a single arg; once we move to 2.0, undo these quotes
|
||||
# XXX this ignores $TMPDIR, because it results in an overlong pathname on OS X
|
||||
tmux_socket="/tmp/.tmux-mosh-test-$$"
|
||||
${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session "${srcdir}/print-exitstatus ${client_wrapper} ${sut} \"${srcdir}/e2e-test-server\" \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${testarg}\"" > "${test_dir}/${run}.tmux.log"
|
||||
${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session "${srcdir}/print-exitstatus ${client_wrapper} ${sut} ${server_wrapper} \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${run}\"" > "${test_dir}/${run}.tmux.log"
|
||||
rv=$?
|
||||
rm -f "${tmux_socket}"
|
||||
if [ $rv -ne 0 ]; then
|
||||
@@ -230,6 +237,7 @@ for run in $server_tests; do
|
||||
fi
|
||||
|
||||
# Check for server harness failures
|
||||
if [ -z "$server" ]; then
|
||||
if [ ! -s "${test_dir}/${run}.capture" ] \
|
||||
|| [ ! -s "${test_dir}/${run}.exitstatus" ]; then
|
||||
test_error "server harness failure on test %s\n" "$run"
|
||||
@@ -238,6 +246,7 @@ for run in $server_tests; do
|
||||
if [ "$server_rv" -ne 0 ]; then
|
||||
test_error "server harness exited with status %s\n" "$server_rv"
|
||||
fi
|
||||
fi
|
||||
# Check for "round-trip" failures
|
||||
if grep -q "round-trip Instruction verification failed" "${test_dir}/${run}.server.stderr"; then
|
||||
test_error "Round-trip Instruction verification failed on server during %s\n" "$run"
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
repeat.test
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Run mosh many times. If run as repeat-with-stdin.test, also send
|
||||
# input constantly, to try and trigger a bug where mosh-server would
|
||||
# exit on OS X if input was received after the client session had
|
||||
# exited.
|
||||
#
|
||||
|
||||
# 100 iterations runs in comparable time to other tests.
|
||||
: ${REPEAT_TEST_LOOPCOUNT:=100}
|
||||
|
||||
# shellcheck source=e2e-test-subrs
|
||||
. "$(dirname "$0")/e2e-test-subrs"
|
||||
PATH=$PATH:.:$srcdir
|
||||
|
||||
# Top-level wrapper.
|
||||
if [ $# -eq 0 ]; then
|
||||
do_tmux=
|
||||
case $(basename "$0" .test) in
|
||||
repeat-with-input)
|
||||
do_tmux=tmux;;
|
||||
esac
|
||||
e2e-test "$0" baseline client server ${do_tmux}
|
||||
exit
|
||||
fi
|
||||
|
||||
# Run mosh repeatedly
|
||||
client()
|
||||
{
|
||||
for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do
|
||||
(sleep 15; kill $$) &
|
||||
killpid=$!
|
||||
if ! "$@"; then
|
||||
printf "### iteration %d failed\n" "$i"
|
||||
kill $killpid
|
||||
exit 1
|
||||
fi
|
||||
kill $killpid
|
||||
done
|
||||
}
|
||||
|
||||
# e2e-test-server is slow because of its screen capture; this simple
|
||||
# wrapper is faster.
|
||||
server()
|
||||
{
|
||||
shift
|
||||
eval "$@"
|
||||
}
|
||||
|
||||
# Constantly send keyboard input.
|
||||
tmux_commands()
|
||||
{
|
||||
while printf "send-keys 0x0d\n"; do
|
||||
sleepf
|
||||
done
|
||||
}
|
||||
|
||||
tmux_stdin()
|
||||
{
|
||||
tmux_commands | "$@"
|
||||
exit
|
||||
}
|
||||
|
||||
baseline()
|
||||
{
|
||||
printf "@@@ done\n"
|
||||
}
|
||||
|
||||
post()
|
||||
{
|
||||
if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
tmux)
|
||||
shift;
|
||||
tmux_stdin "$@";;
|
||||
baseline)
|
||||
baseline;;
|
||||
client)
|
||||
shift
|
||||
client "$@";;
|
||||
server)
|
||||
shift
|
||||
server "$@";;
|
||||
*)
|
||||
fail "unknown test argument %s\n" "$1";;
|
||||
esac
|
||||
Reference in New Issue
Block a user