From patchwork Tue Nov 19 07:06:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 3200301 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E356AC045B for ; Tue, 19 Nov 2013 06:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12C0720347 for ; Tue, 19 Nov 2013 06:57:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12419202FF for ; Tue, 19 Nov 2013 06:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751381Ab3KSG5f (ORCPT ); Tue, 19 Nov 2013 01:57:35 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:24796 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796Ab3KSG5f (ORCPT ); Tue, 19 Nov 2013 01:57:35 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAJ6vSks019803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Nov 2013 06:57:29 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAJ6vR5N023461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Nov 2013 06:57:28 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAJ6vRKl009446; Tue, 19 Nov 2013 06:57:27 GMT Received: from wish.sg.oracle.com (/10.186.101.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 Nov 2013 22:57:27 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com Cc: sandeen@sandeen.net Subject: [PATCH] xfstests: btrfs/023: test if raids are actually created Date: Tue, 19 Nov 2013 15:06:25 +0800 Message-Id: <1384844785-24799-1-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 1.8.1.164.g2d0029e In-Reply-To: <1384763177-3402-1-git-send-email-anand.jain@oracle.com> References: <1384763177-3402-1-git-send-email-anand.jain@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A test case to verify if the given raid option for the metadata and data are actually created. Signed-off-by: Anand Jain Reviewed-by: Eric Sandeen --- v3: need to differentiate between RAID10 and RAID1 in the output, fixed the grep v2: a copied comment removed as Eric pointed out tests/btrfs/023 | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/023.out | 2 + tests/btrfs/group | 1 + 3 files changed, 93 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..da1f818 --- /dev/null +++ b/tests/btrfs/023 @@ -0,0 +1,90 @@ +#! /bin/bash +# FS QA Test No. 023 +# +# 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_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