[sheepdog] [PATCH] tests: add option to exit immediately on test failure

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Sep 10 15:17:55 CEST 2012


This add '-e' option to stop check script immediately on test failure.
This is useful when we want to check sheep.log or dumped core files of
the failure.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/check |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tests/check b/tests/check
index 897a0c3..720f775 100755
--- a/tests/check
+++ b/tests/check
@@ -57,6 +57,7 @@ diff="diff -u"
 verbose=false
 group=false
 xgroup=false
+exit_on_err=false
 showme=false
 sortme=false
 expunge=true
@@ -139,6 +140,7 @@ check options
     -corosync           use corosync driver (default: local)
     -valgrind           use valgrind
     -xdiff		graphical mode diff
+    -e			exit immediately on test failure
     -n			show me, do not run tests
     -T			output timestamps
     -r 			randomize test order
@@ -179,6 +181,10 @@ testlist options
 	    fi
 	    ;;
 
+	-e)	# exit immediately on test failure
+	    exit_on_err=true
+	    xpand=false
+	    ;;
 	-n)	# show me, don't do it
 	    showme=true
 	    xpand=false
@@ -495,13 +501,17 @@ do
 
     # come here for each test, except when $showme is true
     #
+    [ -f $seq.notrun ] || try=`expr $try + 1`
     if $err
     then
 	bad="$bad $seq"
 	n_bad=`expr $n_bad + 1`
 	quick=false
+	if $exit_on_err
+	then
+	    break
+	fi
     fi
-    [ -f $seq.notrun ] || try=`expr $try + 1`
     
     seq="after_$seq"
 done
-- 
1.7.2.5




More information about the sheepdog mailing list