From patchwork Fri Aug 24 08:08:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 1370021 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id ECAE7DF264 for ; Fri, 24 Aug 2012 08:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754742Ab2HXIIo (ORCPT ); Fri, 24 Aug 2012 04:08:44 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:5952 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753839Ab2HXIIj (ORCPT ); Fri, 24 Aug 2012 04:08:39 -0400 X-IronPort-AV: E=Sophos;i="4.77,818,1336320000"; d="scan'208";a="5714483" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 24 Aug 2012 16:07:30 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id q7O88a8E032327; Fri, 24 Aug 2012 16:08:36 +0800 Received: from [10.167.225.199] ([10.167.225.199]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012082416083257-481786 ; Fri, 24 Aug 2012 16:08:32 +0800 Message-ID: <50373668.3000804@cn.fujitsu.com> Date: Fri, 24 Aug 2012 16:08:08 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Linux Btrfs , xfs@oss.sgi.com CC: anand.jain@oracle.com, Dave Chinner Subject: [PATCH V2 3/3] xfstests: fix wrong number of the required devices and wrong deletable device check method for case 265 References: <5036F1FB.80205@cn.fujitsu.com> In-Reply-To: <5036F1FB.80205@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/08/24 16:08:32, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/08/24 16:08:34, Serialize complete at 2012/08/24 16:08:34 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Case 265 need 4 devices to test RAID10, so we need 4 or more devices not 2. And the deletable device check method is also wrong, the virtual devices in the VMs which are drived by virtio are also not deletable(no delete entry point), but it is not managed in the virtual directory in sysfs, so the current method will make a mistake and thinks they are deletable. Fix it by check the delete entry point. This fix method can also avoid the users use partitions to run case 265. Signed-off-by: Miao Xie --- Changelog v1 -> v2: - drop the independent device check - modify the deletable device check - do not modify README --- 265 | 2 +- common.rc | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/265 b/265 index ec8410c..0687b62 100755 --- a/265 +++ b/265 @@ -50,7 +50,7 @@ _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch -_require_scratch_dev_pool +_require_scratch_dev_pool 4 _require_deletable_scratch_dev_pool # Test cases related to raid in btrfs diff --git a/common.rc b/common.rc index 602513a..a254e0e 100644 --- a/common.rc +++ b/common.rc @@ -1695,16 +1695,20 @@ _test_inode_extsz() _require_scratch_dev_pool() { local i + local ndevs=$1 if [ -z "$SCRATCH_DEV_POOL" ]; then _notrun "this test requires a valid \$SCRATCH_DEV_POOL" fi - # btrfs test case needs 2 or more scratch_dev_pool; other FS not sure + # btrfs test case needs scratch_dev_pool; other FS not sure # so fail it case $FSTYP in btrfs) - if [ "`echo $SCRATCH_DEV_POOL|wc -w`" -lt 2 ]; then - _notrun "btrfs and this test needs 2 or more disks in SCRATCH_DEV_POOL" + # We have moved a device from SCRATCH_DEV_POOL tp SCRATCH_DEV, + # so we must make it into account. + if [ $((`echo $SCRATCH_DEV_POOL | wc -w` + 1)) -lt $ndevs ] + then + _notrun "btrfs and this test needs $ndevs or more disks in SCRATCH_DEV_POOL" fi ;; *) @@ -1731,17 +1735,15 @@ _require_scratch_dev_pool() done } -# We will check if the device is virtual (eg: loop device) since it does not -# have the delete entry-point. Otherwise SCSI and USB devices are fine. +# We will check if the device is deletable. _require_deletable_scratch_dev_pool() { local i local x for i in $SCRATCH_DEV_POOL; do x=`echo $i | cut -d"/" -f 3` - ls -l /sys/class/block/${x} | grep -q "virtual" - if [ $? == "0" ]; then - _notrun "$i is a virtual device which is not deletable" + if [ ! -f /sys/class/block/${x}/device/delete ]; then + _notrun "$i is a device which is not deletable" fi done }