generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 071
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2015 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. 071
6 #
7 # Test extent pre-allocation (using fallocate) into a region that already has a
8 # pre-allocated extent that ends beyond the file's size. Verify that if the fs
9 # is unmounted immediately after, the file's size and content are not lost.
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
19 _cleanup()
20 {
21         rm -f $tmp.*
22 }
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30 _supported_fs generic
31 _require_scratch
32 _require_xfs_io_command "falloc" "-k"
33
34 rm -f $seqres.full
35
36 _scratch_mkfs >> $seqres.full 2>&1
37 _scratch_mount
38
39 # Create our test file with a pre-allocated extent that doesn't increase the
40 # file's size.
41 $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo
42
43 # Write some data to our file.
44 $XFS_IO_PROG -c "pwrite -S 0xaa 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
45
46 # Now call fallocate again, but allowing it to increase the file's size and
47 # cover a range that is entirely covered by the extent that we previously
48 # pre-allocated.
49 $XFS_IO_PROG -c "falloc 0 512K" $SCRATCH_MNT/foo
50
51 # Now ummount and mount again the fs. After this we expect the file's size to
52 # be 512Kb.
53 _scratch_cycle_mount
54
55 # Now check that all data we wrote before are available and the file size is
56 # 512Kb.
57 echo "File content after remount:"
58 od -t x1 $SCRATCH_MNT/foo
59
60 status=0
61 exit