git: b6da7f2fd127 - main - 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: Thu, 28 Sep 2023 20:39:40 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=b6da7f2fd127f447aa20843666b98d3a1d07b8c9
commit b6da7f2fd127f447aa20843666b98d3a1d07b8c9
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-09-28 20:25:06 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-28 20:36:12 +0000
makefs/zfs tests: Add a test case which appends to a file after import
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
---
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