xfs/004: don't fail test due to realtime files
[xfstests-dev.git] / tests / xfs / 210
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 210
6 #
7 # During reflink, XFS should carry the cowextsz setting to the destination file
8 # if the destination file size is less than the size of the source file, the
9 # length is the size of the source file, both offsets are zero, and the
10 # destination does not already have a cowextsz setting.  It should not do so
11 # otherwise.
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1    # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24     cd /
25     rm -rf $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/reflink
32
33 # real QA test starts here
34 _supported_fs xfs
35 _require_scratch_reflink
36 _require_cp_reflink
37 _require_xfs_io_command "fiemap"
38 _require_xfs_io_command "cowextsize"
39
40 rm -f $seqres.full
41
42 echo "Format and mount"
43 _scratch_mkfs > $seqres.full 2>&1
44 _scratch_mount >> $seqres.full 2>&1
45
46 testdir=$SCRATCH_MNT/test-$seq
47 mkdir $testdir
48
49 echo "Create initial file"
50 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 131072" $testdir/file1 >> $seqres.full
51 $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file1 >> $seqres.full
52 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 1" $testdir/file4 >> $seqres.full
53 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file7 >> $seqres.full
54 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file9 >> $seqres.full
55 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 262144" $testdir/file10 >> $seqres.full
56
57 echo "Reflink to an empty file"
58 _reflink_range $testdir/file1 0 $testdir/file2 0 0 >> $seqres.full
59
60 echo "Reflink to an empty file that already has cowextsz"
61 $XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file3 >> $seqres.full
62 _reflink_range $testdir/file1 0 $testdir/file3 0 0 >> $seqres.full
63
64 echo "Reflink to a small file"
65 _reflink_range $testdir/file1 0 $testdir/file4 0 0 >> $seqres.full
66
67 echo "Reflink to a nonzero offset"
68 _reflink_range $testdir/file1 0 $testdir/file5 65536 0 >> $seqres.full
69
70 echo "Reflink from a nonzero offset"
71 _reflink_range $testdir/file1 65536 $testdir/file6 0 0 >> $seqres.full
72
73 echo "Reflink to a larger file"
74 _reflink_range $testdir/file1 0 $testdir/file7 0 0 >> $seqres.full
75
76 echo "Reflink less than the whole source file"
77 _reflink_range $testdir/file1 0 $testdir/file8 0 65536 >> $seqres.full
78
79 echo "cp reflink to a larger file"
80 _cp_reflink $testdir/file1 $testdir/file9 >> $seqres.full
81
82 echo "cp reflink to a larger file with cowextsize"
83 $XFS_IO_PROG -f -c "cowextsize 524288" $testdir/file10 >> $seqres.full
84 _cp_reflink $testdir/file1 $testdir/file10 >> $seqres.full
85
86 echo "Check cowextsz"
87 for i in `seq 1 10`; do
88         $XFS_IO_PROG -c "cowextsize" $testdir/file$i | _filter_scratch
89 done
90
91 # success, all done
92 status=0
93 exit