diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-03-23 16:38:10 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-03-23 16:38:10 +0000 |
commit | 8e16712145eb716d9b20ce95a50c3b3f4ce5d1d7 (patch) | |
tree | c6ed83de345910e67addd8b05e03a311bd42d251 /regress/usr.bin/ssh | |
parent | 39c2b426ca1140c454021b6a636cafc0b080ad2b (diff) |
some tests for stderr handling
Diffstat (limited to 'regress/usr.bin/ssh')
-rw-r--r-- | regress/usr.bin/ssh/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/stderr-after-eof.sh | 28 | ||||
-rw-r--r-- | regress/usr.bin/ssh/stderr-data.sh | 33 | ||||
-rw-r--r-- | regress/usr.bin/ssh/test-exec.sh | 4 |
4 files changed, 67 insertions, 2 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index b3ac6fb45f1..7aa106875a4 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2002/03/21 22:27:00 markus Exp $ +# $OpenBSD: Makefile,v 1.9 2002/03/23 16:38:08 markus Exp $ REGRESSTARGETS= t1 t2 t3 t4 t5 t6 t7 @@ -10,6 +10,8 @@ LTESTS= connect \ proto-version \ proto-mismatch \ exit-status \ + stderr-data \ + stderr-after-eof \ broken-pipe \ try-ciphers \ yes-head \ diff --git a/regress/usr.bin/ssh/stderr-after-eof.sh b/regress/usr.bin/ssh/stderr-after-eof.sh new file mode 100644 index 00000000000..cd1e66d571b --- /dev/null +++ b/regress/usr.bin/ssh/stderr-after-eof.sh @@ -0,0 +1,28 @@ +# $OpenBSD: stderr-after-eof.sh,v 1.1 2002/03/23 16:38:09 markus Exp $ +# Placed in the Public Domain. + +tid="stderr data after eof" + +DATA=/etc/motd +DATA=${OBJ}/data +COPY=${OBJ}/copy + +# setup data +rm -f ${DATA} ${COPY} +cp /dev/null ${DATA} +for i in 1 2 3 4 5 6; do + (date;echo $i) | md5 >> ${DATA} +done + +${SSH} -2 -F $OBJ/ssh_proxy otherhost \ + exec sh -c \'"exec > /dev/null; sleep 2; cat ${DATA} 1>&2 $s"\' \ + 2> ${COPY} +r=$? +if [ $r -ne 0 ]; then + fail "ssh failed with exit code $r" +fi +egrep 'Disconnecting: Received extended_data after EOF' ${COPY} && + fail "ext data received after eof" +cmp ${DATA} ${COPY} || fail "stderr corrupt" + +rm -f ${DATA} ${COPY} diff --git a/regress/usr.bin/ssh/stderr-data.sh b/regress/usr.bin/ssh/stderr-data.sh new file mode 100644 index 00000000000..4c46c3a1c66 --- /dev/null +++ b/regress/usr.bin/ssh/stderr-data.sh @@ -0,0 +1,33 @@ +# $OpenBSD: stderr-data.sh,v 1.1 2002/03/23 16:38:09 markus Exp $ +# Placed in the Public Domain. + +tid="stderr data transfer" + +DATA=/bin/ls +COPY=${OBJ}/copy +rm -f ${COPY} + +for n in '' -n; do +for p in 1 2; do + verbose "test $tid: proto $p ($n)" + ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \ + exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \ + 2> ${COPY} + r=$? + if [ $r -ne 0 ]; then + fail "ssh failed with exit code $r" + fi + cmp ${DATA} ${COPY} || fail "stderr corrupt" + rm -f ${COPY} + + ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \ + exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \ + >- 2> ${COPY} + r=$? + if [ $r -ne 0 ]; then + fail "ssh failed with exit code $r" + fi + cmp ${DATA} ${COPY} || fail "stderr corrupt" + rm -f ${COPY} +done +done diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index d7194fd075c..a740b261929 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.11 2002/03/21 22:27:00 markus Exp $ +# $OpenBSD: test-exec.sh,v 1.12 2002/03/23 16:38:09 markus Exp $ # Placed in the Public Domain. PORT=4242 @@ -158,6 +158,8 @@ Host * StrictHostKeyChecking yes EOF +rm -f $OBJ/known_hosts + trace "generate keys" for t in rsa rsa1; do # generate user key |