]> andersk Git - openssh.git/blame - regress/multiplex.sh
- (dtucker) [regress/README.regress] Document new variables.
[openssh.git] / regress / multiplex.sh
CommitLineData
cb19b709 1# $OpenBSD: multiplex.sh,v 1.8 2004/06/22 03:12:13 markus Exp $
00995aa0 2# Placed in the Public Domain.
3
4CTL=$OBJ/ctl-sock
5
6tid="connection multiplexing"
7
b066fabe 8DATA=/bin/ls${EXEEXT}
00e612c7 9COPY=$OBJ/ls.copy
10
00995aa0 11start_sshd
12
13trace "start master, fork to background"
cb19b709 14${SSH} -2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" -f somehost sleep 120
00995aa0 15
b9a59b74 16verbose "test $tid: envpass"
17trace "env passing over multiplexed connection"
cb19b709 18_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -S$CTL otherhost sh << 'EOF'
19 test X"$_XXX_TEST" = X"blah"
20EOF
b9a59b74 21if [ $? -ne 0 ]; then
22 fail "environment not found"
23fi
24
25verbose "test $tid: transfer"
00e612c7 26rm -f ${COPY}
00995aa0 27trace "ssh transfer over multiplexed connection and check result"
00e612c7 28${SSH} -S$CTL otherhost cat ${DATA} > ${COPY}
c031f95b 29test -f ${COPY} || fail "ssh -Sctl: failed copy ${DATA}"
30cmp ${DATA} ${COPY} || fail "ssh -Sctl: corrupted copy of ${DATA}"
00995aa0 31
00e612c7 32rm -f ${COPY}
00995aa0 33trace "ssh transfer over multiplexed connection and check result"
00e612c7 34${SSH} -S $CTL otherhost cat ${DATA} > ${COPY}
c031f95b 35test -f ${COPY} || fail "ssh -S ctl: failed copy ${DATA}"
36cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
00995aa0 37
00e612c7 38rm -f ${COPY}
00995aa0 39trace "sftp transfer over multiplexed connection and check result"
00e612c7 40echo "get ${DATA} ${COPY}" | \
1980d5c9 41 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1
c031f95b 42test -f ${COPY} || fail "sftp: failed copy ${DATA}"
43cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
00995aa0 44
00e612c7 45rm -f ${COPY}
00995aa0 46trace "scp transfer over multiplexed connection and check result"
1980d5c9 47${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1
c031f95b 48test -f ${COPY} || fail "scp: failed copy ${DATA}"
49cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
00995aa0 50
00e612c7 51rm -f ${COPY}
58766d34 52
00995aa0 53for s in 0 1 4 5 44; do
54 trace "exit status $s over multiplexed connection"
55 verbose "test $tid: status $s"
56 ${SSH} -S $CTL otherhost exit $s
57 r=$?
58 if [ $r -ne $s ]; then
59 fail "exit code mismatch for protocol $p: $r != $s"
60 fi
61
62 # same with early close of stdout/err
63 trace "exit status $s with early close over multiplexed connection"
64 ${SSH} -S $CTL -n otherhost \
65 exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\'
66 r=$?
67 if [ $r -ne $s ]; then
68 fail "exit code (with sleep) mismatch for protocol $p: $r != $s"
69 fi
70done
71
58766d34 72# kill master, remove control socket. ssh -MS will exit when sleep exits
73$SUDO kill `cat $PIDFILE`
74rm -f $CTL
This page took 0.584987 seconds and 5 git commands to generate.