btrfs: redirect 'btrfs device add' output to seqres.full
[xfstests-dev.git] / tests / btrfs / 216
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test 216
6 #
7 # Test if the show_devname() returns sprout device instead of seed device.
8 #
9 # Fixed in kernel patch:
10 #   btrfs: btrfs_show_devname don't traverse into the seed fsid
11
12 . ./common/preamble
13 _begin_fstest auto quick seed
14
15 # Import common functions.
16 . ./common/filter
17
18 # real QA test starts here
19 _supported_fs btrfs
20 _require_scratch_dev_pool 2
21
22 _scratch_dev_pool_get 2
23
24 seed=$(echo $SCRATCH_DEV_POOL | awk '{print $1}')
25 sprout=$(echo $SCRATCH_DEV_POOL | awk '{print $2}')
26
27 _mkfs_dev $seed
28 $BTRFS_TUNE_PROG -S 1 $seed
29 _mount $seed $SCRATCH_MNT >> $seqres.full 2>&1
30 cat /proc/self/mounts | grep $seed >> $seqres.full
31 $BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT >> $seqres.full
32 cat /proc/self/mounts | grep $sprout >> $seqres.full
33
34 # check if the show_devname() returns the sprout device instead of seed device.
35 dev=$(grep $SCRATCH_MNT /proc/self/mounts | $AWK_PROG '{print $1}')
36
37 if [ "$sprout" != "$dev" ]; then
38         echo "Unexpected device: $dev, expected $sprout"
39 fi
40 echo "Silence is golden"
41
42 _scratch_dev_pool_put
43
44 # success, all done
45 status=0
46 exit