lib/: spdx license conversion
[xfstests-dev.git] / tests / generic / 203
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 203
6 #
7 # See what happens if we DIO CoW across not-block-aligned EOF.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -rf $tmp.* $testdir
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/reflink
28
29 # real QA test starts here
30 _supported_os Linux
31 _require_scratch_reflink
32 _require_cp_reflink
33 _require_odirect
34
35 rm -f $seqres.full
36
37 echo "Format and mount"
38 _scratch_mkfs > $seqres.full 2>&1
39 _scratch_mount >> $seqres.full 2>&1
40
41 testdir=$SCRATCH_MNT/test-$seq
42 mkdir $testdir
43
44 echo "Create the original files"
45 blksz=65536
46 _pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file1 >> $seqres.full
47 _cp_reflink $testdir/file1 $testdir/file2
48 _pwrite_byte 0x61 0 $((blksz + 17)) $testdir/file2.chk >> $seqres.full
49 _scratch_cycle_mount
50
51 echo "Compare files"
52 md5sum $testdir/file1 | _filter_scratch
53 md5sum $testdir/file2 | _filter_scratch
54 md5sum $testdir/file2.chk | _filter_scratch
55
56 echo "CoW and unmount"
57 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 $blksz $blksz" $testdir/file2 >> $seqres.full
58 $XFS_IO_PROG -f -c "pwrite -S 0x63 $blksz $blksz" $testdir/file2.chk >> $seqres.full
59 _scratch_cycle_mount
60
61 echo "Compare files"
62 md5sum $testdir/file1 | _filter_scratch
63 md5sum $testdir/file2 | _filter_scratch
64 md5sum $testdir/file2.chk | _filter_scratch
65
66 # success, all done
67 status=0
68 exit