]> andersk Git - openssh.git/blame - regress/multiplex.sh
- dtucker@cvs.openbsd.org 2004/06/17 05:51:59
[openssh.git] / regress / multiplex.sh
CommitLineData
58766d34 1# $OpenBSD: multiplex.sh,v 1.3 2004/06/17 05:51:59 dtucker Exp $
00995aa0 2# Placed in the Public Domain.
3
4CTL=$OBJ/ctl-sock
5
6tid="connection multiplexing"
7
8start_sshd
9
10trace "start master, fork to background"
11${SSH} -2 -MS$CTL -F $OBJ/ssh_config -f somehost sleep 60
12
58766d34 13rm -f $OBJ/ls.copy
00995aa0 14trace "ssh transfer over multiplexed connection and check result"
15${SSH} -S$CTL otherhost cat /bin/ls > $OBJ/ls.copy
16test -f $OBJ/ls.copy || fail "failed copy /bin/ls"
17cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
18
58766d34 19rm -f $OBJ/ls.copy
00995aa0 20trace "ssh transfer over multiplexed connection and check result"
21${SSH} -S $CTL otherhost cat /bin/ls > $OBJ/ls.copy
22test -f $OBJ/ls.copy || fail "failed copy /bin/ls"
23cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
24
25rm -f $OBJ/ls.copy
26trace "sftp transfer over multiplexed connection and check result"
27echo "get /bin/ls $OBJ/ls.copy" | \
6d3d1404 28 ${SFTP} -oControlPath=$CTL otherhost >/dev/null 2>&1
00995aa0 29test -f $OBJ/ls.copy || fail "failed copy /bin/ls"
30cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
31
32rm -f $OBJ/ls.copy
33trace "scp transfer over multiplexed connection and check result"
6d3d1404 34${SCP} -oControlPath=$CTL otherhost:/bin/ls $OBJ/ls.copy >/dev/null 2>&1
00995aa0 35test -f $OBJ/ls.copy || fail "failed copy /bin/ls"
36cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
37
58766d34 38rm -f $OBJ/ls.copy
39
00995aa0 40for 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
57done
58
58766d34 59# kill master, remove control socket. ssh -MS will exit when sleep exits
60$SUDO kill `cat $PIDFILE`
61rm -f $CTL
This page took 0.058186 seconds and 5 git commands to generate.