summaryrefslogtreecommitdiff
path: root/regress/multiplex.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r--regress/multiplex.sh55
1 files changed, 39 insertions, 16 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 1e6cc7606..3e697e691 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.17 2012/10/05 02:05:30 dtucker Exp $ 1# $OpenBSD: multiplex.sh,v 1.21 2013/05/17 04:29:14 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.$$
@@ -10,8 +10,7 @@ if config_defined DISABLE_FD_PASSING ; then
10 exit 0 10 exit 0
11fi 11fi
12 12
13DATA=/bin/ls${EXEEXT} 13P=3301 # test port
14COPY=$OBJ/ls.copy
15 14
16wait_for_mux_master_ready() 15wait_for_mux_master_ready()
17{ 16{
@@ -25,10 +24,16 @@ wait_for_mux_master_ready()
25 24
26start_sshd 25start_sshd
27 26
28trace "start master, fork to background" 27start_mux_master()
29${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & 28{
30MASTER_PID=$! 29 trace "start master, fork to background"
31wait_for_mux_master_ready 30 ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \
31 -E $TEST_REGRESS_LOGFILE 2>&1 &
32 MASTER_PID=$!
33 wait_for_mux_master_ready
34}
35
36start_mux_master
32 37
33verbose "test $tid: envpass" 38verbose "test $tid: envpass"
34trace "env passing over multiplexed connection" 39trace "env passing over multiplexed connection"
@@ -55,13 +60,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
55rm -f ${COPY} 60rm -f ${COPY}
56trace "sftp transfer over multiplexed connection and check result" 61trace "sftp transfer over multiplexed connection and check result"
57echo "get ${DATA} ${COPY}" | \ 62echo "get ${DATA} ${COPY}" | \
58 ${SFTP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost >>$TEST_SSH_LOGFILE 2>&1 63 ${SFTP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost >>$TEST_REGRESS_LOGFILE 2>&1
59test -f ${COPY} || fail "sftp: failed copy ${DATA}" 64test -f ${COPY} || fail "sftp: failed copy ${DATA}"
60cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" 65cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
61 66
62rm -f ${COPY} 67rm -f ${COPY}
63trace "scp transfer over multiplexed connection and check result" 68trace "scp transfer over multiplexed connection and check result"
64${SCP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost:${DATA} ${COPY} >>$TEST_SSH_LOGFILE 2>&1 69${SCP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost:${DATA} ${COPY} >>$TEST_REGRESS_LOGFILE 2>&1
65test -f ${COPY} || fail "scp: failed copy ${DATA}" 70test -f ${COPY} || fail "scp: failed copy ${DATA}"
66cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" 71cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
67 72
@@ -87,11 +92,31 @@ for s in 0 1 4 5 44; do
87done 92done
88 93
89verbose "test $tid: cmd check" 94verbose "test $tid: cmd check"
90${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 95${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
91 || fail "check command failed" 96 || fail "check command failed"
92 97
98verbose "test $tid: cmd forward local"
99${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $P:localhost:$PORT otherhost \
100 || fail "request local forward failed"
101${SSH} -F $OBJ/ssh_config -p$P otherhost true \
102 || fail "connect to local forward port failed"
103${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $P:localhost:$PORT otherhost \
104 || fail "cancel local forward failed"
105${SSH} -F $OBJ/ssh_config -p$P otherhost true \
106 && fail "local forward port still listening"
107
108verbose "test $tid: cmd forward remote"
109${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $P:localhost:$PORT otherhost \
110 || fail "request remote forward failed"
111${SSH} -F $OBJ/ssh_config -p$P otherhost true \
112 || fail "connect to remote forwarded port failed"
113${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $P:localhost:$PORT otherhost \
114 || fail "cancel remote forward failed"
115${SSH} -F $OBJ/ssh_config -p$P otherhost true \
116 && fail "remote forward port still listening"
117
93verbose "test $tid: cmd exit" 118verbose "test $tid: cmd exit"
94${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 119${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
95 || fail "send exit command failed" 120 || fail "send exit command failed"
96 121
97# Wait for master to exit 122# Wait for master to exit
@@ -101,15 +126,13 @@ kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed"
101# Restart master and test -O stop command with master using -N 126# Restart master and test -O stop command with master using -N
102verbose "test $tid: cmd stop" 127verbose "test $tid: cmd stop"
103trace "restart master, fork to background" 128trace "restart master, fork to background"
104${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & 129start_mux_master
105MASTER_PID=$!
106wait_for_mux_master_ready
107 130
108# start a long-running command then immediately request a stop 131# start a long-running command then immediately request a stop
109${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \ 132${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \
110 >>$TEST_SSH_LOGFILE 2>&1 & 133 >>$TEST_REGRESS_LOGFILE 2>&1 &
111SLEEP_PID=$! 134SLEEP_PID=$!
112${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 135${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
113 || fail "send stop command failed" 136 || fail "send stop command failed"
114 137
115# wait until both long-running command and master have exited. 138# wait until both long-running command and master have exited.