fstests: add missing checks of fallocate feature
authorNaohiro Aota <naohiro.aota@wdc.com>
Fri, 23 Apr 2021 11:26:31 +0000 (20:26 +0900)
committerEryu Guan <guaneryu@gmail.com>
Sun, 25 Apr 2021 08:20:43 +0000 (16:20 +0800)
Many test cases use xfs_io -c 'falloc' but forgot to add
_require_xfs_io_command "falloc". This will fail the test case if we
run the test case on a file system without fallcoate support e.g.
F2FS.

While we believe that normal fallocate(mode = 0) is always supported
on Linux, it is not true. Fallocate is disabled in several
implementations of zoned block support for file systems because the
pre-allocated region will break the sequential writing rule.

Currently, several test cases unconditionally call fallocate().
Let's add _require_xfs_io_command "falloc" to properly check the
feature is supported by a testing file system.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 files changed:
tests/btrfs/013
tests/btrfs/016
tests/btrfs/025
tests/btrfs/034
tests/btrfs/037
tests/btrfs/046
tests/btrfs/107
tests/ext4/001
tests/f2fs/001
tests/generic/456
tests/xfs/042
tests/xfs/114
tests/xfs/118
tests/xfs/331
tests/xfs/341
tests/xfs/342
tests/xfs/423

index 9252c82..5e03ed4 100755 (executable)
@@ -33,6 +33,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 rm -f $seqres.full
 
index 8fd237c..015ec17 100755 (executable)
@@ -35,6 +35,7 @@ _supported_fs btrfs
 _require_test
 _require_scratch
 _require_fssum
+_require_xfs_io_command "falloc"
 
 _scratch_mkfs > /dev/null 2>&1
 
index 42cd7ce..5c81405 100755 (executable)
@@ -31,6 +31,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 rm -f $seqres.full
 
index bc7a4aa..07c84c3 100755 (executable)
@@ -28,6 +28,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 rm -f $seqres.full
 
index 1cfaf5b..9ef199a 100755 (executable)
@@ -35,6 +35,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 rm -f $seqres.full
 
index 882db8e..a1d82e1 100755 (executable)
@@ -37,6 +37,7 @@ _cleanup()
 _supported_fs btrfs
 _require_test
 _require_scratch
+_require_xfs_io_command "falloc"
 _require_fssum
 
 rm -f $seqres.full
index e57c9de..80db5ab 100755 (executable)
@@ -34,6 +34,7 @@ rm -f $seqres.full
 
 _supported_fs btrfs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 # Use 64K file size to match any sectorsize
 # And with a unaligned tailing range to ensure it will be at least 2 pages
index bbb74f1..9650303 100755 (executable)
@@ -29,6 +29,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
 _supported_fs ext4
+_require_xfs_io_command "falloc"
 _require_xfs_io_command "fzero"
 _require_test
 
index 98bd268..0753a09 100755 (executable)
@@ -36,6 +36,7 @@ _cleanup()
 
 _supported_fs f2fs
 _require_scratch
+_require_xfs_io_command "falloc"
 
 testfile=$SCRATCH_MNT/testfile
 dummyfile=$SCRATCH_MNT/dummyfile
index 2f9df5e..65667d4 100755 (executable)
@@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs generic
 _require_scratch
+_require_xfs_io_command "falloc"
 _require_dm_target flakey
 _require_xfs_io_command "falloc" "-k"
 _require_xfs_io_command "fzero"
index b55d642..fcd5181 100755 (executable)
@@ -31,6 +31,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
 _supported_fs xfs
+_require_xfs_io_command "falloc"
 
 _require_scratch
 
index b936452..3f5575a 100755 (executable)
@@ -32,6 +32,7 @@ _cleanup()
 _supported_fs xfs
 _require_test_program "punch-alternating"
 _require_xfs_scratch_rmapbt
+_require_xfs_io_command "falloc"
 _require_xfs_io_command "fcollapse"
 _require_xfs_io_command "finsert"
 
index 5e23617..9a43182 100755 (executable)
@@ -41,6 +41,7 @@ _supported_fs xfs
 
 _require_scratch
 _require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_xfs_io_command "falloc"
 
 # 50M
 _scratch_mkfs_sized $((50 * 1024 * 1024)) >> $seqres.full 2>&1
index 4ea54e2..8e92b2e 100755 (executable)
@@ -33,6 +33,7 @@ _require_xfs_scratch_rmapbt
 _require_scratch_reflink
 _require_xfs_io_command "falloc"
 _require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
index e1fbe58..8bf0508 100755 (executable)
@@ -31,6 +31,7 @@ _require_realtime
 _require_xfs_scratch_rmapbt
 _require_test_program "punch-alternating"
 _disable_dmesg_check
+_require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
index 2be5f76..4db222d 100755 (executable)
@@ -30,6 +30,7 @@ _supported_fs xfs
 _require_realtime
 _require_xfs_scratch_rmapbt
 _require_test_program "punch-alternating"
+_require_xfs_io_command "falloc"
 
 rm -f "$seqres.full"
 
index 8d51a9a..183c9cf 100755 (executable)
@@ -35,6 +35,7 @@ _cleanup()
 _supported_fs xfs
 _require_test_program "punch-alternating"
 _require_xfs_io_command "scrub"
+_require_xfs_io_command "falloc"
 _require_scratch
 
 echo "Format and populate"