diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/Makefile | 5 | ||||
-rw-r--r-- | regress/multiplex.sh | 55 | ||||
-rw-r--r-- | regress/test-exec.sh | 7 |
3 files changed, 64 insertions, 3 deletions
diff --git a/regress/Makefile b/regress/Makefile index 8f15f3b4d..64674521b 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.29 2004/06/13 13:51:02 dtucker Exp $ | 1 | # $OpenBSD: Makefile,v 1.30 2004/06/13 15:04:08 djm Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
@@ -36,7 +36,8 @@ LTESTS= connect \ | |||
36 | sftp-batch \ | 36 | sftp-batch \ |
37 | reconfigure \ | 37 | reconfigure \ |
38 | dynamic-forward \ | 38 | dynamic-forward \ |
39 | forwarding | 39 | forwarding \ |
40 | multiplex | ||
40 | 41 | ||
41 | USER!= id -un | 42 | USER!= id -un |
42 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | 43 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ |
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 | ||
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index c8827b631..1f7e38d6a 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.17 2004/06/13 13:51:02 dtucker Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.18 2004/06/13 15:04:08 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | PORT=4242 | 4 | PORT=4242 |
@@ -41,6 +41,7 @@ unset SSH_AUTH_SOCK | |||
41 | # defaults | 41 | # defaults |
42 | SSH=ssh | 42 | SSH=ssh |
43 | SSHD=sshd | 43 | SSHD=sshd |
44 | SCP=scp | ||
44 | SSHAGENT=ssh-agent | 45 | SSHAGENT=ssh-agent |
45 | SSHADD=ssh-add | 46 | SSHADD=ssh-add |
46 | SSHKEYGEN=ssh-keygen | 47 | SSHKEYGEN=ssh-keygen |
@@ -55,6 +56,9 @@ fi | |||
55 | if [ "x$TEST_SSH_SSHD" != "x" ]; then | 56 | if [ "x$TEST_SSH_SSHD" != "x" ]; then |
56 | SSHD="${TEST_SSH_SSHD}" | 57 | SSHD="${TEST_SSH_SSHD}" |
57 | fi | 58 | fi |
59 | if [ "x$TEST_SSH_SCP" != "x" ]; then | ||
60 | SCP="${TEST_SSH_SCP}" | ||
61 | fi | ||
58 | if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then | 62 | if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then |
59 | SSHAGENT="${TEST_SSH_SSHAGENT}" | 63 | SSHAGENT="${TEST_SSH_SSHAGENT}" |
60 | fi | 64 | fi |
@@ -168,6 +172,7 @@ cat << EOF > $OBJ/sshd_config | |||
168 | LogLevel QUIET | 172 | LogLevel QUIET |
169 | AcceptEnv _XXX_TEST_* | 173 | AcceptEnv _XXX_TEST_* |
170 | AcceptEnv _XXX_TEST | 174 | AcceptEnv _XXX_TEST |
175 | Subsystem sftp $SFTPSERVER | ||
171 | StrictModes no | 176 | StrictModes no |
172 | EOF | 177 | EOF |
173 | 178 | ||