generic: test adding filesystem-level fscrypt key via key_id
[xfstests-dev.git] / tests / generic / 434
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Netapp, Inc. All rights reserved.
4 #
5 # FS QA Test No. 434
6 #
7 # Tests vfs_copy_file_range() error checking
8 seq=`basename $0`
9 seqres=$RESULT_DIR/$seq
10 echo "QA output created by $seq"
11
12 here=`pwd`
13 tmp=/tmp/$$
14 status=1    # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -rf $tmp.*
21 }
22
23 # get standard environment
24 . common/rc
25 . common/filter
26
27 # real QA test starts here
28 _supported_fs generic
29 _supported_os Linux
30
31 _require_xfs_io_command "copy_range"
32 _require_test
33
34 testdir=$TEST_DIR/test-$seq
35 rm -rf $testdir
36 mkdir $testdir
37 rm -f $seqres.full
38
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
42 mkfifo $testdir/fifo
43
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
47
48 echo "Try to copy to a read-only file"
49 rm -f $testdir/copy
50 $XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
51 md5sum $testdir/copy | _filter_test_dir
52
53 echo "Try to copy to an append-only file"
54 rm -f $testdir/copy
55 $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy"
56 md5sum $testdir/copy | _filter_test_dir
57
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"
60
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"
63
64 #success, all done
65 status=0
66 exit