]> andersk Git - openssh.git/blob - regress/multiplex.sh
- dtucker@cvs.openbsd.org 2004/06/17 06:19:06
[openssh.git] / regress / multiplex.sh
1 #       $OpenBSD: multiplex.sh,v 1.5 2004/06/17 06:19:06 dtucker Exp $
2 #       Placed in the Public Domain.
3
4 CTL=$OBJ/ctl-sock
5
6 tid="connection multiplexing"
7
8 DATA=/bin/ls
9 COPY=$OBJ/ls.copy
10
11 start_sshd
12
13 trace "start master, fork to background"
14 ${SSH} -2 -MS$CTL -F $OBJ/ssh_config -f somehost sleep 60
15
16 rm -f ${COPY}
17 trace "ssh transfer over multiplexed connection and check result"
18 ${SSH} -S$CTL otherhost cat ${DATA} > ${COPY}
19 test -f ${COPY}                 || fail "ssh -Sctl: failed copy ${DATA}" 
20 cmp ${DATA} ${COPY}             || fail "ssh -Sctl: corrupted copy of ${DATA}"
21
22 rm -f ${COPY}
23 trace "ssh transfer over multiplexed connection and check result"
24 ${SSH} -S $CTL otherhost cat ${DATA} > ${COPY}
25 test -f ${COPY}                 || fail "ssh -S ctl: failed copy ${DATA}" 
26 cmp ${DATA} ${COPY}             || fail "ssh -S ctl: corrupted copy of ${DATA}"
27
28 rm -f ${COPY}
29 trace "sftp transfer over multiplexed connection and check result"
30 echo "get ${DATA} ${COPY}" | \
31         ${SFTP} -oControlPath=$CTL otherhost >/dev/null 2>&1
32 test -f ${COPY}                 || fail "sftp: failed copy ${DATA}" 
33 cmp ${DATA} ${COPY}             || fail "sftp: corrupted copy of ${DATA}"
34
35 rm -f ${COPY}
36 trace "scp transfer over multiplexed connection and check result"
37 ${SCP} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1
38 test -f ${COPY}                 || fail "scp: failed copy ${DATA}" 
39 cmp ${DATA} ${COPY}             || fail "scp: corrupted copy of ${DATA}"
40
41 rm -f ${COPY}
42
43 for s in 0 1 4 5 44; do
44         trace "exit status $s over multiplexed connection"
45         verbose "test $tid: status $s"
46         ${SSH} -S $CTL otherhost exit $s
47         r=$?
48         if [ $r -ne $s ]; then
49                 fail "exit code mismatch for protocol $p: $r != $s"
50         fi
51
52         # same with early close of stdout/err
53         trace "exit status $s with early close over multiplexed connection"
54         ${SSH} -S $CTL -n otherhost \
55                 exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\'
56         r=$?
57         if [ $r -ne $s ]; then
58                 fail "exit code (with sleep) mismatch for protocol $p: $r != $s"
59         fi
60 done
61
62 # kill master, remove control socket.  ssh -MS will exit when sleep exits
63 $SUDO kill `cat $PIDFILE`
64 rm -f $CTL
This page took 0.073976 seconds and 5 git commands to generate.