summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-03-07 18:33:02 +1100
committerDarren Tucker <dtucker@zip.com.au>2005-03-07 18:33:02 +1100
commita0f3ba71a01428fb468ee7a6bc2fed42436c83f8 (patch)
tree0301a89585d250084f3481f00d887f057c936f09
parentb712fccc18b218e98bd6ef69c85308cd00a6e543 (diff)
- dtucker@cvs.openbsd.org 2005/02/27 11:33:30
[multiplex.sh test-exec.sh sshd-log-wrapper.sh] Add optional capability to log output from regress commands; ok markus@ Use with: make TEST_SSH_LOGFILE=/tmp/regress.log
-rw-r--r--ChangeLog6
-rw-r--r--regress/multiplex.sh7
-rw-r--r--regress/sshd-log-wrapper.sh13
-rw-r--r--regress/test-exec.sh18
4 files changed, 36 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d4f04909..1771d0da1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
8 - david@cvs.openbsd.org 2005/01/14 04:21:18 8 - david@cvs.openbsd.org 2005/01/14 04:21:18
9 [Makefile test-exec.sh] 9 [Makefile test-exec.sh]
10 pass the SUDO make variable to the individual sh tests; ok dtucker@ markus@ 10 pass the SUDO make variable to the individual sh tests; ok dtucker@ markus@
11 - dtucker@cvs.openbsd.org 2005/02/27 11:33:30
12 [multiplex.sh test-exec.sh sshd-log-wrapper.sh]
13 Add optional capability to log output from regress commands; ok markus@
14 Use with: make TEST_SSH_LOGFILE=/tmp/regress.log
11 15
1220050306 1620050306
13 - (dtucker) [monitor.c] Bug #125 comment #47: fix errors returned by monitor 17 - (dtucker) [monitor.c] Bug #125 comment #47: fix errors returned by monitor
@@ -2294,4 +2298,4 @@
2294 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 2298 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
2295 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 2299 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
2296 2300
2297$Id: ChangeLog,v 1.3697 2005/03/07 07:27:28 dtucker Exp $ 2301$Id: ChangeLog,v 1.3698 2005/03/07 07:33:02 dtucker Exp $
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 15e518c86..e8cc1ac53 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.9 2004/11/07 00:32:41 djm Exp $ 1# $OpenBSD: multiplex.sh,v 1.10 2005/02/27 11:33:30 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4CTL=$OBJ/ctl-sock 4CTL=$OBJ/ctl-sock
@@ -13,6 +13,7 @@ fi
13 13
14DATA=/bin/ls${EXEEXT} 14DATA=/bin/ls${EXEEXT}
15COPY=$OBJ/ls.copy 15COPY=$OBJ/ls.copy
16LOG=$TEST_SSH_LOGFILE
16 17
17start_sshd 18start_sshd
18 19
@@ -48,13 +49,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
48rm -f ${COPY} 49rm -f ${COPY}
49trace "sftp transfer over multiplexed connection and check result" 50trace "sftp transfer over multiplexed connection and check result"
50echo "get ${DATA} ${COPY}" | \ 51echo "get ${DATA} ${COPY}" | \
51 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1 52 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1
52test -f ${COPY} || fail "sftp: failed copy ${DATA}" 53test -f ${COPY} || fail "sftp: failed copy ${DATA}"
53cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" 54cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
54 55
55rm -f ${COPY} 56rm -f ${COPY}
56trace "scp transfer over multiplexed connection and check result" 57trace "scp transfer over multiplexed connection and check result"
57${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1 58${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1
58test -f ${COPY} || fail "scp: failed copy ${DATA}" 59test -f ${COPY} || fail "scp: failed copy ${DATA}"
59cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" 60cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
60 61
diff --git a/regress/sshd-log-wrapper.sh b/regress/sshd-log-wrapper.sh
new file mode 100644
index 000000000..c7a5ef3a6
--- /dev/null
+++ b/regress/sshd-log-wrapper.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2# $OpenBSD: sshd-log-wrapper.sh,v 1.2 2005/02/27 11:40:30 dtucker Exp $
3# Placed in the Public Domain.
4#
5# simple wrapper for sshd proxy mode to catch stderr output
6# sh sshd-log-wrapper.sh /path/to/sshd /path/to/logfile
7
8sshd=$1
9log=$2
10shift
11shift
12
13exec $sshd $@ -e 2>>$log
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 346b68f16..958c87109 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.26 2005/01/14 04:21:18 david Exp $ 1# $OpenBSD: test-exec.sh,v 1.27 2005/02/27 11:33:30 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -47,6 +47,8 @@ else
47fi 47fi
48unset SSH_AUTH_SOCK 48unset SSH_AUTH_SOCK
49 49
50SRC=`dirname ${SCRIPT}`
51
50# defaults 52# defaults
51SSH=ssh 53SSH=ssh
52SSHD=sshd 54SSHD=sshd
@@ -91,6 +93,10 @@ if [ ! -x /$SSHD ]; then
91 SSHD=`which sshd` 93 SSHD=`which sshd`
92fi 94fi
93 95
96if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
97 TEST_SSH_LOGFILE=/dev/null
98fi
99
94# these should be used in tests 100# these should be used in tests
95export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP 101export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
96#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP 102#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
@@ -140,6 +146,7 @@ cleanup ()
140 146
141trace () 147trace ()
142{ 148{
149 echo "trace: $@" >>$TEST_SSH_LOGFILE
143 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then 150 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
144 echo "$@" 151 echo "$@"
145 fi 152 fi
@@ -147,6 +154,7 @@ trace ()
147 154
148verbose () 155verbose ()
149{ 156{
157 echo "verbose: $@" >>$TEST_SSH_LOGFILE
150 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then 158 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
151 echo "$@" 159 echo "$@"
152 fi 160 fi
@@ -155,12 +163,14 @@ verbose ()
155 163
156fail () 164fail ()
157{ 165{
166 echo "FAIL: $@" >>$TEST_SSH_LOGFILE
158 RESULT=1 167 RESULT=1
159 echo "$@" 168 echo "$@"
160} 169}
161 170
162fatal () 171fatal ()
163{ 172{
173 echo "FATAL: $@" >>$TEST_SSH_LOGFILE
164 echon "FATAL: " 174 echon "FATAL: "
165 fail "$@" 175 fail "$@"
166 cleanup 176 cleanup
@@ -180,7 +190,7 @@ cat << EOF > $OBJ/sshd_config
180 #ListenAddress ::1 190 #ListenAddress ::1
181 PidFile $PIDFILE 191 PidFile $PIDFILE
182 AuthorizedKeysFile $OBJ/authorized_keys_%u 192 AuthorizedKeysFile $OBJ/authorized_keys_%u
183 LogLevel QUIET 193 LogLevel DEBUG
184 AcceptEnv _XXX_TEST_* 194 AcceptEnv _XXX_TEST_*
185 AcceptEnv _XXX_TEST 195 AcceptEnv _XXX_TEST
186 Subsystem sftp $SFTPSERVER 196 Subsystem sftp $SFTPSERVER
@@ -251,7 +261,7 @@ chmod 644 $OBJ/authorized_keys_$USER
251# create a proxy version of the client config 261# create a proxy version of the client config
252( 262(
253 cat $OBJ/ssh_config 263 cat $OBJ/ssh_config
254 echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy 264 echo proxycommand sh ${SRC}/sshd-log-wrapper.sh ${SUDO} ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy
255) > $OBJ/ssh_proxy 265) > $OBJ/ssh_proxy
256 266
257# check proxy config 267# check proxy config
@@ -261,7 +271,7 @@ start_sshd ()
261{ 271{
262 # start sshd 272 # start sshd
263 $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" 273 $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken"
264 $SUDO ${SSHD} -f $OBJ/sshd_config 274 $SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1
265 275
266 trace "wait for sshd" 276 trace "wait for sshd"
267 i=0; 277 i=0;