Add tests to run Mosh repeatedly.

This commit is contained in:
John Hood
2016-11-06 01:50:20 -05:00
parent 22f5d58144
commit 444eae1fc4
4 changed files with 112 additions and 9 deletions
+18 -9
View File
@@ -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,13 +237,15 @@ for run in $server_tests; do
fi
# Check for server harness failures
if [ ! -s "${test_dir}/${run}.capture" ] \
|| [ ! -s "${test_dir}/${run}.exitstatus" ]; then
test_error "server harness failure on test %s\n" "$run"
fi
read -r server_rv < "${test_dir}/${run}.exitstatus"
if [ "$server_rv" -ne 0 ]; then
test_error "server harness exited with status %s\n" "$server_rv"
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"
fi
read -r server_rv < "${test_dir}/${run}.exitstatus"
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