]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: use kill -0 to check process existence 2750/head
authorLoic Dachary <loic-201408@dachary.org>
Wed, 22 Oct 2014 03:05:45 +0000 (20:05 -0700)
committerLoic Dachary <ldachary@redhat.com>
Sun, 9 Nov 2014 10:59:51 +0000 (11:59 +0100)
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 <loic-201408@dachary.org>
src/test/mon/mon-test-helpers.sh

index 9d54bef22461af3c903c4cf71c2b601ed52f0c41..ca25dd52db2954e638f399f7bb81db3f2e883160 100644 (file)
@@ -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