btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / xfs / 468
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All rights reserved.
4 #
5 # FS QA Test No. 468
6 #
7 # Populate a XFS filesystem and fuzz every bmbt block field.
8 # Do not fix the filesystem, to test metadata verifiers.
9
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 7 15
18
19 _cleanup()
20 {
21         cd /
22         rm -rf $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/populate
29 . ./common/fuzzy
30
31 # real QA test starts here
32 _supported_fs xfs
33 _require_scratch_xfs_fuzz_fields
34 _disable_dmesg_check
35
36 echo "Format and populate"
37 _scratch_populate_cached nofill > $seqres.full 2>&1
38
39 echo "Find bmbt block"
40 _scratch_mount
41 inum=$(stat -c '%i' $SCRATCH_MNT/S_IFREG.FMT_BTREE)
42 _scratch_unmount
43
44 inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "inode ${inum}")
45
46 echo "Fuzz bmbt"
47 _scratch_xfs_fuzz_metadata '' 'none'  "inode ${inum}" "addr u${inode_ver}.bmbt.ptrs[1]" >> $seqres.full
48 echo "Done fuzzing bmbt"
49
50 # success, all done
51 status=0
52 exit