[sheepdog] [PATCH 11/14] tests: wait format at most 60 seconds

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Apr 30 10:30:06 CEST 2013


036 and 038 cannot stop when 'collie cluster format' never succeeds.
This patch fixes it.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/036 | 11 +++++++++++
 tests/038 | 10 +++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/tests/036 b/tests/036
index 81f58eb..0184abb 100755
--- a/tests/036
+++ b/tests/036
@@ -25,7 +25,18 @@ while true; do
         break
     fi
     # try again until at least one sheep starts up
+done &
+
+pid=$!
+
+for cnt in `seq 60`; do # wait at most 60 seconds
+    jobs 1 > /dev/null 2>&1
+    if [ $? != 0 ]; then
+	break
+    fi
+    sleep 1
 done
+kill $pid > /dev/null 2>&1
 
 _wait_for_sheep 8
 
diff --git a/tests/038 b/tests/038
index 3f99ae1..62e6736 100755
--- a/tests/038
+++ b/tests/038
@@ -26,13 +26,21 @@ while true; do
     fi
     # try again until at least one sheep starts up
 done &
+pid=$!
 
 for i in `seq 4 7`; do
     _kill_sheep $i
 done
 
 # wait for collie to finish
-wait
+for cnt in `seq 60`; do # wait at most 60 seconds
+    jobs 1 > /dev/null 2>&1
+    if [ $? != 0 ]; then
+	break
+    fi
+    sleep 1
+done
+kill $pid > /dev/null 2>&1
 
 for i in `seq 4 7`; do
     _start_sheep $i
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list