diff options
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r-- | regress/multiplex.sh | 55 |
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 | ||
4 | CTL=/tmp/openssh.regress.ctl-sock.$$ | 4 | CTL=/tmp/openssh.regress.ctl-sock.$$ |
@@ -10,8 +10,7 @@ if config_defined DISABLE_FD_PASSING ; then | |||
10 | exit 0 | 10 | exit 0 |
11 | fi | 11 | fi |
12 | 12 | ||
13 | DATA=/bin/ls${EXEEXT} | 13 | P=3301 # test port |
14 | COPY=$OBJ/ls.copy | ||
15 | 14 | ||
16 | wait_for_mux_master_ready() | 15 | wait_for_mux_master_ready() |
17 | { | 16 | { |
@@ -25,10 +24,16 @@ wait_for_mux_master_ready() | |||
25 | 24 | ||
26 | start_sshd | 25 | start_sshd |
27 | 26 | ||
28 | trace "start master, fork to background" | 27 | start_mux_master() |
29 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & | 28 | { |
30 | MASTER_PID=$! | 29 | trace "start master, fork to background" |
31 | wait_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 | |||
36 | start_mux_master | ||
32 | 37 | ||
33 | verbose "test $tid: envpass" | 38 | verbose "test $tid: envpass" |
34 | trace "env passing over multiplexed connection" | 39 | trace "env passing over multiplexed connection" |
@@ -55,13 +60,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}" | |||
55 | rm -f ${COPY} | 60 | rm -f ${COPY} |
56 | trace "sftp transfer over multiplexed connection and check result" | 61 | trace "sftp transfer over multiplexed connection and check result" |
57 | echo "get ${DATA} ${COPY}" | \ | 62 | echo "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 |
59 | test -f ${COPY} || fail "sftp: failed copy ${DATA}" | 64 | test -f ${COPY} || fail "sftp: failed copy ${DATA}" |
60 | cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" | 65 | cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" |
61 | 66 | ||
62 | rm -f ${COPY} | 67 | rm -f ${COPY} |
63 | trace "scp transfer over multiplexed connection and check result" | 68 | trace "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 |
65 | test -f ${COPY} || fail "scp: failed copy ${DATA}" | 70 | test -f ${COPY} || fail "scp: failed copy ${DATA}" |
66 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" | 71 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" |
67 | 72 | ||
@@ -87,11 +92,31 @@ for s in 0 1 4 5 44; do | |||
87 | done | 92 | done |
88 | 93 | ||
89 | verbose "test $tid: cmd check" | 94 | verbose "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 | ||
98 | verbose "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 | |||
108 | verbose "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 | |||
93 | verbose "test $tid: cmd exit" | 118 | verbose "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 |
102 | verbose "test $tid: cmd stop" | 127 | verbose "test $tid: cmd stop" |
103 | trace "restart master, fork to background" | 128 | trace "restart master, fork to background" |
104 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & | 129 | start_mux_master |
105 | MASTER_PID=$! | ||
106 | wait_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 & |
111 | SLEEP_PID=$! | 134 | SLEEP_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. |