diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | regress/multiplex.sh | 17 | ||||
-rw-r--r-- | regress/test-exec.sh | 11 |
3 files changed, 26 insertions, 8 deletions
@@ -12,6 +12,12 @@ | |||
12 | [key.c] | 12 | [key.c] |
13 | downgrade more error() to debug() to better match what old authfile.c | 13 | downgrade more error() to debug() to better match what old authfile.c |
14 | did; suppresses spurious errors with hostbased authentication enabled | 14 | did; suppresses spurious errors with hostbased authentication enabled |
15 | - djm@cvs.openbsd.org 2014/07/06 07:42:03 | ||
16 | [multiplex.sh test-exec.sh] | ||
17 | add a hook to the cleanup() function to kill $SSH_PID if it is set | ||
18 | |||
19 | use it to kill the mux master started in multiplex.sh (it was being left | ||
20 | around on fatal failures) | ||
15 | 21 | ||
16 | 20140706 | 22 | 20140706 |
17 | - OpenBSD CVS Sync | 23 | - OpenBSD CVS Sync |
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 | |||
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index aac8aa5c2..a1bab832f 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.47 2013/11/09 05:41:34 dtucker Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.48 2014/07/06 07:42:03 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -240,13 +240,20 @@ md5 () { | |||
240 | # helper | 240 | # helper |
241 | cleanup () | 241 | cleanup () |
242 | { | 242 | { |
243 | if [ "x$SSH_PID" != "x" ]; then | ||
244 | if [ $SSH_PID -lt 2 ]; then | ||
245 | echo bad pid for ssh: $SSH_PID | ||
246 | else | ||
247 | kill $SSH_PID | ||
248 | fi | ||
249 | fi | ||
243 | if [ -f $PIDFILE ]; then | 250 | if [ -f $PIDFILE ]; then |
244 | pid=`$SUDO cat $PIDFILE` | 251 | pid=`$SUDO cat $PIDFILE` |
245 | if [ "X$pid" = "X" ]; then | 252 | if [ "X$pid" = "X" ]; then |
246 | echo no sshd running | 253 | echo no sshd running |
247 | else | 254 | else |
248 | if [ $pid -lt 2 ]; then | 255 | if [ $pid -lt 2 ]; then |
249 | echo bad pid for ssh: $pid | 256 | echo bad pid for sshd: $pid |
250 | else | 257 | else |
251 | $SUDO kill $pid | 258 | $SUDO kill $pid |
252 | trace "wait for sshd to exit" | 259 | trace "wait for sshd to exit" |