From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: fstests@vger.kernel.org, guan@eryu.me, nborisov@suse.com
Subject: [PATCH v3] fstests: btrfs test if show_devname returns sprout device
Date: Mon, 20 Jul 2020 11:55:54 +0800 [thread overview]
Message-ID: <20200720035554.5549-1-anand.jain@oracle.com> (raw)
In-Reply-To: <20200719151928.GB2557159@desktop>
Test if the show_devname() returns sprout device instead of seed device.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: check for presence of needed sprout device.
v3: check for not presence of needed sprout device and break the
silence.
tests/btrfs/215 | 63 +++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/215.out | 2 ++
tests/btrfs/group | 1 +
3 files changed, 66 insertions(+)
create mode 100755 tests/btrfs/215
create mode 100644 tests/btrfs/215.out
diff --git a/tests/btrfs/215 b/tests/btrfs/215
new file mode 100755
index 000000000000..5be6d0f60192
--- /dev/null
+++ b/tests/btrfs/215
@@ -0,0 +1,63 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Oracle. All Rights Reserved.
+#
+# FS QA Test 215
+#
+# Test if the show_devname() returns sprout device instead of seed device.
+#
+# Fixed in kernel patch:
+# btrfs: btrfs_show_devname don't traverse into the seed fsid
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 2
+
+_scratch_dev_pool_get 2
+
+seed=$(echo $SCRATCH_DEV_POOL | awk '{print $1}')
+sprout=$(echo $SCRATCH_DEV_POOL | awk '{print $2}')
+
+_mkfs_dev $seed
+$BTRFS_TUNE_PROG -S 1 $seed
+_mount $seed $SCRATCH_MNT >> $seqres.full 2>&1
+cat /proc/self/mounts | grep $seed >> $seqres.full
+$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT
+cat /proc/self/mounts | grep $sprout >> $seqres.full
+
+# check if the show_devname() returns the sprout device instead of seed device.
+dev=$(grep $SCRATCH_MNT /proc/self/mounts | $AWK_PROG '{print $1}')
+
+if [ "$sprout" != "$dev" ]; then
+ echo "Unexpected device: $dev"
+fi
+echo "Silence is golden"
+
+_scratch_dev_pool_put
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/215.out b/tests/btrfs/215.out
new file mode 100644
index 000000000000..0a11773bbb32
--- /dev/null
+++ b/tests/btrfs/215.out
@@ -0,0 +1,2 @@
+QA output created by 215
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 505665b54d61..76c8b78d08f9 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -217,3 +217,4 @@
212 auto balance dangerous
213 auto balance dangerous
214 auto quick send snapshot
+215 auto quick seed
--
2.25.1
next prev parent reply other threads:[~2020-07-20 3:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 6:37 [PATCH] btrfs_show_devname don't traverse into the seed fsid Anand Jain
2020-07-10 14:32 ` Josef Bacik
2020-07-10 15:16 ` Anand Jain
2020-07-10 15:54 ` Martin K. Petersen
2020-07-13 5:48 ` [PATCH] fstests: btrfs test if show_devname returns sprout device Anand Jain
2020-07-13 7:03 ` Nikolay Borisov
2020-07-13 11:00 ` [PATCH v2] " Anand Jain
2020-07-13 11:15 ` Nikolay Borisov
2020-07-13 11:32 ` Anand Jain
2020-07-19 15:19 ` Eryu Guan
2020-07-20 3:55 ` Anand Jain [this message]
2020-07-13 14:04 ` [PATCH] btrfs_show_devname don't traverse into the seed fsid Nikolay Borisov
2020-07-15 10:21 ` David Sterba
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=20200720035554.5549-1-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/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).