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