summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorRitesh Harjani <riteshh@linux.ibm.com>2021-02-11 09:01:44 +0530
committerEryu Guan <guaneryu@gmail.com>2021-03-07 23:53:36 +0800
commit9b298bdf540f29a0571998dfd150dc614ef7f34b (patch)
tree6c916cade9322b69313502eea4d22fd66f93f4e9 /check
parent46f896c0a55d4fd979f473dcd5742f67746e66ec (diff)
check: add CLI option to repeat and stop tests in case of failure
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@linux.ibm.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'check')
-rwxr-xr-xcheck8
1 files changed, 8 insertions, 0 deletions
diff --git a/check b/check
index 106ec8e1..ba192042 100755
--- a/check
+++ b/check
@@ -28,6 +28,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=""
@@ -70,6 +71,7 @@ check options
-r randomize test order
--exact-order run tests in the exact order specified
-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]
@@ -326,6 +328,7 @@ while [ $# -gt 0 ]; do
exact_order=true
;;
-i) iterations=$2; shift ;;
+ -I) iterations=$2; istop=true; shift ;;
-T) timestamp=true ;;
-d) DUMP_OUTPUT=true ;;
-b) brief_test_summary=true;;
@@ -952,6 +955,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