0ffafa0615d270861954c26c46a0fdcd08bc8d9d
[xfstests-dev.git] / tests / btrfs / 090
1 #! /bin/bash
2 # FS QA Test No. btrfs/090
3 #
4 # Check return value of "btrfs filesystem show" command executed on
5 # umounted device.
6 # It should return 0 if nothing wrong happens.
7 #
8 # Regression in v3.18 btrfs-progs and fixed by the following patch:
9 #
10 #    btrfs-progs: Fix wrong return value when executing 'fi show' on
11 #    umounted device.
12 #
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2015 Fujitsu, Inc.  All Rights Reserved.
15 #
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
19 #
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28 #-----------------------------------------------------------------------
29 #
30
31 seq=`basename $0`
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 _cleanup()
41 {
42     cd /
43     rm -f $tmp.*
44 }
45
46 # get standard environment, filters and checks
47 . ./common/rc
48 . ./common/filter.btrfs
49
50 # real QA test starts here
51
52 # Modify as appropriate.
53 _supported_fs btrfs
54 _supported_os Linux
55 _require_scratch
56 _require_scratch_dev_pool
57
58 rm -f $seqres.full
59
60 FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
61 TOTAL_DEVS=`echo $SCRATCH_DEV_POOL | wc -w`
62
63 _scratch_pool_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
64
65 _run_btrfs_util_prog filesystem show $FIRST_POOL_DEV | \
66         _filter_btrfs_filesystem_show $TOTAL_DEVS
67
68 # success, all done
69 echo "Silence is golden"
70 status=0
71 exit