From patchwork Mon Oct 22 10:50:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 10651919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C0CA13A9 for ; Mon, 22 Oct 2018 10:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B711262AE for ; Mon, 22 Oct 2018 10:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FCA52890E; Mon, 22 Oct 2018 10:50:19 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 7FD06262AE for ; Mon, 22 Oct 2018 10:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbeJVTIU (ORCPT ); Mon, 22 Oct 2018 15:08:20 -0400 Received: from imap.thunk.org ([74.207.234.97]:44416 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728582AbeJVTIU (ORCPT ); Mon, 22 Oct 2018 15:08:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pGYWmjrF+v4pKgkWWzfv96I1iARVo7XctkPk+SC2AOI=; b=vk5LPt6ifzg+bTUAyONn8r8T7n DQZHZPO4qAX13NvUThKbtIJm0Qgt3PWCfgO+j8Wz7Qoph818ECpwab9diKl25JURLnVObzpQFoOfQ xHqGnz3Jl3pv8rW2j9PcYK0vDghrhiDyqZrt8bcPgvVYbqWDH45djoHRr22sCzmawv2g=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1gEXmq-0002WD-QH; Mon, 22 Oct 2018 10:50:16 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 1F0BD7A2F4E; Mon, 22 Oct 2018 06:50:15 -0400 (EDT) From: Theodore Ts'o To: linux-block@vger.kernel.org Cc: Theodore Ts'o Subject: [PATCH blktests] common/rc: allow the loop driver to be built into the kernel Date: Mon, 22 Oct 2018 06:50:04 -0400 Message-Id: <20181022105004.29324-1-tytso@mit.edu> X-Mailer: git-send-email 2.18.0.rc0 X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A number of kernel modules used by blktests must be compiled as modules, since the module needs to be loaded with specific options, or part of the test is to exercise what what happens when the kernel module is loaded. This is not true for the loop driver, so add a new bash function, _have_kernel_module which works like _have_module but will not fail if the driver is compiled directly into the kernel. Signed-off-by: Theodore Ts'o --- common/rc | 10 +++++++++- tests/nvme/002 | 4 ++-- tests/nvme/003 | 4 ++-- tests/nvme/004 | 4 ++-- tests/nvme/005 | 6 +++--- tests/nvme/006 | 5 +++-- tests/nvme/008 | 5 +++-- tests/nvme/010 | 2 +- tests/nvme/012 | 2 +- tests/nvme/014 | 5 +++-- tests/nvme/015 | 4 ++-- tests/nvme/019 | 5 +++-- tests/nvme/021 | 5 +++-- tests/nvme/022 | 5 +++-- tests/nvme/023 | 5 +++-- tests/nvme/024 | 5 +++-- tests/nvme/025 | 5 +++-- tests/nvme/026 | 5 +++-- tests/nvme/027 | 5 +++-- tests/nvme/028 | 5 +++-- 20 files changed, 58 insertions(+), 38 deletions(-) diff --git a/common/rc b/common/rc index 8a892bc..be6133e 100644 --- a/common/rc +++ b/common/rc @@ -35,6 +35,14 @@ _have_module() { return 1 } +_have_kernel_module() { + if modprobe -n -q "$1" || test -d "/sys/module/$1" ; then + return 0 + fi + SKIP_REASON="$1 is not available as a module or built into the kernel" + return 1 +} + _have_module_param() { if ! modinfo -F parm -0 "$1" | grep -q -z "^$2:"; then SKIP_REASON="$1 module does not have parameter $2" @@ -60,7 +68,7 @@ _have_src_program() { } _have_loop() { - _have_module loop && _have_program losetup + _have_kernel_module loop && _have_program losetup } _have_blktrace() { diff --git a/tests/nvme/002 b/tests/nvme/002 index 2b01534..0624cb1 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -10,8 +10,8 @@ DESCRIPTION="create many subsystems and test discovery" requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_configfs } test() { diff --git a/tests/nvme/003 b/tests/nvme/003 index 693ad8d..2a2dae2 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -11,8 +11,8 @@ DESCRIPTION="test if we're sending keep-alives to a discovery controller" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop \ - && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_configfs } test() { diff --git a/tests/nvme/004 b/tests/nvme/004 index 55b5c67..14137e1 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -12,8 +12,8 @@ DESCRIPTION="test nvme and nvmet UUID NS descriptors" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_configfs } test() { diff --git a/tests/nvme/005 b/tests/nvme/005 index fa7a75d..4f638dd 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -11,9 +11,9 @@ DESCRIPTION="reset local loopback target" QUICK=1 requires() { - _have_module nvme-loop && _have_module nvmet && _have_module loop && \ - _have_configfs && _have_module nvme-core && \ - _have_module_param nvme-core multipath + _have_module nvme-loop && _have_module nvmet && \ + _have_kernel_module loop && _have_configfs && \ + _have_module nvme-core && _have_module_param nvme-core multipath } test() { diff --git a/tests/nvme/006 b/tests/nvme/006 index a2693a2..ff04e34 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -10,8 +10,9 @@ DESCRIPTION="create an NVMeOF target with a block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/008 b/tests/nvme/008 index e5aa50b..4d4c626 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -10,8 +10,9 @@ DESCRIPTION="create an NVMeOF host with a block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/010 b/tests/nvme/010 index a76b176..11387f0 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -10,7 +10,7 @@ DESCRIPTION="run data verification fio job on NVMeOF block device-backed ns" TIMED=1 requires() { - _have_program nvme && _have_fio && _have_module loop && \ + _have_program nvme && _have_fio && _have_kernel_module loop && \ _have_configfs && _have_module nvme-loop && \ _have_module nvmet } diff --git a/tests/nvme/012 b/tests/nvme/012 index a19dc36..a4503c2 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -11,7 +11,7 @@ TIMED=1 requires() { _have_program nvme && _have_program mkfs.xfs && _have_program fio && \ - _have_module loop && _have_module nvmet && \ + _have_kernel_module loop && _have_module nvmet && \ _have_module nvme-loop && _have_configfs } diff --git a/tests/nvme/014 b/tests/nvme/014 index 08fef81..c2b1ecc 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -10,8 +10,9 @@ DESCRIPTION="flush a NVMeOF block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/015 b/tests/nvme/015 index 6b65c14..d59375b 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -10,8 +10,8 @@ DESCRIPTION="unit test for NVMe flush for file backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_configfs } test() { diff --git a/tests/nvme/019 b/tests/nvme/019 index 1547648..332694e 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe DSM Discard command on NVMeOF block-device ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/021 b/tests/nvme/021 index 2c11d55..556b56b 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe list command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/022 b/tests/nvme/022 index 2e7db71..cac098c 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe reset command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/023 b/tests/nvme/023 index b51124f..3ec6603 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF block-device ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/024 b/tests/nvme/024 index 964df34..f30fff6 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/025 b/tests/nvme/025 index 27c8fde..0877ae0 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe effects-log command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/026 b/tests/nvme/026 index 341b3b5..bd696f7 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe ns-descs command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/027 b/tests/nvme/027 index 1f2018c..c8b7c35 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe ns-rescan command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() { diff --git a/tests/nvme/028 b/tests/nvme/028 index e6fb9e3..bf14dcc 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -10,8 +10,9 @@ DESCRIPTION="test NVMe list-subsys command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_module nvme-loop && _have_module loop && \ - _have_module nvmet && _have_configfs + _have_program nvme && _have_module nvme-loop && \ + _have_kernel_module loop && _have_module nvmet && \ + _have_configfs } test() {