lib/: spdx license conversion
[xfstests-dev.git] / tests / generic / 031
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. generic/031
6 #
7 # Test non-aligned writes against fcollapse to ensure that partial pages are
8 # correctly written and aren't left behind causing invalidation or data
9 # corruption issues.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22     cd /
23     rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31
32 # Modify as appropriate.
33 _supported_fs generic
34 _supported_os Linux
35 _require_scratch
36 _require_xfs_io_command "fcollapse"
37
38 testfile=$SCRATCH_MNT/testfile
39
40 _scratch_mkfs > /dev/null 2>&1
41 _scratch_mount
42
43 $XFS_IO_PROG -f \
44         -c "pwrite 185332 55756" \
45         -c "fcollapse 28672 40960" \
46         -c "pwrite 133228 63394" \
47         -c "fcollapse 0 4096" \
48 $testfile | _filter_xfs_io
49
50 echo "==== Pre-Remount ==="
51 hexdump -C $testfile
52 _scratch_cycle_mount
53 echo "==== Post-Remount =="
54 hexdump -C $testfile
55
56 status=0
57 exit
58