generic: Add check for required keep_size/punch_hole/zero_range/collapse_range
[xfstests-dev.git] / tests / generic / 499
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 499
6 #
7 # Test a specific sequence of fsx operations that causes an mmap read past
8 # eof to return nonzero contents.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13 tmp=/tmp/$$
14 status=1        # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -f $tmp.*
21 }
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/punch
26
27 # real QA test starts here
28 _supported_fs generic
29 _supported_os Linux
30 _require_scratch
31 _require_xfs_io_command "falloc" "-k"
32 _require_xfs_io_command "fcollapse"
33 _require_xfs_io_command "fzero"
34
35 rm -f $seqres.full
36
37 _scratch_mkfs >>$seqres.full 2>&1
38 _scratch_mount
39
40 cat >> $tmp.fsxops << ENDL
41 fallocate 0x77e2 0x5f06 0x269a2 keep_size
42 mapwrite 0x2e7fc 0x42ba 0x3f989
43 write 0x67a9 0x714e 0x3f989
44 write 0x39f96 0x185a 0x3f989
45 collapse_range 0x36000 0x8000 0x3f989
46 mapread 0x74c0 0x1bb3 0x3e2d0
47 truncate 0x0 0x8aa2 0x3e2d0
48 zero_range 0x1265 0x783d 0x8aa2
49 mapread 0x7bd8 0xeca 0x8aa2
50 ENDL
51
52 victim=$SCRATCH_MNT/a
53 touch $victim
54 $here/ltp/fsx --replay-ops $tmp.fsxops $victim > $tmp.output 2>&1 || cat $tmp.output
55
56 echo "Silence is golden"
57 status=0
58 exit