[sheepdog] [PATCH 07/14] tests: refine start up of valgrind sheep

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


This removes a lock file before starting sheep because we wait for
sheep's start-up by checking the lock file existence.  This also
checks the sheep process to avoid infinite loop.

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

diff --git a/tests/common.rc b/tests/common.rc
index e8adf5d..8712e58 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -219,10 +219,16 @@ _valgrind_sheep()
             echo \"core dumped (${dir}/core)\"; kill \$PPID"
     opts="--db-attach=yes --db-command='${db_cmd}' --suppressions=valgrind.supp -q"
 
+    rm -f ${dir}/lock
     sh -c "echo y | valgrind ${opts} $SHEEP_PROG $* -f -o 2>> ${dir}/sheep.log &"
 
     # wait for sheep to start up
     while true; do
+	pgrep -f "$SHEEP_PROG $1" > /dev/null
+	if [ $? != 0 ]; then
+	    # failed to start sheep $1
+	    break
+	fi
         if [ -a ${dir}/lock ]; then
             break
         fi
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list