btrfs: convert tests to SPDX license tags
[xfstests-dev.git] / tests / btrfs / 009
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fusion IO.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/009
6 #
7 # Regression test to make sure we can't delete the default subvol
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
16 status=1        # failure is the default!
17
18 _cleanup()
19 {
20         rm -f $tmp.*
21 }
22
23 trap "_cleanup ; exit \$status" 0 1 2 3 15
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30 _supported_fs btrfs
31 _supported_os Linux
32 _require_scratch
33
34 rm -f $seqres.full
35
36 _scratch_mkfs > /dev/null 2>&1
37 _scratch_mount
38
39 $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/newvol >> $seqres.full 2>&1 \
40         || _fail "couldn't create subvol"
41 subvolid=$(_btrfs_get_subvolid $SCRATCH_MNT newvol)
42 $BTRFS_UTIL_PROG subvolume set-default $subvolid $SCRATCH_MNT >> $seqres.full 2>&1 \
43         || _fail "couldn't set default"
44 $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/newvol >> $seqres.full 2>&1
45 _scratch_unmount
46 _try_scratch_mount || _fail "mount should have succeeded"
47
48 echo "Silence is golden"
49 status=0 ; exit