git: 162787ac4947 - stable/14 - makefs/zfs tests: Add a test case which appends to a file after import
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Oct 2023 13:43:53 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=162787ac494720edcae8bf2fd26b8a8f952f55fc
commit 162787ac494720edcae8bf2fd26b8a8f952f55fc
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-09-28 20:25:06 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-04 13:42:48 +0000
makefs/zfs tests: Add a test case which appends to a file after import
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b6da7f2fd127f447aa20843666b98d3a1d07b8c9)
---
usr.sbin/makefs/tests/makefs_zfs_tests.sh | 35 +++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh
index e8da4cc87055..9173600dc555 100644
--- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh
@@ -191,6 +191,40 @@ empty_fs_cleanup()
common_cleanup
}
+atf_test_case file_extend cleanup
+file_extend_body()
+{
+ local i start
+
+ create_test_dirs
+
+ # Create a file slightly longer than the maximum block size.
+ start=132
+ dd if=/dev/random of=${TEST_INPUTS_DIR}/foo bs=1k count=$start
+ md5 -q ${TEST_INPUTS_DIR}/foo > foo.md5
+
+ atf_check $MAKEFS -s 10g -o rootpath=/ -o poolname=$ZFS_POOL_NAME \
+ $TEST_IMAGE $TEST_INPUTS_DIR
+
+ import_image
+
+ check_image_contents
+
+ i=0
+ while [ $i -lt 1000 ]; do
+ dd if=/dev/random of=${TEST_MOUNT_DIR}/foo bs=1k count=1 \
+ seek=$(($i + $start)) conv=notrunc
+ # Make sure that the first $start blocks are unmodified.
+ dd if=${TEST_MOUNT_DIR}/foo bs=1k count=$start of=foo.copy
+ atf_check -o file:foo.md5 md5 -q foo.copy
+ i=$(($i + 1))
+ done
+}
+file_extend_cleanup()
+{
+ common_cleanup
+}
+
atf_test_case file_sizes cleanup
file_sizes_body()
{
@@ -699,6 +733,7 @@ atf_init_test_cases()
atf_add_test_case dataset_removal
atf_add_test_case empty_dir
atf_add_test_case empty_fs
+ atf_add_test_case file_extend
atf_add_test_case file_sizes
atf_add_test_case hard_links
atf_add_test_case indirect_dnode_array