diff mbox series

[8/9] generic/{094,225}: skip test when the xfs rt extent size is larger than 1 fsb

Message ID 161836232004.2754991.941115577343319256.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong April 14, 2021, 1:05 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

These two tests call various fallocate modes on a file and compare the
FIEMAP output to some golden output.  Unfortunately, the golden output
doesn't take into account the possibility that (on XFS) the files could be
created on a realtime volume with a large rt extent size set.

Under such a configuration, fpunch operations that are aligned to the fs
block size but not the rt extent size simply result in those blocks
being set to unwritten status.  Unfortunately, the test expects holes
and fails.  Therefore, detect the situation and skip the tests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/rc         |   10 ++++++++++
 tests/generic/094 |    5 +++++
 tests/generic/225 |    5 +++++
 3 files changed, 20 insertions(+)

Comments

Christoph Hellwig April 14, 2021, 6:20 a.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index bb54df56..b5e930de 100644
--- a/common/rc
+++ b/common/rc
@@ -4062,6 +4062,16 @@  _get_block_size()
 	stat -f -c %S $1
 }
 
+# Require that the fundamental allocation unit of a file is the same as the
+# filesystem block size.
+_require_file_block_size_equals_fs_block_size()
+{
+	local file_alloc_unit="$(_get_file_block_size $1)"
+	local fs_block_size="$(_get_block_size $1)"
+	test "$file_alloc_unit" != "$fs_block_size" && \
+		_notrun "File allocation unit is larger than a filesystem block"
+}
+
 get_page_size()
 {
 	echo $(getconf PAGE_SIZE)
diff --git a/tests/generic/094 b/tests/generic/094
index d371e951..8c292473 100755
--- a/tests/generic/094
+++ b/tests/generic/094
@@ -40,6 +40,11 @@  fiemapfile=$SCRATCH_MNT/$seq.fiemap
 
 _require_test_program "fiemap-tester"
 
+# FIEMAP test doesn't like finding unwritten blocks after it punches out
+# a partial rt extent.
+test "$FSTYP" = "xfs" && \
+	_require_file_block_size_equals_fs_block_size $fiemapfile
+
 seed=`date +%s`
 
 echo "using seed $seed" >> $seqres.full
diff --git a/tests/generic/225 b/tests/generic/225
index 1228a256..fac688df 100755
--- a/tests/generic/225
+++ b/tests/generic/225
@@ -40,6 +40,11 @@  fiemaplog=$SCRATCH_MNT/$seq.log
 
 _require_test_program "fiemap-tester"
 
+# FIEMAP test doesn't like finding unwritten blocks after it punches out
+# a partial rt extent.
+test "$FSTYP" = "xfs" && \
+	_require_file_block_size_equals_fs_block_size $fiemapfile
+
 seed=`date +%s`
 
 echo "using seed $seed" >> $fiemaplog