summaryrefslogtreecommitdiff
path: root/regress/multiplex.sh
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-07-09 13:22:03 +1000
committerDamien Miller <djm@mindrot.org>2014-07-09 13:22:03 +1000
commit612f965239a30fe536b11ece1834d9f470aeb029 (patch)
tree6c05fe13a46c0b356d76f12af5c2f360208585f1 /regress/multiplex.sh
parentd0bb950485ba121e43a77caf434115ed6417b46f (diff)
- 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)
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r--regress/multiplex.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 3e697e691..bc286b5e9 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.21 2013/05/17 04:29:14 dtucker Exp $ 1# $OpenBSD: multiplex.sh,v 1.22 2014/07/06 07:42:03 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4CTL=/tmp/openssh.regress.ctl-sock.$$ 4CTL=/tmp/openssh.regress.ctl-sock.$$
@@ -29,7 +29,8 @@ start_mux_master()
29 trace "start master, fork to background" 29 trace "start master, fork to background"
30 ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \ 30 ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \
31 -E $TEST_REGRESS_LOGFILE 2>&1 & 31 -E $TEST_REGRESS_LOGFILE 2>&1 &
32 MASTER_PID=$! 32 # NB. $SSH_PID will be killed by test-exec.sh:cleanup on fatal errors.
33 SSH_PID=$!
33 wait_for_mux_master_ready 34 wait_for_mux_master_ready
34} 35}
35 36
@@ -44,6 +45,8 @@ if [ $? -ne 0 ]; then
44 fail "environment not found" 45 fail "environment not found"
45fi 46fi
46 47
48fatal ok
49
47verbose "test $tid: transfer" 50verbose "test $tid: transfer"
48rm -f ${COPY} 51rm -f ${COPY}
49trace "ssh transfer over multiplexed connection and check result" 52trace "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
120 || fail "send exit command failed" 123 || fail "send exit command failed"
121 124
122# Wait for master to exit 125# Wait for master to exit
123wait $MASTER_PID 126wait $SSH_PID
124kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed" 127kill -0 $SSH_PID >/dev/null 2>&1 && fail "exit command failed"
125 128
126# Restart master and test -O stop command with master using -N 129# Restart master and test -O stop command with master using -N
127verbose "test $tid: cmd stop" 130verbose "test $tid: cmd stop"
@@ -138,6 +141,8 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_REGRESS_LOGFILE 2>&1
138# wait until both long-running command and master have exited. 141# wait until both long-running command and master have exited.
139wait $SLEEP_PID 142wait $SLEEP_PID
140[ $! != 0 ] || fail "waiting for concurrent command" 143[ $! != 0 ] || fail "waiting for concurrent command"
141wait $MASTER_PID 144wait $SSH_PID
142[ $! != 0 ] || fail "waiting for master stop" 145[ $! != 0 ] || fail "waiting for master stop"
143kill -0 $MASTER_PID >/dev/null 2>&1 && fail "stop command failed" 146kill -0 $SSH_PID >/dev/null 2>&1 && fatal "stop command failed"
147SSH_PID="" # Already gone, so don't kill in cleanup
148