From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: [PATCH] xfstests: btrfs/023: test if raids are actually created
Date: Mon, 18 Nov 2013 16:26:17 +0800 [thread overview]
Message-ID: <1384763177-3402-1-git-send-email-anand.jain@oracle.com> (raw)
A test case to verify if the given raid option for the
metadata and data are actually created.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
tests/btrfs/023 | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/023.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 94 insertions(+), 0 deletions(-)
create mode 100755 tests/btrfs/023
create mode 100644 tests/btrfs/023.out
diff --git a/tests/btrfs/023 b/tests/btrfs/023
new file mode 100755
index 0000000..77934fd
--- /dev/null
+++ b/tests/btrfs/023
@@ -0,0 +1,91 @@
+#! /bin/bash
+# FS QA Test No. 022
+#
+# Test to verify if the group profile is created
+#
+# The test aims to create the raid and verify that its created
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Oracle. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+
+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
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 4
+rm -f $seqres.full
+
+create_group_profile()
+{
+ local mkfs_options="-d$1 -m$1"
+
+ # _scratch_mkfs adds the 1st device again (which is $SCRATCH_DEV)
+ _scratch_pool_mkfs $mkfs_options >> $seqres.full 2>&1 || _fail "mkfs failed"
+}
+
+check_group_profile()
+{
+ local test_raid="$1"
+
+ _scratch_mount
+ $BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT > $tmp.tmp 2>&1
+ _scratch_unmount
+ cat $tmp.tmp >> $seqres.full
+ grep Data $tmp.tmp | grep -q $test_raid
+ [ $? -eq 0 ] || _fail "$test_raid not found for Data"
+ grep Metadata $tmp.tmp | grep -q $test_raid
+ [ $? -eq 0 ] || _fail "$test_raid not found for Metadata"
+}
+
+create_group_profile "raid0"
+check_group_profile "RAID0"
+
+create_group_profile "raid1"
+check_group_profile "RAID1"
+
+create_group_profile "raid10"
+check_group_profile "RAID10"
+
+create_group_profile "raid5"
+check_group_profile "RAID5"
+
+create_group_profile "raid6"
+check_group_profile "RAID6"
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/023.out b/tests/btrfs/023.out
new file mode 100644
index 0000000..5c4197b
--- /dev/null
+++ b/tests/btrfs/023.out
@@ -0,0 +1,2 @@
+QA output created by 023
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 410f8ed..35db67b 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -24,3 +24,4 @@
019 auto quick
020 auto quick
021 auto quick
+023 auto
--
1.7.1
next reply other threads:[~2013-11-18 8:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 8:26 Anand Jain [this message]
2013-11-18 21:50 ` [PATCH] xfstests: btrfs/023: test if raids are actually created Eric Sandeen
2013-11-19 2:08 ` Anand Jain
2013-11-19 2:29 ` [PATCH v2] " Anand Jain
2013-11-19 3:35 ` Eric Sandeen
2013-11-19 7:06 ` [PATCH] " Anand Jain
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=1384763177-3402-1-git-send-email-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=xfs@oss.sgi.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).