FS/XFS testing framework
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <guaneryu@gmail.com>, Zorro Lang <zlang@redhat.com>
Cc: "Darrick J . Wong" <darrick.wong@oracle.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	fstests@vger.kernel.org
Subject: [PATCH 1/3] common: support black listing fs in _supported_fs()
Date: Sun, 17 Apr 2022 20:40:21 +0300	[thread overview]
Message-ID: <20220417174023.3244263-2-amir73il@gmail.com> (raw)
In-Reply-To: <20220417174023.3244263-1-amir73il@gmail.com>

For example:
_supported_fs ^xfs

There is no need to specify "generic" when using a block list
"all other fs are supported" is implied.

Converted some generic tests that open code this condition without
emitting a meaningful reason.

More generic test like generic/186,187 could use a block list, but
were not converted because they emit some meaningful reason:
  _notrun "Can't fragment free space on btrfs."

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 common/rc         | 30 ++++++++++++++++++++----------
 tests/generic/500 |  3 +--
 tests/generic/631 |  3 +--
 tests/generic/679 |  3 +--
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/common/rc b/common/rc
index 17629801..1d37dcbd 100644
--- a/common/rc
+++ b/common/rc
@@ -1572,19 +1572,29 @@ _fail()
 
 # tests whether $FSTYP is one of the supported filesystems for a test
 #
-_supported_fs()
+_check_supported_fs()
 {
-    local f
+	local res=1
+	local f
 
-    for f
-    do
-	if [ "$f" = "$FSTYP" -o "$f" = "generic" ]
-	then
-	    return
-	fi
-    done
+	for f; do
+		# ^FS means black listed fs
+		if [ "$f" = "^$FSTYP" ]; then
+			return 1
+		elif [ "$f" = "generic" ] || [[ "$f" == "^"* ]]; then
+			# ^FS implies "generic ^FS"
+			res=0
+		elif [ "$f" = "$FSTYP" ]; then
+			return 0
+		fi
+	done
+	return $res
+}
 
-    _notrun "not suitable for this filesystem type: $FSTYP"
+_supported_fs()
+{
+	_check_supported_fs $* || \
+		_notrun "not suitable for this filesystem type: $FSTYP"
 }
 
 # check if a FS on a device is mounted
diff --git a/tests/generic/500 b/tests/generic/500
index 0be59934..bc84d219 100755
--- a/tests/generic/500
+++ b/tests/generic/500
@@ -35,7 +35,6 @@ _cleanup()
 . ./common/dmthin
 
 # real QA test starts here
-_supported_fs generic
 _require_scratch_nocheck
 _require_dm_target thin-pool
 
@@ -43,7 +42,7 @@ _require_dm_target thin-pool
 # and since we've filled the thinp device it'll return EIO, which will make
 # btrfs flip read only, making it fail this test when it just won't work right
 # for us in the first place.
-test $FSTYP == "btrfs"  && _notrun "btrfs doesn't work that way lol"
+_supported_fs ^btrfs
 
 # Require underlying device support discard
 _scratch_mkfs >>$seqres.full 2>&1
diff --git a/tests/generic/631 b/tests/generic/631
index 4996bce7..219f7a05 100755
--- a/tests/generic/631
+++ b/tests/generic/631
@@ -36,10 +36,9 @@ _cleanup()
 . ./common/attr
 
 # real QA test starts here
-_supported_fs generic
 _require_scratch
 _require_attrs trusted
-test "$FSTYP" = "overlay" && _notrun "Test does not apply to overlayfs."
+_supported_fs ^overlay
 _require_extra_fs overlay
 
 _scratch_mkfs >> $seqres.full
diff --git a/tests/generic/679 b/tests/generic/679
index 440f0c08..c32d42b9 100755
--- a/tests/generic/679
+++ b/tests/generic/679
@@ -17,7 +17,6 @@ _begin_fstest auto quick prealloc
 
 # real QA test starts here
 
-_supported_fs generic
 _require_scratch
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "fiemap"
@@ -26,7 +25,7 @@ _require_xfs_io_command "fiemap"
 #
 #   https://lore.kernel.org/linux-btrfs/20220315164011.GF8241@magnolia/
 #
-[ $FSTYP == "xfs" ] && _notrun "test not valid for xfs"
+_supported_fs ^xfs
 
 rm -f $seqres.full
 
-- 
2.35.1


  reply	other threads:[~2022-04-17 17:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 17:40 [PATCH 0/3] Annonate fstests with possible reasons for failure Amir Goldstein
2022-04-17 17:40 ` Amir Goldstein [this message]
2022-04-18  4:33   ` [PATCH 1/3] common: support black listing fs in _supported_fs() Zorro Lang
2022-04-17 17:40 ` [PATCH 2/3] common: print hints for reasons of test failures Amir Goldstein
2022-04-18  4:52   ` Zorro Lang
2022-04-18  5:26     ` Amir Goldstein
2022-04-18 15:18       ` Theodore Ts'o
2022-04-18 15:50         ` Amir Goldstein
2022-04-17 17:40 ` [PATCH 3/3] common: add run option to skip tests for known issues Amir Goldstein
2022-04-18  5:05   ` Zorro Lang
2022-04-18  5:56     ` Amir Goldstein
2022-04-18  9:06       ` Zorro Lang
2022-04-18 10:03         ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220417174023.3244263-2-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=mcgrof@kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox