tests: remove udf/101
[xfstests-dev.git] / tests / generic / 296
1 #! /bin/bash
2 # FS QA Test No. 296
3 #
4 # - Create two reflinked files a byte longer than a block.
5 # - Rewrite the whole file.
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #-----------------------------------------------------------------------
23
24 seq=`basename $0`
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
27
28 here=`pwd`
29 tmp=/tmp/$$
30 status=1    # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
32
33 _cleanup()
34 {
35     cd /
36     rm -rf $tmp.*
37 }
38
39 # get standard environment, filters and checks
40 . ./common/rc
41 . ./common/filter
42 . ./common/reflink
43
44 # real QA test starts here
45 _supported_os Linux
46 _require_scratch_reflink
47 _require_cp_reflink
48
49 rm -f $seqres.full
50
51 echo "Format and mount"
52 _scratch_mkfs > $seqres.full 2>&1
53 _scratch_mount >> $seqres.full 2>&1
54
55 testdir=$SCRATCH_MNT/test-$seq
56 mkdir $testdir
57
58 blksz=65536
59 nr=128
60 filesize=$((blksz * nr))
61 bufnr=16
62 bufsize=$((blksz * bufnr))
63
64 real_blksz=$(_get_block_size "$testdir")
65 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
66
67 echo "Create the original files"
68 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file1 >> $seqres.full
69 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
70 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $bufsize 0 $((filesize + 1))" $testdir/file2.chk >> $seqres.full
71 _scratch_cycle_mount
72
73 echo "Compare files"
74 md5sum $testdir/file1 | _filter_scratch
75 md5sum $testdir/file2 | _filter_scratch
76 md5sum $testdir/file2.chk | _filter_scratch
77
78 echo "CoW and unmount"
79 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2 >> $seqres.full
80 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $real_blksz 0 $((filesize + 1))" -c "fdatasync" $testdir/file2.chk >> $seqres.full
81 _scratch_cycle_mount
82
83 echo "Compare files"
84 md5sum $testdir/file1 | _filter_scratch
85 md5sum $testdir/file2 | _filter_scratch
86 md5sum $testdir/file2.chk | _filter_scratch
87
88 # success, all done
89 status=0
90 exit