[sheepdog] [PATCH 1/3] tests: add check of the number of running sheep processes

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Aug 30 02:36:15 CEST 2012


Without this patch, check script cannot return from _wait_for_sheep()
when one of sheep processs exits unexpectedly.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/common.rc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tests/common.rc b/tests/common.rc
index a35c1e1..c9aaae7 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -143,11 +143,21 @@ _wait_for_collie()
     done
 }
 
+_count_sheep_processes()
+{
+    pgrep -f "$SHEEP $STORE/" -l | awk '{ $1=""; print }' | sort | uniq | wc -l
+}
+
 # wait for all sheep to join completely
 _wait_for_sheep()
 {
     while true; do
         sleep 1
+
+        if [ $(_count_sheep_processes) != $1 ]; then
+            _die "there are not enough sheep processes"
+        fi
+
         node_list="$($COLLIE node list)"
 
         if [ $? != 0 ]; then
-- 
1.7.2.5




More information about the sheepdog mailing list