xfs: Add test for too-small device with stripe geometry
[xfstests-dev.git] / tests / btrfs / 210
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test 210
6 #
7 # Test that a new snapshot created with qgroup inherit passed should mark
8 # qgroup numbers inconsistent.
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 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous $seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33
34 # Modify as appropriate.
35 _supported_fs btrfs
36 _require_scratch
37
38 _scratch_mkfs >/dev/null
39 _scratch_mount
40
41 $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/src" > /dev/null
42 _pwrite_byte 0xcd 0 16M "$SCRATCH_MNT/src/file" > /dev/null
43
44 # Sync the fs to ensure data written to disk so that they can be accounted
45 # by qgroup
46 sync
47 $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT"
48 $BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
49 $BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT"
50
51 # Create a snapshot with qgroup inherit
52 $BTRFS_UTIL_PROG subvolume snapshot -i 1/0 "$SCRATCH_MNT/src" \
53         "$SCRATCH_MNT/snapshot" > /dev/null
54
55 echo "Silence is golden"
56 # If qgroup is not marked inconsistent automatically, btrfs check would
57 # report error.
58
59 # success, all done
60 status=0
61 exit