- djm@cvs.openbsd.org 2014/07/06 07:42:03
[multiplex.sh test-exec.sh] add a hook to the cleanup() function to kill $SSH_PID if it is set use it to kill the mux master started in multiplex.sh (it was being left around on fatal failures)
This commit is contained in:
parent
d0bb950485
commit
612f965239
|
@ -12,6 +12,12 @@
|
||||||
[key.c]
|
[key.c]
|
||||||
downgrade more error() to debug() to better match what old authfile.c
|
downgrade more error() to debug() to better match what old authfile.c
|
||||||
did; suppresses spurious errors with hostbased authentication enabled
|
did; suppresses spurious errors with hostbased authentication enabled
|
||||||
|
- djm@cvs.openbsd.org 2014/07/06 07:42:03
|
||||||
|
[multiplex.sh test-exec.sh]
|
||||||
|
add a hook to the cleanup() function to kill $SSH_PID if it is set
|
||||||
|
|
||||||
|
use it to kill the mux master started in multiplex.sh (it was being left
|
||||||
|
around on fatal failures)
|
||||||
|
|
||||||
20140706
|
20140706
|
||||||
- OpenBSD CVS Sync
|
- OpenBSD CVS Sync
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $OpenBSD: multiplex.sh,v 1.21 2013/05/17 04:29:14 dtucker Exp $
|
# $OpenBSD: multiplex.sh,v 1.22 2014/07/06 07:42:03 djm Exp $
|
||||||
# Placed in the Public Domain.
|
# Placed in the Public Domain.
|
||||||
|
|
||||||
CTL=/tmp/openssh.regress.ctl-sock.$$
|
CTL=/tmp/openssh.regress.ctl-sock.$$
|
||||||
|
@ -29,7 +29,8 @@ start_mux_master()
|
||||||
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 \
|
||||||
-E $TEST_REGRESS_LOGFILE 2>&1 &
|
-E $TEST_REGRESS_LOGFILE 2>&1 &
|
||||||
MASTER_PID=$!
|
# NB. $SSH_PID will be killed by test-exec.sh:cleanup on fatal errors.
|
||||||
|
SSH_PID=$!
|
||||||
wait_for_mux_master_ready
|
wait_for_mux_master_ready
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ if [ $? -ne 0 ]; then
|
||||||
fail "environment not found"
|
fail "environment not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fatal ok
|
||||||
|
|
||||||
verbose "test $tid: transfer"
|
verbose "test $tid: transfer"
|
||||||
rm -f ${COPY}
|
rm -f ${COPY}
|
||||||
trace "ssh transfer over multiplexed connection and check result"
|
trace "ssh transfer over multiplexed connection and check result"
|
||||||
|
@ -120,8 +123,8 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_REGRESS_LOGFILE 2>&1
|
||||||
|| fail "send exit command failed"
|
|| fail "send exit command failed"
|
||||||
|
|
||||||
# Wait for master to exit
|
# Wait for master to exit
|
||||||
wait $MASTER_PID
|
wait $SSH_PID
|
||||||
kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed"
|
kill -0 $SSH_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
|
||||||
verbose "test $tid: cmd stop"
|
verbose "test $tid: cmd stop"
|
||||||
|
@ -138,6 +141,8 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_REGRESS_LOGFILE 2>&1
|
||||||
# wait until both long-running command and master have exited.
|
# wait until both long-running command and master have exited.
|
||||||
wait $SLEEP_PID
|
wait $SLEEP_PID
|
||||||
[ $! != 0 ] || fail "waiting for concurrent command"
|
[ $! != 0 ] || fail "waiting for concurrent command"
|
||||||
wait $MASTER_PID
|
wait $SSH_PID
|
||||||
[ $! != 0 ] || fail "waiting for master stop"
|
[ $! != 0 ] || fail "waiting for master stop"
|
||||||
kill -0 $MASTER_PID >/dev/null 2>&1 && fail "stop command failed"
|
kill -0 $SSH_PID >/dev/null 2>&1 && fatal "stop command failed"
|
||||||
|
SSH_PID="" # Already gone, so don't kill in cleanup
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $OpenBSD: test-exec.sh,v 1.47 2013/11/09 05:41:34 dtucker Exp $
|
# $OpenBSD: test-exec.sh,v 1.48 2014/07/06 07:42:03 djm Exp $
|
||||||
# Placed in the Public Domain.
|
# Placed in the Public Domain.
|
||||||
|
|
||||||
#SUDO=sudo
|
#SUDO=sudo
|
||||||
|
@ -240,13 +240,20 @@ md5 () {
|
||||||
# helper
|
# helper
|
||||||
cleanup ()
|
cleanup ()
|
||||||
{
|
{
|
||||||
|
if [ "x$SSH_PID" != "x" ]; then
|
||||||
|
if [ $SSH_PID -lt 2 ]; then
|
||||||
|
echo bad pid for ssh: $SSH_PID
|
||||||
|
else
|
||||||
|
kill $SSH_PID
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
pid=`$SUDO cat $PIDFILE`
|
pid=`$SUDO cat $PIDFILE`
|
||||||
if [ "X$pid" = "X" ]; then
|
if [ "X$pid" = "X" ]; then
|
||||||
echo no sshd running
|
echo no sshd running
|
||||||
else
|
else
|
||||||
if [ $pid -lt 2 ]; then
|
if [ $pid -lt 2 ]; then
|
||||||
echo bad pid for ssh: $pid
|
echo bad pid for sshd: $pid
|
||||||
else
|
else
|
||||||
$SUDO kill $pid
|
$SUDO kill $pid
|
||||||
trace "wait for sshd to exit"
|
trace "wait for sshd to exit"
|
||||||
|
|
Loading…
Reference in New Issue