Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/kernel Don't rely on "kill -0" to check whether a back...



details:   https://anonhg.NetBSD.org/src/rev/e9756c648ab1
branches:  trunk
changeset: 787065:e9756c648ab1
user:      gson <gson%NetBSD.org@localhost>
date:      Fri May 31 14:40:48 2013 +0000

description:
Don't rely on "kill -0" to check whether a background shell command
has exited; it does not work reliably because the process may still
exist as a zombie.  OK mlelstv.

diffstat:

 tests/kernel/t_umountstress.sh |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r 36ba3db50aa9 -r e9756c648ab1 tests/kernel/t_umountstress.sh
--- a/tests/kernel/t_umountstress.sh    Fri May 31 10:56:16 2013 +0000
+++ b/tests/kernel/t_umountstress.sh    Fri May 31 14:40:48 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_umountstress.sh,v 1.4 2013/04/28 15:49:58 mlelstv Exp $
+# $NetBSD: t_umountstress.sh,v 1.5 2013/05/31 14:40:48 gson Exp $
 #
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -69,16 +69,16 @@
                for k in 0 1 2 3 4 5 6 7 8 9; do
                        if ! dd msgfmt=quiet if=/dev/zero \
                                count=1 of=${TMPMP}/test$i$j$k; then
-                               echo 1
+                               echo 1 >result
                                exit
                        fi
                done
                done
-               echo 0
-       ) > result &
+               echo 0 >result
+       ) &
        busypid=$!
 
-       while kill 2>/dev/null -0 $busypid; do
+       while ! test -f result; do
                if err=$(umount ${TMPMP} 2>&1); then
                        kill $busypid
                        exec 9<&-
@@ -150,16 +150,16 @@
                for j in 0 1 2 3 4 5 6 7 8 9; do
                for k in 0 1 2 3 4 5 6 7 8 9; do
                        if ! out=$(mount); then
-                               echo 1
+                               echo 1 >result
                                exit
                        fi
                done
                done
-               echo 0
-       ) > result &
+               echo 0 >result
+       ) &
        busypid=$!
 
-       while kill 2>/dev/null -0 $busypid; do
+       while ! test -f result; do
                if err=$(umount ${TMPMP} 2>&1); then
                        if ! mount -o async ${BVND}${MPART} ${TMPMP}; then
                                kill $busypid



Home | Main Index | Thread Index | Old Index