[regress/multiplex.sh]
     use -Ocheck and waiting for completions by PID to make multiplexing test
     less racy and (hopefully) more reliable on slow hardware.
This commit is contained in:
Darren Tucker 2012-10-05 12:04:10 +10:00
parent 9b2c0360cf
commit ee4ad778d7
2 changed files with 31 additions and 14 deletions

View File

@ -42,6 +42,10 @@
Log -O cmd output to the log file and make logging consistent with the Log -O cmd output to the log file and make logging consistent with the
other tests. Test clean shutdown of an existing channel when testing other tests. Test clean shutdown of an existing channel when testing
"stop". "stop".
- dtucker@cvs.openbsd.org 2012/09/10 01:51:19
[regress/multiplex.sh]
use -Ocheck and waiting for completions by PID to make multiplexing test
less racy and (hopefully) more reliable on slow hardware.
- [Makefile umac.c] Add special-case target to build umac128.o. - [Makefile umac.c] Add special-case target to build umac128.o.
20120917 20120917

View File

@ -1,4 +1,4 @@
# $OpenBSD: multiplex.sh,v 1.15 2012/09/10 00:49:21 dtucker Exp $ # $OpenBSD: multiplex.sh,v 1.16 2012/09/10 01:51:19 dtucker Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
CTL=/tmp/openssh.regress.ctl-sock.$$ CTL=/tmp/openssh.regress.ctl-sock.$$
@ -13,14 +13,22 @@ fi
DATA=/bin/ls${EXEEXT} DATA=/bin/ls${EXEEXT}
COPY=$OBJ/ls.copy COPY=$OBJ/ls.copy
wait_for_mux_master_ready()
{
for i in 1 2 3 4 5; do
${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost \
>/dev/null 2>&1 && return 0
sleep $i
done
fatal "mux master never becomes ready"
}
start_sshd start_sshd
trace "start master, fork to background" trace "start master, fork to background"
${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost &
MASTER_PID=$! MASTER_PID=$!
wait_for_mux_master_ready
# Wait for master to start and authenticate
sleep 5
verbose "test $tid: envpass" verbose "test $tid: envpass"
trace "env passing over multiplexed connection" trace "env passing over multiplexed connection"
@ -87,21 +95,26 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_SSH_LOGFILE 2>&1 \
|| fail "send exit command failed" || fail "send exit command failed"
# Wait for master to exit # Wait for master to exit
sleep 2 wait $MASTER_PID
kill -0 $MASTER_PID >/dev/null && fail "exit command failed"
kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed"
# Restart master and test -O stop command with master using -N # Restart master and test -O stop command with master using -N
trace "start master, fork to background" verbose "test $tid: cmd stop"
trace "restart master, fork to background"
${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost &
MASTER_PID=$! MASTER_PID=$!
sleep 5 # Wait for master to start and authenticate wait_for_mux_master_ready
verbose "test $tid: cmd stop"
${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" & # start a long-running command then immediately request a stop
${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \
>>$TEST_SSH_LOGFILE 2>&1 &
SLEEP_PID=$! SLEEP_PID=$!
${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \ ${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \
|| fail "send stop command failed" || fail "send stop command failed"
sleep 12 # Wait for master to exit
# wait until both long-running command and master have exited.
wait $SLEEP_PID wait $SLEEP_PID
[ $! != 0 ] || fail "stop with concurrent command" [ $! != 0 ] || fail "waiting for concurrent command"
ps -p $MASTER_PID >/dev/null && fail "stop command failed" wait $MASTER_PID
[ $! != 0 ] || fail "waiting for master stop"
kill -0 $MASTER_PID >/dev/null && fail "stop command failed"