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