summaryrefslogtreecommitdiff
path: root/tests/fsck-tests
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-06-16 09:43:23 +0800
committerDavid Sterba <dsterba@suse.com>2017-06-26 17:10:02 +0200
commitbb305ae832c4864af85339a3d4947394d4edfb1d (patch)
treef61253a3f65ccd9be28d17e5175a2b13872fa315 /tests/fsck-tests
parent163ca0e431a72bc48c52c2fd9132e32616b9036a (diff)
btrfs-progs: tests: Add test case to check file hole extents with NO_HOLES flag
Add test case which we have NO_HOLES incompat flag while still have hole file extent. This can be created by enabling NO_HOLES feature on an existing filesystem, which lowmem mode would cause false alert for it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ minor adjustments ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/fsck-tests')
-rwxr-xr-xtests/fsck-tests/025-file-extents/test.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/fsck-tests/025-file-extents/test.sh b/tests/fsck-tests/025-file-extents/test.sh
index e4bc4247..ebe8a305 100755
--- a/tests/fsck-tests/025-file-extents/test.sh
+++ b/tests/fsck-tests/025-file-extents/test.sh
@@ -5,8 +5,10 @@ source "$TOP/tests/common"
check_prereq btrfs
check_prereq mkfs.btrfs
+check_prereq btrfstune
check_global_prereq dd
check_global_prereq fallocate
+check_global_prereq truncate
setup_root_helper
prepare_test_dev 128M
@@ -38,5 +40,21 @@ test_compressed_inline_extent()
run_check "$TOP/btrfs" check "$TEST_DEV"
}
+# File extent hole with NO_HOLES incompat feature set.
+# Lowmem mode will cause a false alert as it doesn't allow any file hole
+# extents, while we can set NO_HOLES at anytime we want, it's definitely a
+# false alert
+test_hole_extent_with_no_holes_flag()
+{
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+ run_check_mount_test_dev
+
+ run_check $SUDO_HELPER truncate -s 16K "$TEST_MNT/tmp"
+ run_check_umount_test_dev
+ run_check $SUDO_HELPER "$TOP/btrfstune" -n "$TEST_DEV"
+ run_check "$TOP/btrfs" check "$TEST_DEV"
+}
+
test_paritical_write_into_prealloc
test_compressed_inline_extent
+test_hole_extent_with_no_holes_flag