]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: Add a new _require_scratch_extsize helper function
authorNirjhar Roy <nirjhar@linux.ibm.com>
Wed, 27 Nov 2024 04:28:00 +0000 (09:58 +0530)
committerZorro Lang <zlang@kernel.org>
Thu, 28 Nov 2024 02:25:36 +0000 (10:25 +0800)
_require_scratch_extsize helper function will be used in the
the next patch to make the test run only on filesystems with
extsize support.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc

index f94bee5edd68e72272832ba667d190f18c52baa6..e6c6047dcaaee3b3506414a837d17abcaa842c35 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -48,6 +48,23 @@ _test_fsxattr_xflag()
        grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# This test requires extsize support on the  filesystem
+_require_scratch_extsize()
+{
+       _require_scratch
+       _require_xfs_io_command "extsize"
+       _scratch_mkfs > /dev/null
+       _scratch_mount
+       local filename=$SCRATCH_MNT/$RANDOM
+       local blksz=$(_get_block_size $SCRATCH_MNT)
+       local extsz=$(( blksz*2 ))
+       local res=$($XFS_IO_PROG -c "open -f $filename" -c "extsize $extsz" \
+               -c "extsize")
+       _scratch_unmount
+       grep -q "\[$extsz\] $filename" <(echo $res) || \
+               _notrun "this test requires extsize support on the filesystem"
+}
+
 # Write a byte into a range of a file
 _pwrite_byte() {
        local pattern="$1"