2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Netapp, Inc. All rights reserved.
7 # Tests vfs_copy_file_range() error checking
9 seqres=$RESULT_DIR/$seq
10 echo "QA output created by $seq"
14 status=1 # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment
27 # real QA test starts here
31 _require_xfs_io_command "copy_range"
34 testdir=$TEST_DIR/test-$seq
39 echo "Create the original files"
40 $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
41 mknod $testdir/dev1 c 1 3
44 echo "Try to copy when source pos > source size"
45 $XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy"
46 md5sum $testdir/copy | _filter_test_dir
48 echo "Try to copy to a read-only file"
50 $XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
51 md5sum $testdir/copy | _filter_test_dir
53 echo "Try to copy to an append-only file"
55 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
56 md5sum $testdir/copy | _filter_test_dir
58 echo "Try to copy to a device"
59 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/dev1"
61 echo "Try to copy to a fifo"
62 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/fifo"