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