diff options
author | Damien Miller <djm@mindrot.org> | 2010-02-24 17:29:34 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-02-24 17:29:34 +1100 |
commit | c1739211a6ce790e72262db90ba4b1d0ce79d1f4 (patch) | |
tree | 733daa52135a8f4abc2ef3c96d5bb7f409626630 /regress | |
parent | 8f9492c90d02f97cf7248147961b3f2a9de075d8 (diff) |
- djm@cvs.openbsd.org 2010/02/24 06:21:56
[regress/test-exec.sh]
wait for sshd to fully stop in cleanup() function; avoids races in tests
that do multiple start_sshd/cleanup cycles; "I hate pidfiles" deraadt@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/test-exec.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index 804a29696..b3a19389d 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.36 2009/10/08 18:04:27 markus Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -172,9 +172,17 @@ cleanup () | |||
172 | echo no sshd running | 172 | echo no sshd running |
173 | else | 173 | else |
174 | if [ $pid -lt 2 ]; then | 174 | if [ $pid -lt 2 ]; then |
175 | echo bad pid for ssd: $pid | 175 | echo bad pid for ssh: $pid |
176 | else | 176 | else |
177 | $SUDO kill $pid | 177 | $SUDO kill $pid |
178 | trace "wait for sshd to exit" | ||
179 | i=0; | ||
180 | while [ -f $PIDFILE -a $i -lt 5 ]; do | ||
181 | i=`expr $i + 1` | ||
182 | sleep $i | ||
183 | done | ||
184 | test -f $PIDFILE && \ | ||
185 | fatal "sshd didn't exit port $PORT pid $pid" | ||
178 | fi | 186 | fi |
179 | fi | 187 | fi |
180 | fi | 188 | fi |