btrfs: convert tests to SPDX license tags
[xfstests-dev.git] / tests / btrfs / 014
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/014
6 #
7 # Btrfs balance tests
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here="`pwd`"
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16
17 _create_snapshot()
18 {
19         for i in $(seq 20)
20         do
21                 $BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snapshot0 >/dev/null
22                 $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/snapshot0 >/dev/null
23         done
24 }
25
26 _balance()
27 {
28         for i in $(seq 20)
29         do
30                 $BTRFS_UTIL_PROG balance start $SCRATCH_MNT >/dev/null
31         done
32 }
33
34 #get standard environment, filters and checks
35 . ./common/rc
36 . ./common/filter
37
38 # real QA test starts here
39 _supported_fs btrfs
40 _supported_os Linux
41
42 _require_scratch
43 _scratch_mkfs >/dev/null 2>&1
44 _scratch_mount
45
46 echo "Tip: Run dmesg to see the error on failure"
47
48 _create_snapshot &
49
50 _balance &
51
52 wait
53
54 status=0
55 exit