mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: automatically add -F to xfs_io on non-xfs
The -F flag to xfs_io originally enabled it to operate on non-xfs filesystems. This restriction was removed upstream in favor of gracefully failing on the handful of operations that actually required xfs, and the option was deprecated. However, xfstests is still used on distros with older xfsprogs, and so "xfs_io -F" was necessary throughout xfstests. Simplify this by appending -F to XFS_IO_PROG when it's needed - i.e. if we're using old xfsprogs on a non-xfs filesystem. This will eliminate errors when new tests leave out the -F, and if and when -F is finally removed, there will be one central location in xfstests to update. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Acked-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
committed by
Rich Johnston
parent
2941898570
commit
96fce07867
+18
-19
@@ -311,13 +311,12 @@ _test_generic_punch()
|
||||
map_cmd=$4
|
||||
filter_cmd=$5
|
||||
testfile=$6
|
||||
xfs_io_opt=$7 #needs to be -F if not testing xfs
|
||||
|
||||
echo " 1. into a hole"
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
[ $? -ne 0 ] && die_now
|
||||
@@ -327,7 +326,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 20k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -338,7 +337,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -349,7 +348,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 8k 8k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -360,7 +359,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -371,7 +370,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 8k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -382,7 +381,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 8k" $sync_cmd \
|
||||
-c "$alloc_cmd 8k 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
@@ -394,7 +393,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -405,7 +404,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 8k" \
|
||||
-c "pwrite 8k 8k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 8k" \
|
||||
@@ -417,7 +416,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 8k 4k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -428,7 +427,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 0 8k" \
|
||||
-c "pwrite 12k 8k" $sync_cmd \
|
||||
@@ -442,7 +441,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 8k 4k" $sync_cmd \
|
||||
-c "$zero_cmd 4k 12k" \
|
||||
@@ -454,7 +453,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "$alloc_cmd 0 20k" \
|
||||
-c "pwrite 0k 8k" $sync_cmd \
|
||||
-c "pwrite 12k 8k" -c "fsync" \
|
||||
@@ -465,7 +464,7 @@ _test_generic_punch()
|
||||
|
||||
echo " 14. data -> hole @ EOF"
|
||||
rm -f $testfile
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 20k" $sync_cmd \
|
||||
-c "$zero_cmd 12k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -476,7 +475,7 @@ _test_generic_punch()
|
||||
if [ "$remove_testfile" ]; then
|
||||
rm -f $testfile
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 20k" $sync_cmd \
|
||||
-c "$zero_cmd 0k 8k" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
@@ -490,10 +489,10 @@ _test_generic_punch()
|
||||
else
|
||||
cp $testfile $testfile.2
|
||||
fi
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 8k 12k" -c "fsync" $testfile.2 \
|
||||
> /dev/null
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate 20k" \
|
||||
$XFS_IO_PROG -f -c "truncate 20k" \
|
||||
-c "pwrite 0 20k" $sync_cmd \
|
||||
-c "$zero_cmd 0k 8k" \
|
||||
-c "fadvise -d" \
|
||||
@@ -508,7 +507,7 @@ _test_generic_punch()
|
||||
rm -f $testfile
|
||||
fi
|
||||
block_size=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3`
|
||||
$XFS_IO_PROG $xfs_io_opt -f -c "truncate $block_size" \
|
||||
$XFS_IO_PROG -f -c "truncate $block_size" \
|
||||
-c "pwrite 0 $block_size" $sync_cmd \
|
||||
-c "$zero_cmd 128 128" \
|
||||
-c "$map_cmd -v" $testfile | $filter_cmd
|
||||
|
||||
@@ -2150,6 +2150,11 @@ then
|
||||
$DF_PROG $TEST_DEV
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
|
||||
xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
|
||||
export XFS_IO_PROG="$XFS_IO_PROG -F"
|
||||
|
||||
fi
|
||||
|
||||
# make sure this script returns success
|
||||
|
||||
Reference in New Issue
Block a user