|
|
c0f891 |
From a7bfcc716e235664dfb3b6c5a9590273e611ac72 Mon Sep 17 00:00:00 2001
|
|
|
c0f891 |
From: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c0f891 |
Date: Wed, 22 Jun 2022 14:25:17 -0600
|
|
|
37f2b0 |
Subject: [PATCH 42/83] mdadm/test: Add a mode to repeat specified tests
|
|
|
c0f891 |
|
|
|
c0f891 |
Many tests fail infrequently or rarely. To help find these, add
|
|
|
c0f891 |
an option to run the tests multiple times by specifying --loop=N.
|
|
|
c0f891 |
|
|
|
c0f891 |
If --loop=0 is specified, the test will be looped forever.
|
|
|
c0f891 |
|
|
|
c0f891 |
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c0f891 |
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
|
|
|
c0f891 |
---
|
|
|
c0f891 |
test | 36 ++++++++++++++++++++++++------------
|
|
|
c0f891 |
1 file changed, 24 insertions(+), 12 deletions(-)
|
|
|
c0f891 |
|
|
|
c0f891 |
diff --git a/test b/test
|
|
|
c0f891 |
index 711a3c7a..da6db5e0 100755
|
|
|
c0f891 |
--- a/test
|
|
|
c0f891 |
+++ b/test
|
|
|
c0f891 |
@@ -10,6 +10,7 @@ devlist=
|
|
|
c0f891 |
|
|
|
c0f891 |
savelogs=0
|
|
|
c0f891 |
exitonerror=1
|
|
|
c0f891 |
+loop=1
|
|
|
c0f891 |
prefix='[0-9][0-9]'
|
|
|
c0f891 |
|
|
|
c0f891 |
# use loop devices by default if doesn't specify --dev
|
|
|
c0f891 |
@@ -117,6 +118,7 @@ do_help() {
|
|
|
c0f891 |
--logdir=directory Directory to save all logfiles in
|
|
|
c0f891 |
--save-logs Usually use with --logdir together
|
|
|
c0f891 |
--keep-going | --no-error Don't stop on error, ie. run all tests
|
|
|
c0f891 |
+ --loop=N Run tests N times (0 to run forever)
|
|
|
c0f891 |
--dev=loop|lvm|ram|disk Use loop devices (default), LVM, RAM or disk
|
|
|
c0f891 |
--disks= Provide a bunch of physical devices for test
|
|
|
c0f891 |
--volgroup=name LVM volume group for LVM test
|
|
|
c0f891 |
@@ -211,6 +213,9 @@ parse_args() {
|
|
|
c0f891 |
--keep-going | --no-error )
|
|
|
c0f891 |
exitonerror=0
|
|
|
c0f891 |
;;
|
|
|
c0f891 |
+ --loop=* )
|
|
|
c0f891 |
+ loop="${i##*=}"
|
|
|
c0f891 |
+ ;;
|
|
|
c0f891 |
--disable-multipath )
|
|
|
c0f891 |
unset MULTIPATH
|
|
|
c0f891 |
;;
|
|
|
c0f891 |
@@ -263,19 +268,26 @@ main() {
|
|
|
c0f891 |
echo "Testing on linux-$(uname -r) kernel"
|
|
|
c0f891 |
[ "$savelogs" == "1" ] &&
|
|
|
c0f891 |
echo "Saving logs to $logdir"
|
|
|
c0f891 |
- if [ "x$TESTLIST" != "x" ]
|
|
|
c0f891 |
- then
|
|
|
c0f891 |
- for script in ${TESTLIST[@]}
|
|
|
c0f891 |
- do
|
|
|
c0f891 |
- do_test $testdir/$script
|
|
|
c0f891 |
- done
|
|
|
c0f891 |
- else
|
|
|
c0f891 |
- for script in $testdir/$prefix $testdir/$prefix*[^~]
|
|
|
c0f891 |
- do
|
|
|
c0f891 |
- do_test $script
|
|
|
c0f891 |
- done
|
|
|
c0f891 |
- fi
|
|
|
c0f891 |
|
|
|
c0f891 |
+ while true; do
|
|
|
c0f891 |
+ if [ "x$TESTLIST" != "x" ]
|
|
|
c0f891 |
+ then
|
|
|
c0f891 |
+ for script in ${TESTLIST[@]}
|
|
|
c0f891 |
+ do
|
|
|
c0f891 |
+ do_test $testdir/$script
|
|
|
c0f891 |
+ done
|
|
|
c0f891 |
+ else
|
|
|
c0f891 |
+ for script in $testdir/$prefix $testdir/$prefix*[^~]
|
|
|
c0f891 |
+ do
|
|
|
c0f891 |
+ do_test $script
|
|
|
c0f891 |
+ done
|
|
|
c0f891 |
+ fi
|
|
|
c0f891 |
+
|
|
|
c0f891 |
+ let loop=$loop-1
|
|
|
c0f891 |
+ if [ "$loop" == "0" ]; then
|
|
|
c0f891 |
+ break
|
|
|
c0f891 |
+ fi
|
|
|
c0f891 |
+ done
|
|
|
c0f891 |
exit 0
|
|
|
c0f891 |
}
|
|
|
c0f891 |
|
|
|
c0f891 |
--
|
|
|
37f2b0 |
2.38.1
|
|
|
c0f891 |
|