121 lines
3.2 KiB
Diff
121 lines
3.2 KiB
Diff
From 28520bf114b3b0515a48ff44fff4ecbe9ed6dfad Mon Sep 17 00:00:00 2001
|
|
From: Logan Gunthorpe <logang@deltatee.com>
|
|
Date: Wed, 22 Jun 2022 14:25:18 -0600
|
|
Subject: [PATCH 43/83] mdadm/test: Mark and ignore broken test failures
|
|
|
|
Add functionality to continue if a test marked as broken fails.
|
|
|
|
To mark a test as broken, a file with the same name but with the suffix
|
|
'.broken' should exist. The first line in the file will be printed with
|
|
a KNOWN BROKEN message; the rest of the file can describe the how the
|
|
test is broken.
|
|
|
|
Also adds --skip-broken and --skip-always-broken to skip all the tests
|
|
that have a .broken file or to skip all tests whose .broken file's first
|
|
line contains the keyword always.
|
|
|
|
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
|
|
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
|
|
---
|
|
test | 37 +++++++++++++++++++++++++++++++++++--
|
|
1 file changed, 35 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/test b/test
|
|
index da6db5e0..61d9ee83 100755
|
|
--- a/test
|
|
+++ b/test
|
|
@@ -10,6 +10,8 @@ devlist=
|
|
|
|
savelogs=0
|
|
exitonerror=1
|
|
+ctrl_c_error=0
|
|
+skipbroken=0
|
|
loop=1
|
|
prefix='[0-9][0-9]'
|
|
|
|
@@ -36,6 +38,7 @@ die() {
|
|
|
|
ctrl_c() {
|
|
exitonerror=1
|
|
+ ctrl_c_error=1
|
|
}
|
|
|
|
# mdadm always adds --quiet, and we want to see any unexpected messages
|
|
@@ -80,8 +83,21 @@ mdadm() {
|
|
do_test() {
|
|
_script=$1
|
|
_basename=`basename $_script`
|
|
+ _broken=0
|
|
+
|
|
if [ -f "$_script" ]
|
|
then
|
|
+ if [ -f "${_script}.broken" ]; then
|
|
+ _broken=1
|
|
+ _broken_msg=$(head -n1 "${_script}.broken" | tr -d '\n')
|
|
+ if [ "$skipbroken" == "all" ]; then
|
|
+ return
|
|
+ elif [ "$skipbroken" == "always" ] &&
|
|
+ [[ "$_broken_msg" == *always* ]]; then
|
|
+ return
|
|
+ fi
|
|
+ fi
|
|
+
|
|
rm -f $targetdir/stderr
|
|
# this might have been reset: restore the default.
|
|
echo 2000 > /proc/sys/dev/raid/speed_limit_max
|
|
@@ -98,10 +114,15 @@ do_test() {
|
|
else
|
|
save_log fail
|
|
_fail=1
|
|
+ if [ "$_broken" == "1" ]; then
|
|
+ echo " (KNOWN BROKEN TEST: $_broken_msg)"
|
|
+ fi
|
|
fi
|
|
[ "$savelogs" == "1" ] &&
|
|
mv -f $targetdir/log $logdir/$_basename.log
|
|
- [ "$_fail" == "1" -a "$exitonerror" == "1" ] && exit 1
|
|
+ [ "$ctrl_c_error" == "1" ] && exit 1
|
|
+ [ "$_fail" == "1" -a "$exitonerror" == "1" \
|
|
+ -a "$_broken" == "0" ] && exit 1
|
|
fi
|
|
}
|
|
|
|
@@ -119,6 +140,8 @@ do_help() {
|
|
--save-logs Usually use with --logdir together
|
|
--keep-going | --no-error Don't stop on error, ie. run all tests
|
|
--loop=N Run tests N times (0 to run forever)
|
|
+ --skip-broken Skip tests that are known to be broken
|
|
+ --skip-always-broken Skip tests that are known to always fail
|
|
--dev=loop|lvm|ram|disk Use loop devices (default), LVM, RAM or disk
|
|
--disks= Provide a bunch of physical devices for test
|
|
--volgroup=name LVM volume group for LVM test
|
|
@@ -216,6 +239,12 @@ parse_args() {
|
|
--loop=* )
|
|
loop="${i##*=}"
|
|
;;
|
|
+ --skip-broken )
|
|
+ skipbroken=all
|
|
+ ;;
|
|
+ --skip-always-broken )
|
|
+ skipbroken=always
|
|
+ ;;
|
|
--disable-multipath )
|
|
unset MULTIPATH
|
|
;;
|
|
@@ -279,7 +308,11 @@ main() {
|
|
else
|
|
for script in $testdir/$prefix $testdir/$prefix*[^~]
|
|
do
|
|
- do_test $script
|
|
+ case $script in
|
|
+ *.broken) ;;
|
|
+ *)
|
|
+ do_test $script
|
|
+ esac
|
|
done
|
|
fi
|
|
|
|
--
|
|
2.38.1
|
|
|