diff mbox series

[8/8] punch: skip fpunch tests when page size not congruent with file allocation unit

Message ID 165767383891.869123.11883992017076273427.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series fstests: check file block congruency of file range operations | expand

Commit Message

Darrick J. Wong July 13, 2022, 12:57 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Skip the generic fpunch tests on a file when the file's allocation unit
size is not congruent with the system page size.  This is needed for
testing swapfiles and mmap collisions wiht fallocate.

Assuming this edgecase configuration of an edgecase feature is
vanishingly rare, let's just _notrun the tests instead of rewriting a
ton of tests to do their integrity checking by hand.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/495 |    4 ++++
 tests/generic/503 |    4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/tests/generic/495 b/tests/generic/495
index 608f1715..5e03dfee 100755
--- a/tests/generic/495
+++ b/tests/generic/495
@@ -21,6 +21,10 @@  _require_sparse_files
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 
+blksize=$(_get_file_block_size $SCRATCH_MNT)
+test $blksize -eq $(getconf PAGE_SIZE) || \
+	_notrun "swap file allocation unit size must match page size"
+
 # We can't use _format_swapfile because we're using our custom mkswap and
 # swapon.
 touch "$SCRATCH_MNT/swap"
diff --git a/tests/generic/503 b/tests/generic/503
index a6971e63..ff3390bf 100755
--- a/tests/generic/503
+++ b/tests/generic/503
@@ -38,6 +38,10 @@  _scratch_mkfs >> $seqres.full 2>&1
 export MOUNT_OPTIONS=""
 _scratch_mount >> $seqres.full 2>&1
 
+blksize=$(_get_file_block_size $SCRATCH_MNT)
+test $blksize -eq $(getconf PAGE_SIZE) || \
+	_notrun "file block size must match page size"
+
 # real QA test starts here
 $here/src/t_mmap_collision $TEST_DIR/testfile $SCRATCH_MNT/testfile