[PATCHv2 1/3] check: add CLI option to repeat and stop tests in case of failure

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Currently with -i <n> option the test can run for many iterations,
but in case if we want to stop the iteration in case of a failure,
it is much easier to have such an option which could check the failed
status and stop the test from further proceeding.

This patch adds such an option (-I <n>) thereby extending the -i <n> option
functionality.

Signed-off-by: Ritesh Harjani <riteshh@xxxxxxxxxxxxx>
---
 check | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/check b/check
index c6ad1d6c0733..6760d066955d 100755
--- a/check
+++ b/check
@@ -27,6 +27,7 @@ brief_test_summary=false
 do_report=false
 DUMP_OUTPUT=false
 iterations=1
+istop=false

 # This is a global variable used to pass test failure text to reporting gunk
 _err_msg=""
@@ -68,6 +69,7 @@ check options
     -T			output timestamps
     -r			randomize test order
     -i <n>		iterate the test list <n> times
+    -I <n>		iterate the test list <n> times, but stops iterating further in case of any test failure
     -d			dump test output to stdout
     -b			brief test summary
     -R fmt[,fmt]	generate report in formats specified. Supported format: [xunit]
@@ -300,6 +302,7 @@ while [ $# -gt 0 ]; do
 	-n)	showme=true ;;
         -r)	randomize=true ;;
 	-i)	iterations=$2; shift ;;
+	-I) 	iterations=$2; istop=true; shift ;;
 	-T)	timestamp=true ;;
 	-d)	DUMP_OUTPUT=true ;;
 	-b)	brief_test_summary=true;;
@@ -926,6 +929,11 @@ function run_section()
 for ((iters = 0; iters < $iterations; iters++)) do
 	for section in $HOST_OPTIONS_SECTIONS; do
 		run_section $section
+		if [ "$sum_bad" != 0 ] && [ "$istop" = true ]; then
+			interrupt=false
+			status=`expr $sum_bad != 0`
+			exit
+		fi
 	done
 done

--



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux