[sheepdog] [PATCH v5 4/5] test: collect logs of sheeps after tests

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Feb 5 10:46:49 CET 2013


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

After completion of tests, sheep.log of sheeps are collected in a
directory whose name is "logs.`date +%Y-%m-%d-%H-%M-%S`".

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

diff --git a/.gitignore b/.gitignore
index dbdbd55..bd2f610 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,5 +60,6 @@ tests/check.log
 tests/check.time
 tests/atconfig
 tests/*.out.bad
+tests/logs.*
 
 *.patch
diff --git a/tests/check b/tests/check
index 9f47aeb..b700ff5 100755
--- a/tests/check
+++ b/tests/check
@@ -145,7 +145,7 @@ check options
     -n			show me, do not run tests
     -T			output timestamps
     -r 			randomize test order
-    
+
 testlist options
     -g group[,group...]	include tests from these groups
     -x group[,group...]	exclude tests from these groups
@@ -523,6 +523,24 @@ do
     seq="after_$seq"
 done
 
+# collect log files
+log_dir=logs.`date +%Y-%m-%d-%H-%M-%S`
+
+if [ ! -d $log_dir ]
+then
+    mkdir $log_dir
+
+    max_nr_sheeps=`find $STORE -name sheep.log | wc -l`
+    max_nr_sheeps=`expr $max_nr_sheeps - 1`
+    for i in `seq 0 $max_nr_sheeps`;
+    do
+	cp $STORE/$i/sheep.log $log_dir/$i.log
+    done
+else
+    echo "directory $log_dir already exists"
+    echo "skip collecting log files"
+fi
+
 interrupt=false
 status=`expr $n_bad`
 exit
-- 
1.7.2.5




More information about the sheepdog mailing list