[sheepdog] [PATCH 2/3] tests: add -j option for testing with journaling

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Apr 9 18:32:36 CEST 2013


Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 tests/check     |    6 ++++++
 tests/common.rc |   11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/tests/check b/tests/check
index cfa157f..80533fa 100755
--- a/tests/check
+++ b/tests/check
@@ -64,6 +64,7 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+export journaling=false
 
 export md=false
 
@@ -149,6 +150,7 @@ check options
     -n			show me, do not run tests
     -T			output timestamps
     -r 			randomize test order
+    -j 			test with journaling mechanism
 
 testlist options
     -g group[,group...]	include tests from these groups
@@ -222,6 +224,10 @@ testlist options
 	    xgroup=true
 	    xpand=false
 	    ;;
+	-j)			# test with journaling
+	    journaling=true
+	    xpand=false
+	    ;;
 	'[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
 	    echo "No tests?"
 	    status=1
diff --git a/tests/common.rc b/tests/common.rc
index cfa94fa..bafd735 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -228,7 +228,16 @@ _start_sheep()
 	MD=",$STORE/$1/d0,$STORE/$1/d1,$STORE/$1/d2"
     fi
 
-    $SHEEP $STORE/$1$MD -z $1 -p $((7000+$1)) -c $DRIVER -y 127.0.0.1 -d $2 -F $LOG_FORMAT
+    if $journaling; then
+	# FIXME: the parameters size and skip should be configurable
+	JDIR=$STORE/$1_journal
+	JOURNALING="-j dir=$JDIR,size=64"
+	if [ ! -d $JDIR ]; then
+	    mkdir $JDIR
+	fi
+    fi
+
+    $SHEEP $STORE/$1$MD -z $1 -p $((7000+$1)) -c $DRIVER -y 127.0.0.1 -d $2 -F $LOG_FORMAT $JOURNALING
 
     if [ $? != 0 ]; then
         _die "cannot start sheep $1"
-- 
1.7.5.1




More information about the sheepdog mailing list