[sheepdog] [PATCH] func/test: _kill_xxx methods use SIGTERM by default

Ruoyu liangry at ucweb.com
Thu Aug 14 05:51:29 CEST 2014


Since the bug, sheep sometimes cannot be killed, is fixed by the commit
f473561, functional tests should use 'pkill' instead of 'pkill -9'
by default. Otherwise, some tests using zookeeper as their cluster
manager will be failure because zookeeper cannot receive the leaving
message at the first time.

For the purpose of killing program forcibly, _kill_xxx_force methods
are added. They kill programs with SIGKILL (-9).

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 tests/functional/common.rc | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index 20365ce..aa2b825 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -314,7 +314,7 @@ _start_sheep()
 
 _kill_all_dogs()
 {
-    pkill -9 -f "$DOG_PROG (cluster|vdi|node|debug)"
+    pkill -f "$DOG_PROG (cluster|vdi|node|debug)"
 
     while [ $? == 0 ]; do
         pgrep -f "$DOG_PROG (cluster|vdi|node|debug)" > /dev/null
@@ -323,13 +323,40 @@ _kill_all_dogs()
 
 _kill_all_sheeps()
 {
-    pkill -9 -f "$SHEEP_PROG $WD"
+    pkill -f "$SHEEP_PROG $WD"
 
     _wait_for_sheep_stop
 }
 
 _kill_sheep()
 {
+    pkill -f "$SHEEP_PROG $STORE/$1 "
+
+    if [ $? != 0 ]; then
+        _die "cannot kill sheep $1"
+    fi
+
+    _wait_for_sheep_stop $1
+}
+
+_kill_all_dogs_force()
+{
+    pkill -9 -f "$DOG_PROG (cluster|vdi|node|debug)"
+
+    while [ $? == 0 ]; do
+        pgrep -f "$DOG_PROG (cluster|vdi|node|debug)" > /dev/null
+    done
+}
+
+_kill_all_sheeps_force()
+{
+    pkill -9 -f "$SHEEP_PROG $WD"
+
+    _wait_for_sheep_stop
+}
+
+_kill_sheep_force()
+{
     pkill -9 -f "$SHEEP_PROG $STORE/$1 "
 
     if [ $? != 0 ]; then
-- 
1.8.3.2





More information about the sheepdog mailing list