summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2010-02-24 06:21:57 +0000
committerDamien Miller <djm@cvs.openbsd.org>2010-02-24 06:21:57 +0000
commitf41ab3e79d3c67e20c6eabc02eef5cc56fd6b6ca (patch)
treea133c69a7255e2a1f80e23819b201614ba5498b9
parent9e19045d3fe652b8058c0f52611cee9f2ca7db3b (diff)
wait for sshd to fully stop in cleanup() function; avoids races in tests
that do multiple start_sshd/cleanup cycles; "I hate pidfiles" deraadt@
-rw-r--r--regress/usr.bin/ssh/test-exec.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh
index ade81eee939..4c7c6e65765 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.36 2009/10/08 18:04:27 markus Exp $
+# $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $
# Placed in the Public Domain.
USER=`id -un`
@@ -113,9 +113,17 @@ cleanup ()
echo no sshd running
else
if [ $pid -lt 2 ]; then
- echo bad pid for ssd: $pid
+ echo bad pid for ssh: $pid
else
$SUDO kill $pid
+ trace "wait for sshd to exit"
+ i=0;
+ while [ -f $PIDFILE -a $i -lt 5 ]; do
+ i=`expr $i + 1`
+ sleep $i
+ done
+ test -f $PIDFILE && \
+ fatal "sshd didn't exit port $PORT pid $pid"
fi
fi
fi