mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: add a new test case for ext4 indirect-based file
After applied this commit (864688d3), xfstests #255 will not test a
file system that cannot support fallocate(2), such as a indirect-based
file in ext4. So we need to add a new generic test case to test it.
The difference between #255 and this test case is only to use pwrite to
allocate blocks. Other filesystems should survive in this test case.
In the mean time, a new argument '-u' is added into _test_generic_punch
not to run unwritten tests.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
+86
-72
@@ -285,19 +285,25 @@ die_now()
|
||||
# Use the -d flag to not sync the file between tests.
|
||||
# This will test the handling of delayed extents
|
||||
#
|
||||
# Use the -u flag to not run unwritten tests.
|
||||
# This will eliminate some unnecessary information.
|
||||
#
|
||||
_test_generic_punch()
|
||||
{
|
||||
|
||||
remove_testfile=1
|
||||
sync_cmd="-c fsync"
|
||||
unwritten_tests=1
|
||||
OPTIND=1
|
||||
while getopts 'dk' OPTION
|
||||
while getopts 'dku' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
k) remove_testfile=
|
||||
;;
|
||||
d) sync_cmd=
|
||||
;;
|
||||
u) unwritten_tests=
|
||||
;;
|
||||
?) echo Invalid flag
|
||||
exit 1
|
||||
;;
|
||||
@@ -333,16 +339,18 @@ _test_generic_punch()
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 3. into unwritten space"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
if [ "$unwritten_tests" ]; then
|
||||
echo " 3. into unwritten space"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 4. hole -> data"
|
||||
if [ "$remove_testfile" ]; then
|
||||
@@ -355,16 +363,18 @@ _test_generic_punch()
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 5. hole -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
if [ "$unwritten_tests" ]; then
|
||||
echo " 5. hole -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 6. data -> hole"
|
||||
if [ "$remove_testfile" ]; then
|
||||
@@ -377,40 +387,42 @@ _test_generic_punch()
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 7. data -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 8k" $sync_cmd \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
if [ "$unwritten_tests" ]; then
|
||||
echo " 7. data -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 8k" $sync_cmd \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 8. unwritten -> hole"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
echo " 8. unwritten -> hole"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 9. unwritten -> data"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
echo " 9. unwritten -> data"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "pwrite 8k 8k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "pwrite 8k 8k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 10. hole -> data -> hole"
|
||||
if [ "$remove_testfile" ]; then
|
||||
@@ -437,30 +449,32 @@ _test_generic_punch()
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 12. unwritten -> data -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 8k 4k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
if [ "$unwritten_tests" ]; then
|
||||
echo " 12. unwritten -> data -> unwritten"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 8k 4k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 13. data -> unwritten -> data"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
echo " 13. data -> unwritten -> data"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 0k 8k" $sync_cmd \
|
||||
-c "pwrite 12k 8k" -c "fsync" \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
fi
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 0k 8k" $sync_cmd \
|
||||
-c "pwrite 12k 8k" -c "fsync" \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
_md5_checksum $testfile
|
||||
|
||||
echo " 14. data -> hole @ EOF"
|
||||
rm -f $testfile
|
||||
|
||||
Reference in New Issue
Block a user