summaryrefslogtreecommitdiff
path: root/regress/multiplex.sh
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-05-07 10:06:42 +0100
committerColin Watson <cjwatson@debian.org>2013-05-07 10:06:42 +0100
commitecebda56da46a03dafff923d91c382f31faa9eec (patch)
tree449614b6c06a2622c74a609b31fcc46c60037c56 /regress/multiplex.sh
parentc6a2c0334e45419875687d250aed9bea78480f2e (diff)
parentffc06452028ba78cd693d4ed43df8b60a10d6163 (diff)
merge 6.2p1; reorder additions to monitor.h for easier merging in future
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r--regress/multiplex.sh50
1 files changed, 40 insertions, 10 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 93e15088f..1e6cc7606 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.13 2012/06/01 00:47:36 djm Exp $ 1# $OpenBSD: multiplex.sh,v 1.17 2012/10/05 02:05:30 dtucker 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.$$
@@ -13,14 +13,22 @@ fi
13DATA=/bin/ls${EXEEXT} 13DATA=/bin/ls${EXEEXT}
14COPY=$OBJ/ls.copy 14COPY=$OBJ/ls.copy
15 15
16wait_for_mux_master_ready()
17{
18 for i in 1 2 3 4 5; do
19 ${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost \
20 >/dev/null 2>&1 && return 0
21 sleep $i
22 done
23 fatal "mux master never becomes ready"
24}
25
16start_sshd 26start_sshd
17 27
18trace "start master, fork to background" 28trace "start master, fork to background"
19${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & 29${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost &
20MASTER_PID=$! 30MASTER_PID=$!
21 31wait_for_mux_master_ready
22# Wait for master to start and authenticate
23sleep 5
24 32
25verbose "test $tid: envpass" 33verbose "test $tid: envpass"
26trace "env passing over multiplexed connection" 34trace "env passing over multiplexed connection"
@@ -78,13 +86,35 @@ for s in 0 1 4 5 44; do
78 fi 86 fi
79done 87done
80 88
81trace "test check command" 89verbose "test $tid: cmd check"
82${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost || fail "check command failed" 90${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_SSH_LOGFILE 2>&1 \
91 || fail "check command failed"
83 92
84trace "test exit command" 93verbose "test $tid: cmd exit"
85${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost || fail "send exit command failed" 94${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_SSH_LOGFILE 2>&1 \
95 || fail "send exit command failed"
86 96
87# Wait for master to exit 97# Wait for master to exit
88sleep 2 98wait $MASTER_PID
99kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed"
89 100
90kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed" 101# Restart master and test -O stop command with master using -N
102verbose "test $tid: cmd stop"
103trace "restart master, fork to background"
104${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost &
105MASTER_PID=$!
106wait_for_mux_master_ready
107
108# start a long-running command then immediately request a stop
109${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \
110 >>$TEST_SSH_LOGFILE 2>&1 &
111SLEEP_PID=$!
112${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \
113 || fail "send stop command failed"
114
115# wait until both long-running command and master have exited.
116wait $SLEEP_PID
117[ $! != 0 ] || fail "waiting for concurrent command"
118wait $MASTER_PID
119[ $! != 0 ] || fail "waiting for master stop"
120kill -0 $MASTER_PID >/dev/null 2>&1 && fail "stop command failed"