summaryrefslogtreecommitdiff
path: root/regress/test-exec.sh
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2015-02-25 16:58:22 -0800
committerDamien Miller <djm@mindrot.org>2015-02-26 14:55:55 -0800
commitbd58853102cee739f0e115e6d4b5334332ab1442 (patch)
treec214663c1fa4b28cc687faba24183f36085a3141 /regress/test-exec.sh
parentf43d17269194761eded9e89f17456332f4c83824 (diff)
valgrind support
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r--regress/test-exec.sh59
1 files changed, 54 insertions, 5 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index a1bab832f..ff0768a04 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -141,6 +141,55 @@ case "$SSHAGENT" in
141*) SSHAGENT=`which $SSHAGENT` ;; 141*) SSHAGENT=`which $SSHAGENT` ;;
142esac 142esac
143 143
144# Record the actual binaries used.
145SSH_BIN=${SSH}
146SSHD_BIN=${SSHD}
147SSHAGENT_BIN=${SSHAGENT}
148SSHADD_BIN=${SSHADD}
149SSHKEYGEN_BIN=${SSHKEYGEN}
150SSHKEYSCAN_BIN=${SSHKEYSCAN}
151SFTP_BIN=${SFTP}
152SFTPSERVER_BIN=${SFTPSERVER}
153SCP_BIN=${SCP}
154
155if [ "x$USE_VALGRIND" != "x" ]; then
156 mkdir -p $OBJ/valgrind-out
157 VG_TEST=`basename $SCRIPT .sh`
158
159 # Some tests are difficult to fix.
160 case "$VG_TEST" in
161 connect-privsep|reexec)
162 VG_SKIP=1 ;;
163 esac
164
165 if [ x"$VG_SKIP" = "x" ]; then
166 VG_IGNORE="/bin/*,/sbin/*,/usr/*,/var/*"
167 VG_LOG="$OBJ/valgrind-out/${VG_TEST}."
168 VG_OPTS="--track-origins=yes --leak-check=full"
169 VG_OPTS="$VG_OPTS --trace-children=yes"
170 VG_OPTS="$VG_OPTS --trace-children-skip=${VG_IGNORE}"
171 VG_PATH="valgrind"
172 if [ "x$VALGRIND_PATH" != "x" ]; then
173 VG_PATH="$VALGRIND_PATH"
174 fi
175 VG="$VG_PATH $VG_OPTS"
176 SSH="$VG --log-file=${VG_LOG}ssh.%p $SSH"
177 SSHD="$VG --log-file=${VG_LOG}sshd.%p $SSHD"
178 SSHAGENT="$VG --log-file=${VG_LOG}ssh-agent.%p $SSHAGENT"
179 SSHADD="$VG --log-file=${VG_LOG}ssh-add.%p $SSHADD"
180 SSHKEYGEN="$VG --log-file=${VG_LOG}ssh-keygen.%p $SSHKEYGEN"
181 SSHKEYSCAN="$VG --log-file=${VG_LOG}ssh-keyscan.%p $SSHKEYSCAN"
182 SFTP="$VG --log-file=${VG_LOG}sftp.%p ${SFTP}"
183 SCP="$VG --log-file=${VG_LOG}scp.%p $SCP"
184 cat > $OBJ/valgrind-sftp-server.sh << EOF
185#!/bin/sh
186exec $VG --log-file=${VG_LOG}sftp-server.%p $SFTPSERVER "\$@"
187EOF
188 chmod a+rx $OBJ/valgrind-sftp-server.sh
189 SFTPSERVER="$OBJ/valgrind-sftp-server.sh"
190 fi
191fi
192
144# Logfiles. 193# Logfiles.
145# SSH_LOGFILE should be the debug output of ssh(1) only 194# SSH_LOGFILE should be the debug output of ssh(1) only
146# SSHD_LOGFILE should be the debug output of sshd(8) only 195# SSHD_LOGFILE should be the debug output of sshd(8) only
@@ -175,7 +224,7 @@ SSH="$SSHLOGWRAP"
175# [kbytes] to ensure the file is at least that large. 224# [kbytes] to ensure the file is at least that large.
176DATANAME=data 225DATANAME=data
177DATA=$OBJ/${DATANAME} 226DATA=$OBJ/${DATANAME}
178cat ${SSHAGENT} >${DATA} 227cat ${SSHAGENT_BIN} >${DATA}
179chmod u+w ${DATA} 228chmod u+w ${DATA}
180COPY=$OBJ/copy 229COPY=$OBJ/copy
181rm -f ${COPY} 230rm -f ${COPY}
@@ -183,7 +232,7 @@ rm -f ${COPY}
183increase_datafile_size() 232increase_datafile_size()
184{ 233{
185 while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do 234 while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do
186 cat ${SSHAGENT} >>${DATA} 235 cat ${SSHAGENT_BIN} >>${DATA}
187 done 236 done
188} 237}
189 238
@@ -388,7 +437,7 @@ rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
388trace "generate keys" 437trace "generate keys"
389for t in rsa rsa1; do 438for t in rsa rsa1; do
390 # generate user key 439 # generate user key
391 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN} -nt $OBJ/$t ]; then 440 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then
392 rm -f $OBJ/$t 441 rm -f $OBJ/$t
393 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\ 442 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
394 fail "ssh-keygen for $t failed" 443 fail "ssh-keygen for $t failed"
@@ -451,7 +500,7 @@ if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then
451 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy 500 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
452 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy 501 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
453 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy 502 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
454 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy 503 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${TEST_SSHD_LOGFILE} ${SSHD} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
455 504
456 REGRESS_INTEROP_PUTTY=yes 505 REGRESS_INTEROP_PUTTY=yes
457fi 506fi
@@ -459,7 +508,7 @@ fi
459# create a proxy version of the client config 508# create a proxy version of the client config
460( 509(
461 cat $OBJ/ssh_config 510 cat $OBJ/ssh_config
462 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy 511 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${TEST_SSHD_LOGFILE} ${SSHD} -i -f $OBJ/sshd_proxy
463) > $OBJ/ssh_proxy 512) > $OBJ/ssh_proxy
464 513
465# check proxy config 514# check proxy config