fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 290
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. 290
6 #
7 # Ensuring that copy on write in directio mode to the source file when the
8 # CoW range covers unwritten and regular shared blocks.
9 #   - Create two files.
10 #   - fallocate the first file.
11 #   - Write the odd blocks of the first file.
12 #   - Reflink the odd blocks of the first file into the second file.
13 #   - DIO CoW the first file across the halfway mark, starting with the
14 #     regular extent.
15 #   - Check that the files are now different where we say they're different.
16 #
17 . ./common/preamble
18 _begin_fstest auto quick clone
19
20 # Import common functions.
21 . ./common/filter
22 . ./common/reflink
23
24 # real QA test starts here
25 _require_scratch_reflink
26 _require_xfs_io_command "falloc"
27 _require_odirect
28
29 echo "Format and mount"
30 _scratch_mkfs > $seqres.full 2>&1
31 _scratch_mount >> $seqres.full 2>&1
32
33 testdir=$SCRATCH_MNT/test-$seq
34 mkdir $testdir
35
36 echo "Create the original files"
37 blksz=65536
38 nr=64
39 filesize=$((blksz * nr))
40 _sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
41 _scratch_cycle_mount
42
43 echo "Compare files"
44 md5sum $testdir/file1 | _filter_scratch
45 md5sum $testdir/file3 | _filter_scratch
46 md5sum $testdir/file1.chk | _filter_scratch
47
48 echo "CoW across the transition"
49 cowoff=$((filesize / 4))
50 cowsz=$((filesize / 2))
51 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full
52 _pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full
53 _scratch_cycle_mount
54
55 echo "Compare files"
56 md5sum $testdir/file1 | _filter_scratch
57 md5sum $testdir/file3 | _filter_scratch
58 md5sum $testdir/file1.chk | _filter_scratch
59
60 # success, all done
61 status=0
62 exit