[sheepdog] [PATCH 5/8] tests: teach tests to test raid feature

Liu Yuan namei.unix at gmail.com
Sun Mar 10 15:19:26 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

To test raid feature, just pass -raid to check
 $ ./check -raid ...

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/check     |    9 +++++++++
 tests/common.rc |    6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/check b/tests/check
index b700ff5..78df852 100755
--- a/tests/check
+++ b/tests/check
@@ -64,6 +64,9 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+
+export raid=false
+
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 for r
@@ -141,6 +144,7 @@ check options
     -zk                 use zookeeper driver
     -valgrind           use valgrind
     -xdiff		graphical mode diff
+    -raid               enable raid for backend
     -e			exit immediately on test failure
     -n			show me, do not run tests
     -T			output timestamps
@@ -165,6 +169,11 @@ testlist options
 	    xpand=false
 	    ;;
 
+	-raid)
+	    raid=true
+	    xpand=false
+	    ;;
+
 	-valgrind)
 	    valgrind=true
 	    xpand=false
diff --git a/tests/common.rc b/tests/common.rc
index b160800..ec4716c 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -221,7 +221,11 @@ _start_sheep()
         _die "sheep $1 is still running"
     fi
 
-    $SHEEP $STORE/$1 -z $1 -p $((7000+$1)) -c $DRIVER -y 127.0.0.1 -d $2 -F $LOG_FORMAT
+    if $raid; then
+	RAID=",$STORE/$1/d0,$STORE/$1/d1"
+    fi
+
+    $SHEEP $STORE/$1$RAID -z $1 -p $((7000+$1)) -c $DRIVER -y 127.0.0.1 -d $2 -F $LOG_FORMAT
 
     if [ $? != 0 ]; then
         _die "cannot start sheep $1"
-- 
1.7.9.5




More information about the sheepdog mailing list