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"
35 testdir=$TEST_DIR/test-$seq
40 echo "Create the original files"
41 $XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1
42 mknod $testdir/dev1 c 1 3
45 echo "Try to copy when source pos > source size"
46 $XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy"
47 md5sum $testdir/copy | _filter_test_dir
49 echo "Try to copy to a read-only file"
51 $XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
52 md5sum $testdir/copy | _filter_test_dir
54 echo "Try to copy to an append-only file"
56 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
57 md5sum $testdir/copy | _filter_test_dir
59 echo "Try to copy to a device"
60 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/dev1"
62 echo "Try to copy to a fifo"
63 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/fifo"