generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 578
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-newer
3 # Copyright (c) 2019, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 578
6 #
7 # Make sure that we can handle multiple mmap writers to the same file.
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_fs generic
31 _require_test_program "mmap-write-concurrent"
32 _require_command "$FILEFRAG_PROG" filefrag
33 _require_test_reflink
34 _require_cp_reflink
35
36 rm -f $seqres.full
37
38 compare() {
39         for i in $(seq 1 8); do
40                 md5sum $testdir/file$i | _filter_test_dir
41                 echo $testdir/file$i >> $seqres.full
42                 od -tx1 -Ad -c $testdir/file$i >> $seqres.full
43         done
44 }
45
46 testdir=$TEST_DIR/test-$seq
47 rm -rf $testdir
48 mkdir $testdir
49
50 echo "Create the original files"
51 blksz=65536
52 filesz=$((blksz * 4))
53 _pwrite_byte 0x61 0 $filesz $testdir/file1 >> $seqres.full
54 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
55 _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full
56 _cp_reflink $testdir/file1 $testdir/file4 >> $seqres.full
57 _reflink_range $testdir/file1 0 $testdir/file5 $blksz $filesz >> $seqres.full
58 _reflink_range $testdir/file1 0 $testdir/file6 $((blksz * 2)) $filesz >> $seqres.full
59 _reflink_range $testdir/file1 0 $testdir/file7 $((blksz * 3)) $filesz >> $seqres.full
60 _reflink_range $testdir/file1 0 $testdir/file8 $((blksz * 4)) $filesz >> $seqres.full
61 _test_cycle_mount
62
63 echo "Compare files before cow" | tee -a $seqres.full
64 compare
65
66 echo "mwrite all copies" | tee -a $seqres.full
67 off=$(( (filesz / 2) - 168 ))
68 len=337
69 $here/src/mmap-write-concurrent $len \
70                 $off $testdir/file1 \
71                 $off $testdir/file2 \
72                 $off $testdir/file3 \
73                 $off $testdir/file4 \
74                 $((off + blksz)) $testdir/file5 \
75                 $((off + (blksz * 2))) $testdir/file6 \
76                 $((off + (blksz * 3))) $testdir/file7 \
77                 $((off + (blksz * 4))) $testdir/file8 \
78                 168 $testdir/file1 \
79                 $((blksz - 168)) $testdir/file2 \
80                 $((filesz - 777)) $testdir/file3 \
81                 $(((blksz * 3) - 168)) $testdir/file4 \
82
83
84 echo "Compare files before remount" | tee -a $seqres.full
85 compare
86 _test_cycle_mount
87
88 echo "Compare files after remount" | tee -a $seqres.full
89 compare
90
91 echo "Check for non-shared extents" | tee -a $seqres.full
92 $FILEFRAG_PROG -v $testdir/file1 $testdir/file2 $testdir/file3 $testdir/file4 \
93                   $testdir/file5 $testdir/file6 $testdir/file7 $testdir/file8 \
94                   | grep '^[[:space:]]*[0-9]*:' > $testdir/fiemap
95 cat $testdir/fiemap >> $seqres.full
96 grep -q 'shared' $testdir/fiemap || \
97                 echo "Expected to find shared extents"
98
99 grep -q -v 'shared' $testdir/fiemap || \
100                 echo "Expected to find non-shared extents"
101
102 # success, all done
103 status=0
104 exit