fstests: move test group info to test files
[xfstests-dev.git] / tests / xfs / 491
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 491
6 #
7 # Test detection & fixing of bad summary block counts at mount time.
8 #
9 . ./common/preamble
10 _begin_fstest auto quick fuzz
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16
17 # Modify as appropriate.
18 _supported_fs xfs
19 _require_scratch
20
21 echo "Format and mount"
22 _scratch_mkfs > $seqres.full 2>&1
23
24 # pre-lazysbcount filesystems blindly trust the primary sb fdblocks
25 _require_scratch_xfs_features LAZYSBCOUNT
26
27 _scratch_mount >> $seqres.full 2>&1
28 echo "test file" > $SCRATCH_MNT/testfile
29
30 echo "Fuzz fdblocks"
31 _scratch_unmount
32 dblocks=$(_scratch_xfs_get_metadata_field dblocks 'sb 0')
33 _scratch_xfs_set_metadata_field fdblocks $((dblocks * 2)) 'sb 0' > $seqres.full 2>&1
34
35 echo "Detection and Correction"
36 _scratch_mount >> $seqres.full 2>&1
37 avail=$(stat -c '%a' -f $SCRATCH_MNT)
38 total=$(stat -c '%b' -f $SCRATCH_MNT)
39 echo "avail: $avail" >> $seqres.full
40 echo "total: $total" >> $seqres.full
41 test "$avail" -gt "$total" && echo "free space bad: $avail > $total"
42
43 # success, all done
44 status=0
45 exit