Files
apfstests/130
T
Christoph Hellwig 77fe563a78 xfstests: add _require_sparse_files
Add a helper to check if the filesystem supports sparse files.  This is
used to guard tests that exercise sparse file functionality and would
take forever on filesystems that have to zero all blocks on extending
truncates.

Unfortunately there's no good way to autodetect this functionality, so
just implement it as a blacklist for now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2010-11-09 14:53:36 +01:00

261 lines
7.5 KiB
Bash
Executable File

#! /bin/bash
# FSQA Test No. 130
#
# xfs_io vector read/write and trunc tests. modified from cxfsqa tests
# - unixfile_basic_block_hole
# - unixfile_buffer_direct_coherency
# - unixfile_direct_rw
# - unixfile_eof_direct
# - unixfile_fsb_edge
# - unixfile_open_append
# - unixfile_open_trunc
# - unixfile_small_vector_async_rw
# - unixfile_small_vector_sync_rw
#
#-----------------------------------------------------------------------
# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#-----------------------------------------------------------------------
#
# creator
owner=allanr@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
_cleanup_testdir
}
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
# real QA test starts here
_supported_fs generic
_supported_os Linux IRIX
_require_scratch
_require_sparse_files
_setup_testdir
_scratch_mkfs >/dev/null 2>&1
_scratch_mount
echo "End-of-file zeroing with direct I/O"
xfs_io -F -f -d -t -c "pwrite -S 0x63 0 65536" \
-c "truncate 1" \
-c "pwrite -S 0x41 65536 65536" \
-c "pread -v 0 131072" \
$SCRATCH_MNT/eof-zeroing_direct | _filter_xfs_io_unique
echo
echo "Basic Block Hole test"
xfs_io -F -f -t -c "truncate 8192" \
-c "pread -v 5000 3000" \
$SCRATCH_MNT/blackhole | _filter_xfs_io_unique
echo
echo "Test buffered and direct IO coherency"
xfs_io -F -f -t -c "pwrite -S 0x41 8000 1000" \
-c "pwrite -S 0x57 4000 1000" \
$SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
xfs_io -F -d -c "pwrite -S 0x78 20480 4096"\
-c "pwrite -S 0x79 4096 4096"\
$SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
xfs_io -F -c "pread -v 0 9000"\
$SCRATCH_MNT/buff_direct_coherency | _filter_xfs_io_unique
echo
echo "Test direct read and write"
xfs_io -F -f -d -t -c "pwrite -S 0x78 0 65536"\
-c "pread -v 0 65536"\
-c "pwrite -S 0x46 65536 6553600"\
-c "pread -v 0 6619136"\
$SCRATCH_MNT/direct_io | _filter_xfs_io_unique
xfs_io -F -d -c "pread -v 0 6619136"\
$SCRATCH_MNT/direct_io | _filter_xfs_io_unique
xfs_io -F -f -d -t -c "pwrite -S 0x61 0 65536"\
-c "pread -v 0 65536"\
-c "pwrite -S 0x62 65536 131072"\
-c "pread -v 0 131072"\
$SCRATCH_MNT/async_direct_io | _filter_xfs_io_unique
xfs_io -F -d -c "pread -v 0 131072"\
$SCRATCH_MNT/async_direct_io | _filter_xfs_io_unique
echo
echo "FSB Edge test"
xfs_io -F -f -t -c "truncate 131072"\
-c "pwrite -S 0x5F 0 131072"\
-c "truncate 0"\
-c "truncate 131072"\
-c "pwrite -S 0x61 65535 2"\
-c "pread -v 0 131072"\
$SCRATCH_MNT/fsb_edge_test | _filter_xfs_io_unique
echo
echo "Open Trunk test (O_TRUNC)"
for n in 0 1 2 3 4
do
xfs_io -F -f -t -c "pread -v 0 100" $SCRATCH_MNT/$n | _filter_xfs_io_unique
echo "Test" > $SCRATCH_MNT/$n
xfs_io -F -f -t -c "pread -v 0 100" $SCRATCH_MNT/$n | _filter_xfs_io_unique
cat $SCRATCH_MNT/$n
done
echo "DONE"
echo
echo "Append test"
echo "append to me" > $SCRATCH_MNT/append
xfs_io -F -a -c "pwrite -S 0x61 0 10" \
-c "pread -v 0 24"\
$SCRATCH_MNT/append | _filter_xfs_io_unique
echo
echo "Small Vector Async"
echo "abcdefghijklmnopqrstuvwxyz" > $SCRATCH_MNT/small_vector_async
xfs_io -F -f -c "pread -v 0 1"\
-c "pread -v 1 1"\
-c "pread -v 2 1"\
-c "pread -v 3 1"\
-c "pread -v 4 1"\
-c "pread -v 5 1"\
-c "pread -v 6 1"\
-c "pread -v 7 1"\
-c "pread -v 8 1"\
-c "pread -v 9 1"\
-c "pread -v 10 1"\
-c "pread -v 11 1"\
-c "pread -v 12 1"\
-c "pread -v 13 13"\
-c "pwrite -S 0x61 4090 1"\
-c "pwrite -S 0x62 4091 1"\
-c "pwrite -S 0x63 4092 1"\
-c "pwrite -S 0x64 4093 1"\
-c "pwrite -S 0x65 4094 1"\
-c "pwrite -S 0x66 4095 1"\
-c "pwrite -S 0x67 4096 1"\
-c "pwrite -S 0x68 4097 1"\
-c "pwrite -S 0x69 4098 1"\
-c "pwrite -S 0x6A 4099 1"\
-c "pwrite -S 0x6B 4100 1"\
-c "pwrite -S 0x6C 4101 1"\
-c "pwrite -S 0x6D 4102 1"\
-c "pwrite -S 0x6E 4103 1"\
-c "pwrite -S 0x6F 4104 1"\
-c "pwrite -S 0x70 4105 1"\
-c "pread -v 4090 4"\
-c "pread -v 4094 4"\
-c "pread -v 4098 4"\
-c "pread -v 4102 4"\
-c "pwrite -S 0x61 10000000000 1"\
-c "pwrite -S 0x62 10000000001 1"\
-c "pwrite -S 0x63 10000000002 1"\
-c "pwrite -S 0x64 10000000003 1"\
-c "pwrite -S 0x65 10000000004 1"\
-c "pwrite -S 0x66 10000000005 1"\
-c "pwrite -S 0x67 10000000006 1"\
-c "pwrite -S 0x68 10000000007 1"\
-c "pwrite -S 0x69 10000000008 1"\
-c "pwrite -S 0x6A 10000000009 1"\
-c "pwrite -S 0x6B 10000000010 1"\
-c "pwrite -S 0x6C 10000000011 1"\
-c "pwrite -S 0x6D 10000000012 1"\
-c "pwrite -S 0x6E 10000000013 1"\
-c "pwrite -S 0x6F 10000000014 1"\
-c "pwrite -S 0x70 10000000015 1"\
-c "pread -v 10000000000 4"\
-c "pread -v 10000000004 4"\
-c "pread -v 10000000008 4"\
-c "pread -v 10000000012 4"\
$SCRATCH_MNT/small_vector_async | _filter_xfs_io_unique
echo
echo "Small Vector Sync"
echo "abcdefghijklmnopqrstuvwxyz" > $SCRATCH_MNT/small_vector_async
xfs_io -F -f -s -c "pread -v 0 1"\
-c "pread -v 1 1"\
-c "pread -v 2 1"\
-c "pread -v 3 1"\
-c "pread -v 4 1"\
-c "pread -v 5 1"\
-c "pread -v 6 1"\
-c "pread -v 7 1"\
-c "pread -v 8 1"\
-c "pread -v 9 1"\
-c "pread -v 10 1"\
-c "pread -v 11 1"\
-c "pread -v 12 1"\
-c "pread -v 13 13"\
-c "pwrite -S 0x61 4090 1"\
-c "pwrite -S 0x62 4091 1"\
-c "pwrite -S 0x63 4092 1"\
-c "pwrite -S 0x64 4093 1"\
-c "pwrite -S 0x65 4094 1"\
-c "pwrite -S 0x66 4095 1"\
-c "pwrite -S 0x67 4096 1"\
-c "pwrite -S 0x68 4097 1"\
-c "pwrite -S 0x69 4098 1"\
-c "pwrite -S 0x6A 4099 1"\
-c "pwrite -S 0x6B 4100 1"\
-c "pwrite -S 0x6C 4101 1"\
-c "pwrite -S 0x6D 4102 1"\
-c "pwrite -S 0x6E 4103 1"\
-c "pwrite -S 0x6F 4104 1"\
-c "pwrite -S 0x70 4105 1"\
-c "pread -v 4090 4"\
-c "pread -v 4094 4"\
-c "pread -v 4098 4"\
-c "pread -v 4102 4"\
-c "pwrite -S 0x61 10000000000 1"\
-c "pwrite -S 0x62 10000000001 1"\
-c "pwrite -S 0x63 10000000002 1"\
-c "pwrite -S 0x64 10000000003 1"\
-c "pwrite -S 0x65 10000000004 1"\
-c "pwrite -S 0x66 10000000005 1"\
-c "pwrite -S 0x67 10000000006 1"\
-c "pwrite -S 0x68 10000000007 1"\
-c "pwrite -S 0x69 10000000008 1"\
-c "pwrite -S 0x6A 10000000009 1"\
-c "pwrite -S 0x6B 10000000010 1"\
-c "pwrite -S 0x6C 10000000011 1"\
-c "pwrite -S 0x6D 10000000012 1"\
-c "pwrite -S 0x6E 10000000013 1"\
-c "pwrite -S 0x6F 10000000014 1"\
-c "pwrite -S 0x70 10000000015 1"\
-c "pread -v 10000000000 4"\
-c "pread -v 10000000004 4"\
-c "pread -v 10000000008 4"\
-c "pread -v 10000000012 4"\
$SCRATCH_MNT/small_vector_async | _filter_xfs_io_unique
status=0
exit