[regress/dynamic-forward.sh]
     Retry establishing the port forwarding after a small delay, should make
     the tests less flaky when the previous test is slow to shut down and free
     up the port.
This commit is contained in:
Darren Tucker 2011-06-03 14:19:02 +10:00
parent 75e035c34e
commit bf4d05a37c
2 changed files with 22 additions and 5 deletions

View File

@ -29,6 +29,11 @@
- dtucker@cvs.openbsd.org 2011/05/31 02:03:34
[regress/dynamic-forward.sh]
work around startup and teardown races; caught by deraadt
- dtucker@cvs.openbsd.org 2011/06/03 00:29:52
[regress/dynamic-forward.sh]
Retry establishing the port forwarding after a small delay, should make
the tests less flaky when the previous test is slow to shut down and free
up the port.
20110529
- (djm) OpenBSD CVS Sync

View File

@ -1,4 +1,4 @@
# $OpenBSD: dynamic-forward.sh,v 1.8 2011/05/31 02:03:34 dtucker Exp $
# $OpenBSD: dynamic-forward.sh,v 1.9 2011/06/03 00:29:52 dtucker Exp $
# Placed in the Public Domain.
tid="dynamic forwarding"
@ -20,10 +20,23 @@ trace "will use ProxyCommand $proxycmd"
start_sshd
for p in 1 2; do
n=0
error="1"
trace "start dynamic forwarding, fork to background"
${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q \
-oExitOnForwardFailure=yes somehost \
exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\'
while [ "$error" -ne 0 -a "$n" -lt 3 ]; do
n=`expr $n + 1`
${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q \
-oExitOnForwardFailure=yes somehost exec sh -c \
\'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\'
error=$?
if [ "$error" -ne 0 ]; then
trace "forward failed proto $p attempt $n err $error"
sleep $n
fi
done
if [ "$error" -ne 0 ]; then
fatal "failed to start dynamic forwarding proto $p"
fi
for s in 4 5; do
for h in 127.0.0.1 localhost; do
@ -42,7 +55,6 @@ for p in 1 2; do
if [ $remote -gt 1 ]; then
kill -HUP $remote
fi
sleep 1
else
fail "no pid file: $OBJ/remote_pid"
fi