diff options
author | Damien Miller <djm@mindrot.org> | 2014-07-09 13:22:03 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-07-09 13:22:03 +1000 |
commit | 612f965239a30fe536b11ece1834d9f470aeb029 (patch) | |
tree | 6c05fe13a46c0b356d76f12af5c2f360208585f1 /regress/multiplex.sh | |
parent | d0bb950485ba121e43a77caf434115ed6417b46f (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.sh | 17 |
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 | ||
4 | CTL=/tmp/openssh.regress.ctl-sock.$$ | 4 | CTL=/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" |
45 | fi | 46 | fi |
46 | 47 | ||
48 | fatal ok | ||
49 | |||
47 | verbose "test $tid: transfer" | 50 | verbose "test $tid: transfer" |
48 | rm -f ${COPY} | 51 | rm -f ${COPY} |
49 | trace "ssh transfer over multiplexed connection and check result" | 52 | 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 | |||
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 |
123 | wait $MASTER_PID | 126 | wait $SSH_PID |
124 | kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed" | 127 | kill -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 |
127 | verbose "test $tid: cmd stop" | 130 | verbose "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. |
139 | wait $SLEEP_PID | 142 | wait $SLEEP_PID |
140 | [ $! != 0 ] || fail "waiting for concurrent command" | 143 | [ $! != 0 ] || fail "waiting for concurrent command" |
141 | wait $MASTER_PID | 144 | wait $SSH_PID |
142 | [ $! != 0 ] || fail "waiting for master stop" | 145 | [ $! != 0 ] || fail "waiting for master stop" |
143 | kill -0 $MASTER_PID >/dev/null 2>&1 && fail "stop command failed" | 146 | kill -0 $SSH_PID >/dev/null 2>&1 && fatal "stop command failed" |
147 | SSH_PID="" # Already gone, so don't kill in cleanup | ||
148 | |||