From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>, <fstests@vger.kernel.org>
Subject: [PATCH] fstest: btrfs/006: Add extra check on return value and 'fi show' by device
Date: Fri, 16 Jan 2015 09:57:10 +0800 [thread overview]
Message-ID: <1421373430-21915-1-git-send-email-quwenruo@cn.fujitsu.com> (raw)
Reported in Red Hat BZ#1181627, 'btrfs fi show' on unmounted device will
return 1 even no error happens.
Introduced by: commit 2513077f
btrfs-progs: fix device missing of btrfs fi show with seed devices
Patch fixing it:
https://patchwork.kernel.org/patch/5626001/
btrfs-progs: Fix wrong return value when executing 'fi show' on
umounted device.
Reported-by: Vratislav Podzimek <vpodzime@redhat.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
tests/btrfs/006 | 51 ++++++++++++++++++++++++++++++++++++++++++++-------
tests/btrfs/006.out | 10 ++++++++++
2 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/tests/btrfs/006 b/tests/btrfs/006
index 715fd80..2d8c1c0 100755
--- a/tests/btrfs/006
+++ b/tests/btrfs/006
@@ -62,33 +62,70 @@ _scratch_pool_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
# These have to be done unmounted...?
echo "== Set filesystem label to $LABEL"
-$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL
+$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL || \
+ _fail "set lable failed"
echo "== Get filesystem label"
-$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV
+$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV || \
+ _fail "get lable failed"
+
+echo "== Show filesystem by device(offline)"
+$BTRFS_UTIL_PROG filesystem show $FIRST_POOL_DEV | \
+ _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show filesystem by device(offline) return value wrong"
echo "== Mount."
_scratch_mount
echo "== Show filesystem by label"
-$BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS
+$BTRFS_UTIL_PROG filesystem show $LABEL | \
+ _filter_btrfs_filesystem_show $TOTAL_DEVS
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show filesystem by lable return value wrong"
UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'`
echo "UUID $UUID" >> $seqres.full
echo "== Show filesystem by UUID"
-$BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
+$BTRFS_UTIL_PROG filesystem show $UUID | \
+ _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show filesystem by UUID return value wrong"
+
+echo "== Show filesystem by device(online)"
+$BTRFS_UTIL_PROG filesystem show $FIRST_POOL_DEV | \
+ _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show filesystem by UUID return value wrong"
echo "== Sync filesystem"
$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "sync filesystem failed"
+
echo "== Show device stats by mountpoint"
-$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS
+$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \
+ _filter_btrfs_device_stats $TOTAL_DEVS
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show device status return value wrong"
+
echo "== Show device stats by first/scratch dev"
$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show device status return value wrong"
+
echo "== Show device stats by second dev"
-$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \
+ sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show device status return value wrong"
+
echo "== Show device stats by last dev"
-$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \
+ sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
+[ ${PIPESTATUS[0]} -ne 0 ] && \
+ _fail "show device status return value wrong"
# success, all done
status=0
diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out
index 22bcb77..497de67 100644
--- a/tests/btrfs/006.out
+++ b/tests/btrfs/006.out
@@ -2,6 +2,11 @@
== Set filesystem label to TestLabel.006
== Get filesystem label
TestLabel.006
+== Show filesystem by device(offline)
+Label: 'TestLabel.006' uuid: <UUID>
+ Total devices <EXACTNUM> FS bytes used <SIZE>
+ devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
+
== Mount.
== Show filesystem by label
Label: 'TestLabel.006' uuid: <UUID>
@@ -13,6 +18,11 @@ Label: 'TestLabel.006' uuid: <EXACTUUID>
Total devices <EXACTNUM> FS bytes used <SIZE>
devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
+== Show filesystem by device(online)
+Label: 'TestLabel.006' uuid: <EXACTUUID>
+ Total devices <EXACTNUM> FS bytes used <SIZE>
+ devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
+
== Sync filesystem
FSSync 'SCRATCH_MNT'
== Show device stats by mountpoint
--
2.2.2
next reply other threads:[~2015-01-16 1:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 1:57 Qu Wenruo [this message]
2015-01-21 4:03 ` [PATCH] fstest: btrfs/006: Add extra check on return value and 'fi show' by device Dave Chinner
2015-01-21 4:19 ` Qu Wenruo
2015-01-21 4:54 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421373430-21915-1-git-send-email-quwenruo@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).