fstests: move test group info to test files
[xfstests-dev.git] / tests / btrfs / 172
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Facebook.  All Rights Reserved.
4 #
5 # FS QA Test 172
6 #
7 # Validate that without no-holes we do not get an i_size that is after a gap in
8 # the file extents on disk.  This is fixed by the following patches
9 #
10 #     btrfs: use the file extent tree infrastructure
11 #     btrfs: replace all uses of btrfs_ordered_update_i_size
12 #
13 . ./common/preamble
14 _begin_fstest auto quick log replay
15
16 # Import common functions.
17 . ./common/filter
18 . ./common/dmlogwrites
19
20 # real QA test starts here
21
22 # Modify as appropriate.
23 _supported_fs btrfs
24 _require_scratch
25 _require_log_writes
26 _require_xfs_io_command "sync_range"
27
28 _log_writes_init $SCRATCH_DEV
29 _log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1
30
31 # There's not a straightforward way to commit the transaction without also
32 # flushing dirty pages, so shorten the commit interval to 1 so we're sure to get
33 # a commit with our broken file
34 _log_writes_mount -o commit=1
35
36 $XFS_IO_PROG -f -c "pwrite 0 5m" $SCRATCH_MNT/file | _filter_xfs_io
37 $XFS_IO_PROG -f -c "sync_range -abw 4m 1m" $SCRATCH_MNT/file | _filter_xfs_io
38
39 # Now wait for a transaction commit to happen, wait 2x just to be super sure
40 sleep 2
41
42 _log_writes_unmount
43 _log_writes_remove
44
45 cur=$(_log_writes_find_next_fua 0)
46 echo "cur=$cur" >> $seqres.full
47 while [ ! -z "$cur" ]; do
48         _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
49
50         # We only care about the fs consistency, so just run fsck, we don't have
51         # to mount the fs to validate it
52         _check_scratch_fs
53
54         cur=$(_log_writes_find_next_fua $(($cur + 1)))
55 done
56
57 # success, all done
58 status=0
59 exit