generic: test for creating duplicate filenames in encrypted dir
[xfstests-dev.git] / tests / generic / 511
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. 511
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 _require_scratch
30 _require_xfs_io_command "falloc" "-k"
31 _require_xfs_io_command "fzero"
32
33 rm -f $seqres.full
34
35 _scratch_mkfs_sized $((1024 * 1024 * 256)) >>$seqres.full 2>&1
36 _scratch_mount
37
38 $XFS_IO_PROG -fc "pwrite 0 256m" -c fsync $SCRATCH_MNT/file >>$seqres.full 2>&1
39 rm -f $SCRATCH_MNT/file
40
41 cat >> $tmp.fsxops << ENDL
42 truncate 0x0 0x1f0d6 0x380e1
43 write 0x1ad87 0x6c99 0x180d6
44 zero_range 0x14426 0xd3aa 0x21a20 keep_size
45 mapread 0x1f69a 0x2386 0x21a20
46 ENDL
47
48 victim=$SCRATCH_MNT/a
49 touch $victim
50 $here/ltp/fsx --replay-ops $tmp.fsxops $victim > $tmp.output 2>&1 || cat $tmp.output
51
52 echo "Silence is golden"
53 status=0
54 exit