xfs/029: filter out "extended-header: cycle: 1" from output
[xfstests-dev.git] / tests / xfs / 249
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. 249
6 #
7 # Ensuring that copy on write in directio mode to the source file when the
8 # CoW range covers regular unshared and regular shared blocks.
9 #   - Set cowextsz.
10 #   - Create two files.
11 #   - Reflink the odd blocks of the first file into the second file.
12 #   - dio CoW the first file across the halfway mark, starting with the
13 #     regular extent.
14 #   - Check that the files are now different where we say they're different.
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 here=`pwd`
21 tmp=/tmp/$$
22 status=1    # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27     cd /
28     rm -rf $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34 . ./common/reflink
35
36 # real QA test starts here
37 _supported_os Linux
38 _require_scratch_reflink
39 _require_xfs_io_command "falloc"
40 _require_xfs_io_command "cowextsize"
41 _require_odirect
42
43 rm -f $seqres.full
44
45 echo "Format and mount"
46 _scratch_mkfs > $seqres.full 2>&1
47 _scratch_mount >> $seqres.full 2>&1
48
49 testdir=$SCRATCH_MNT/test-$seq
50 mkdir $testdir
51
52 echo "Create the original files"
53 blksz=65536
54 nr=64
55 filesize=$((blksz * nr))
56 $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full
57 _sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
58 _scratch_cycle_mount
59
60 echo "Compare files"
61 md5sum $testdir/file1 | _filter_scratch
62 md5sum $testdir/file3 | _filter_scratch
63 md5sum $testdir/file1.chk | _filter_scratch
64
65 echo "CoW across the transition"
66 cowoff=$((filesize / 4))
67 cowsz=$((filesize / 2))
68 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
69 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
70 _scratch_cycle_mount
71
72 echo "Compare files"
73 md5sum $testdir/file1 | _filter_scratch
74 md5sum $testdir/file3 | _filter_scratch
75 md5sum $testdir/file1.chk | _filter_scratch
76
77 # success, all done
78 status=0
79 exit