diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-02-27 11:33:31 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-02-27 11:33:31 +0000 |
commit | 97a09659351cad20f3faa6ce4490163b4e042e85 (patch) | |
tree | 875ee20a2457147d611f48d3853a231477d493c9 /regress/usr.bin/ssh | |
parent | a9ae840fad55f48ca0d8a879158951871c3990ba (diff) |
Add optional capability to log output from regress commands; ok markus@
Use with: make TEST_SSH_LOGFILE=/tmp/regress.log
Diffstat (limited to 'regress/usr.bin/ssh')
-rw-r--r-- | regress/usr.bin/ssh/multiplex.sh | 7 | ||||
-rw-r--r-- | regress/usr.bin/ssh/sshd-log-wrapper.sh | 13 | ||||
-rw-r--r-- | regress/usr.bin/ssh/test-exec.sh | 18 |
3 files changed, 31 insertions, 7 deletions
diff --git a/regress/usr.bin/ssh/multiplex.sh b/regress/usr.bin/ssh/multiplex.sh index 54c881f6281..3982629fd18 100644 --- a/regress/usr.bin/ssh/multiplex.sh +++ b/regress/usr.bin/ssh/multiplex.sh @@ -1,4 +1,4 @@ -# $OpenBSD: multiplex.sh,v 1.9 2004/11/07 00:32:41 djm Exp $ +# $OpenBSD: multiplex.sh,v 1.10 2005/02/27 11:33:30 dtucker Exp $ # Placed in the Public Domain. CTL=$OBJ/ctl-sock @@ -7,6 +7,7 @@ tid="connection multiplexing" DATA=/bin/ls COPY=$OBJ/ls.copy +LOG=$TEST_SSH_LOGFILE start_sshd @@ -42,13 +43,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}" rm -f ${COPY} trace "sftp transfer over multiplexed connection and check result" echo "get ${DATA} ${COPY}" | \ - ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1 + ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1 test -f ${COPY} || fail "sftp: failed copy ${DATA}" cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" rm -f ${COPY} trace "scp transfer over multiplexed connection and check result" -${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1 +${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1 test -f ${COPY} || fail "scp: failed copy ${DATA}" cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" diff --git a/regress/usr.bin/ssh/sshd-log-wrapper.sh b/regress/usr.bin/ssh/sshd-log-wrapper.sh new file mode 100644 index 00000000000..a877609a6e2 --- /dev/null +++ b/regress/usr.bin/ssh/sshd-log-wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# $OpenBSD: sshd-log-wrapper.sh,v 1.1 2005/02/27 11:33:30 dtucker Exp $ +# Placed in the Public Domain. +# +# simple wrapper for sshd proxy mode to catch stderr output +# sh sshd-log-wrapper.sh /path/to/sshd /path/to/logfile + +sshd=$1 +log=$2 +shift +shift + +exec $sshd $@ -e 2>$log diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index 0aa45ce2c14..1202cee6636 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.26 2005/01/14 04:21:18 david Exp $ +# $OpenBSD: test-exec.sh,v 1.27 2005/02/27 11:33:30 dtucker Exp $ # Placed in the Public Domain. USER=`id -un` @@ -36,6 +36,8 @@ else fi unset SSH_AUTH_SOCK +SRC=`dirname ${SCRIPT}` + # defaults SSH=ssh SSHD=sshd @@ -80,6 +82,10 @@ if [ ! -x /$SSHD ]; then SSHD=`which sshd` fi +if [ "x$TEST_SSH_LOGFILE" = "x" ]; then + TEST_SSH_LOGFILE=/dev/null +fi + # these should be used in tests export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP @@ -103,6 +109,7 @@ cleanup () trace () { + echo "trace: $@" >>$TEST_SSH_LOGFILE if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then echo "$@" fi @@ -110,6 +117,7 @@ trace () verbose () { + echo "verbose: $@" >>$TEST_SSH_LOGFILE if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then echo "$@" fi @@ -118,12 +126,14 @@ verbose () fail () { + echo "FAIL: $@" >>$TEST_SSH_LOGFILE RESULT=1 echo "$@" } fatal () { + echo "FATAL: $@" >>$TEST_SSH_LOGFILE echo -n "FATAL: " fail "$@" cleanup @@ -142,7 +152,7 @@ cat << EOF > $OBJ/sshd_config #ListenAddress ::1 PidFile $PIDFILE AuthorizedKeysFile $OBJ/authorized_keys_%u - LogLevel QUIET + LogLevel DEBUG AcceptEnv _XXX_TEST_* AcceptEnv _XXX_TEST Subsystem sftp $SFTPSERVER @@ -214,7 +224,7 @@ chmod 644 $OBJ/authorized_keys_$USER # create a proxy version of the client config ( cat $OBJ/ssh_config - echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy + echo proxycommand sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy ) > $OBJ/ssh_proxy # check proxy config @@ -224,7 +234,7 @@ start_sshd () { # start sshd $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" - $SUDO ${SSHD} -f $OBJ/sshd_config + $SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1 trace "wait for sshd" i=0; |