generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / btrfs / 006
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/006
6 #
7 # run basic btrfs information commands in various ways
8 # sanity tests: filesystem show, label, sync, and device stats
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.btrfs
28
29 # real QA test starts here
30
31 # Modify as appropriate.
32 _supported_fs btrfs
33 _require_scratch
34 _require_scratch_dev_pool
35
36 rm -f $seqres.full
37
38 FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
39 LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'`
40 TOTAL_DEVS=`echo $SCRATCH_DEV_POOL | wc -w`
41 LABEL=TestLabel.$seq
42
43 echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seqres.full
44
45 _scratch_pool_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
46
47 # These have to be done unmounted...?
48 echo "== Set filesystem label to $LABEL"
49 $BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL
50 echo "== Get filesystem label"
51 $BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV
52
53 echo "== Mount."
54 _scratch_mount
55
56 echo "== Show filesystem by label"
57 $BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS
58 UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'`
59
60 echo "UUID $UUID" >> $seqres.full
61
62 echo "== Show filesystem by UUID"
63 $BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
64
65 echo "== Sync filesystem"
66 $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT > /dev/null
67
68 echo "== Show device stats by mountpoint"
69 $BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \
70     _filter_btrfs_device_stats $TOTAL_DEVS | \
71     _filter_spaces
72 echo "== Show device stats by first/scratch dev"
73 $BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
74     _filter_btrfs_device_stats | \
75     _filter_spaces
76 echo "== Show device stats by second dev"
77 $BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \
78     sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" | \
79     _filter_spaces
80 echo "== Show device stats by last dev"
81 $BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \
82     sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \
83     _filter_spaces
84
85 # success, all done
86 status=0
87 exit