[sheepdog] [PATCH 3/4] test: add new option -c for correcting logs

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Feb 5 03:36:34 CET 2013


From: Hitoshi Mitake <mitake.hitoshi at gmail.com>

If -c is passed, check will correct logs produced by sheeps in the
directory tests/logs/ after completion of tests.
---
 tests/check |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/tests/check b/tests/check
index 9f47aeb..3ad636a 100755
--- a/tests/check
+++ b/tests/check
@@ -64,6 +64,7 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+correct_logs=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 for r
@@ -145,7 +146,8 @@ check options
     -n			show me, do not run tests
     -T			output timestamps
     -r 			randomize test order
-    
+    -c 			correct logs of sheeps
+
 testlist options
     -g group[,group...]	include tests from these groups
     -x group[,group...]	exclude tests from these groups
@@ -213,6 +215,10 @@ testlist options
 	    xgroup=true
 	    xpand=false
 	    ;;
+	-c)
+	    correct_logs=true
+	    xpand=false
+	    ;;
 	'[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
 	    echo "No tests?"
 	    status=1
@@ -523,6 +529,25 @@ do
     seq="after_$seq"
 done
 
+if $correct_logs
+then
+    if [ ! -d logs ]
+    then
+	mkdir logs
+    fi
+
+    # FIXME: how can I determine maximum number of sheeps?
+    for i in `seq 0 8`; do
+	log=$STORE/$i/sheep.log
+	if [ ! -f $log ]
+	then
+	    break
+	fi
+
+	cp $log logs/$i.log
+    done
+fi
+
 interrupt=false
 status=`expr $n_bad`
 exit
-- 
1.7.2.5




More information about the sheepdog mailing list