generic: add test for boundary in xfs_attr_shortform_verify
[xfstests-dev.git] / tests / generic / 610
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. 610
6 #
7 # Test a fallocate() zero range operation against a large file range for which
8 # there are many small extents allocated. Verify the operation does not fail
9 # and the respective range return zeroes on subsequent reads.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
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 -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30 _supported_os Linux
31 _require_scratch
32 _require_xfs_io_command "fzero"
33 _require_xfs_io_command "fpunch"
34 _require_test_program "punch-alternating"
35
36 rm -f $seqres.full
37
38 _scratch_mkfs >>$seqres.full 2>&1
39 _scratch_mount
40
41 # Create a file with many small extents. To speed up file creation, do
42 # buffered writes and then punch a hole on every other block.
43 $XFS_IO_PROG -f -c "pwrite -S 0xab -b 10M 0 100M" \
44         $SCRATCH_MNT/foobar >>$seqres.full
45 $here/src/punch-alternating $SCRATCH_MNT/foobar >>$seqres.full
46
47 # For btrfs, trigger a transaction commit to force metadata COW for the
48 # following fallocate zero range operation.
49 sync
50
51 $XFS_IO_PROG -c "fzero 0 100M" $SCRATCH_MNT/foobar
52
53 # Check the file content after umounting and mounting again the fs, to verify
54 # everything was persisted.
55 _scratch_cycle_mount
56
57 echo "File content after zero range operation:"
58 od -A d -t x1 $SCRATCH_MNT/foobar
59
60 status=0
61 exit