diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-06-16 20:22:22 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-06-16 20:22:22 +1000 |
commit | e7d0583f36d060d199c44cbd16b367b0b9907333 (patch) | |
tree | 04070c413e33cb7ae0e555dcb4995943c44866bb /regress/multiplex.sh | |
parent | 50433a924344b295cd34ecdbba0c6b8f6add9231 (diff) |
- djm@cvs.openbsd.org 2004/06/13 15:04:08
[regress/Makefile regress/test-exec.sh, added regress/multiplex.sh]
regress test for client multiplexing; ok markus@
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r-- | regress/multiplex.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh new file mode 100644 index 000000000..70a4e677f --- /dev/null +++ b/regress/multiplex.sh | |||
@@ -0,0 +1,55 @@ | |||
1 | # $OpenBSD: multiplex.sh,v 1.1 2004/06/13 15:04:08 djm 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 | trace "ssh transfer over multiplexed connection and check result" | ||
14 | ${SSH} -S$CTL otherhost cat /bin/ls > $OBJ/ls.copy | ||
15 | test -f $OBJ/ls.copy || fail "failed copy /bin/ls" | ||
16 | cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" | ||
17 | |||
18 | trace "ssh transfer over multiplexed connection and check result" | ||
19 | ${SSH} -S $CTL otherhost cat /bin/ls > $OBJ/ls.copy | ||
20 | test -f $OBJ/ls.copy || fail "failed copy /bin/ls" | ||
21 | cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" | ||
22 | |||
23 | rm -f $OBJ/ls.copy | ||
24 | trace "sftp transfer over multiplexed connection and check result" | ||
25 | echo "get /bin/ls $OBJ/ls.copy" | \ | ||
26 | ${SFTP} -oControlPath=$CTL otherhost | ||
27 | test -f $OBJ/ls.copy || fail "failed copy /bin/ls" | ||
28 | cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" | ||
29 | |||
30 | rm -f $OBJ/ls.copy | ||
31 | trace "scp transfer over multiplexed connection and check result" | ||
32 | ${SCP} -oControlPath=$CTL otherhost:/bin/ls $OBJ/ls.copy | ||
33 | test -f $OBJ/ls.copy || fail "failed copy /bin/ls" | ||
34 | cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" | ||
35 | |||
36 | for s in 0 1 4 5 44; do | ||
37 | trace "exit status $s over multiplexed connection" | ||
38 | verbose "test $tid: status $s" | ||
39 | ${SSH} -S $CTL otherhost exit $s | ||
40 | r=$? | ||
41 | if [ $r -ne $s ]; then | ||
42 | fail "exit code mismatch for protocol $p: $r != $s" | ||
43 | fi | ||
44 | |||
45 | # same with early close of stdout/err | ||
46 | trace "exit status $s with early close over multiplexed connection" | ||
47 | ${SSH} -S $CTL -n otherhost \ | ||
48 | exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\' | ||
49 | r=$? | ||
50 | if [ $r -ne $s ]; then | ||
51 | fail "exit code (with sleep) mismatch for protocol $p: $r != $s" | ||
52 | fi | ||
53 | done | ||
54 | |||
55 | sleep 30 # early close test sleeps 5 seconds per test | ||