From patchwork Tue Nov 21 03:57:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 10067631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48677603FA for ; Tue, 21 Nov 2017 03:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32349290D6 for ; Tue, 21 Nov 2017 03:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26D3529170; Tue, 21 Nov 2017 03:58:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F58029157 for ; Tue, 21 Nov 2017 03:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752358AbdKUD57 (ORCPT ); Mon, 20 Nov 2017 22:57:59 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:23829 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752526AbdKUD57 (ORCPT ); Mon, 20 Nov 2017 22:57:59 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="30331690" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 21 Nov 2017 11:57:57 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 89923486A858 for ; Tue, 21 Nov 2017 11:57:53 +0800 (CST) Received: from localhost.localdomain (10.167.220.81) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 21 Nov 2017 11:57:54 +0800 From: Xiao Yang To: CC: Xiao Yang Subject: [PATCH] common/rc: update _require_dm_target() helper Date: Tue, 21 Nov 2017 11:57:51 +0800 Message-ID: <1511236671-5835-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.81] X-yoursite-MailScanner-ID: 89923486A858.A8896 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 1) generic/459 should be skipped when dm_snapshot is not supported. 2) update _require_dm_target() to handle multiple dm targets Signed-off-by: Xiao Yang --- common/dmhugedisk | 3 +-- common/rc | 16 ++++++++-------- doc/requirement-checking.txt | 6 +++--- tests/generic/459 | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/common/dmhugedisk b/common/dmhugedisk index 4d3b63f..1c116c2 100644 --- a/common/dmhugedisk +++ b/common/dmhugedisk @@ -23,8 +23,7 @@ _require_dmhugedisk() { - _require_dm_target zero - _require_dm_target snapshot + _require_dm_target zero snapshot } _dmhugedisk_init() diff --git a/common/rc b/common/rc index 4c053a5..6fe0ce9 100644 --- a/common/rc +++ b/common/rc @@ -1782,23 +1782,23 @@ _require_sane_bdev_flush() fi } -# this test requires a specific device mapper target +# this test requires specific device mapper targets _require_dm_target() { - _target=$1 - # require SCRATCH_DEV to be a valid block device with sane BLKFLSBUF # behaviour _require_block_device $SCRATCH_DEV _require_sane_bdev_flush $SCRATCH_DEV _require_command "$DMSETUP_PROG" dmsetup - modprobe dm-$_target >/dev/null 2>&1 + for _target in "$@"; do + modprobe dm-$_target >/dev/null 2>&1 - $DMSETUP_PROG targets 2>&1 | grep -q ^$_target - if [ $? -ne 0 ]; then - _notrun "This test requires dm $_target support" - fi + $DMSETUP_PROG targets 2>&1 | grep -q ^$_target + if [ $? -ne 0 ]; then + _notrun "This test requires dm $_target support" + fi + done } # this test requires the ext4 kernel support crc feature on scratch device diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt index 4e01b1f..e27aacd 100644 --- a/doc/requirement-checking.txt +++ b/doc/requirement-checking.txt @@ -112,10 +112,10 @@ _require_statx DEVICE MAPPER REQUIREMENTS ========================== -_require_dm_target +_require_dm_target ... - The test requires the use of the device mapper target and will be skipped - if it isn't available in the kernel. + The test requires the use of the device mapper targets and will be skipped + if any one isn't available in the kernel. _require_log_writes diff --git a/tests/generic/459 b/tests/generic/459 index d1ad372..e3ac374 100755 --- a/tests/generic/459 +++ b/tests/generic/459 @@ -61,7 +61,7 @@ _cleanup() _supported_fs generic _supported_os Linux _require_scratch_nocheck -_require_dm_target thin-pool +_require_dm_target thin-pool snapshot _require_command $LVM_PROG lvm _require_command "$THIN_CHECK_PROG" thin_check _require_freeze