common/rc: Add _require_{chown,chmod}()
[xfstests-dev.git] / tests / generic / 096
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
4 #
5 # FS QA Test 096
6 #
7 # Exercise the situation that cause ext4 to BUG_ON() when we use
8 # zero range to zero a range which starts within the isize but ends
9 # past the isize but still in the same block. This particular problem
10 # has only been seen on systems with page_size > block_size.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs generic
33 _require_scratch
34 _require_xfs_io_command "fzero"
35
36 rm -f $seqres.full
37 echo "Silence is golden"
38
39 # Use smaller scratch fs to shorten the test time
40 _scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
41 _scratch_mount
42
43 testfile=$SCRATCH_MNT/$seq.$$
44 $XFS_IO_PROG -f -c "pwrite 4096 512" -c "fzero 4351 512" $testfile >> $seqres.full 2>&1
45
46 # success, all done
47 status=0
48 exit