From: Loic Dachary Date: Wed, 22 Oct 2014 03:05:45 +0000 (-0700) Subject: tests: use kill -0 to check process existence X-Git-Tag: v0.89~46^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2750%2Fhead;p=ceph.git tests: use kill -0 to check process existence When killing a daemon, instead of using kill -9 to check the process was terminated, use kill -0. Should the pid of the process be reused immediately after, it would be wrong to kill the new process. Worst case scenario the kill_daemon function returns before the process is confirmed to be killed but this is not treated as an error and is unlikely to cause any problem. Signed-off-by: Loic Dachary --- diff --git a/src/test/mon/mon-test-helpers.sh b/src/test/mon/mon-test-helpers.sh index 9d54bef22461..ca25dd52db29 100644 --- a/src/test/mon/mon-test-helpers.sh +++ b/src/test/mon/mon-test-helpers.sh @@ -68,8 +68,10 @@ function kill_daemons() { local dir=$1 for pidfile in $(find $dir | grep '\.pid') ; do pid=$(cat $pidfile) + signal=9 for try in 0 1 1 1 2 3 ; do - kill -9 $pid 2> /dev/null || break + kill -$signal $pid 2> /dev/null || break + signal=0 sleep $try done done