common: kill _supported_os
[xfstests-dev.git] / tests / btrfs / 139
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 SUSE. All Rights Reserved.
4 #
5 # FS QA Test 139
6 #
7 # Check if btrfs quota limits are not reached when you constantly
8 # create and delete files within the exclusive qgroup limits.
9 #
10 # Finally we create files to exceed the quota.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 _supported_fs btrfs
35 # We at least need 2GB of free space on $SCRATCH_DEV
36 _require_scratch_size $((2 * 1024 * 1024))
37
38 _scratch_mkfs > /dev/null 2>&1
39 _scratch_mount
40
41 SUBVOL=$SCRATCH_MNT/subvol
42
43 _run_btrfs_util_prog subvolume create $SUBVOL
44 _run_btrfs_util_prog quota enable $SCRATCH_MNT
45 _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
46 _run_btrfs_util_prog qgroup limit -e 1G $SUBVOL
47
48
49 # Write and delete files within 1G limits, multiple times
50 for i in $(seq 1 5); do
51         for j in $(seq 1 240); do
52                 $XFS_IO_PROG -f -c "pwrite 0 4m" $SUBVOL/file_$j > /dev/null
53         done
54         rm -f $SUBVOL/file*
55 done
56
57 # Exceed the limits here
58 for j in $(seq 1 8); do
59         $XFS_IO_PROG -f -c "pwrite 0 128m" $SUBVOL/file_$j 2>&1 | _filter_xfs_io | _filter_xfs_io_error
60 done
61
62 # success, all done
63 status=0
64 exit