generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 420
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Calvin Owens.  All Rights Reserved.
4 #
5 # FS QA Test 420
6 #
7 # Verify fallocate(mode=FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE) does
8 # not alter the file size.
9 #
10 . ./common/preamble
11 _begin_fstest auto quick punch
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17
18 # Modify as appropriate.
19 _supported_fs generic
20 _require_test
21 _require_xfs_io_command fpunch
22
23 testfile="${TEST_DIR}/testfile.$seq"
24
25 echo "Testing fallocate(mode=FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE)"
26 $XFS_IO_PROG -f -t -c "pwrite -b 2048 0 2048" $testfile | head -n1
27 # fpunch from xfs_io has KEEP_SIZE flag set
28 $XFS_IO_PROG -c "fpunch 2048 2048" $testfile
29 $XFS_IO_PROG -c "stat" $testfile | grep -F 'stat.size'
30
31 # success, all done
32 status=0
33 exit