From patchwork Thu Aug 18 01:26:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A879C32771 for ; Thu, 18 Aug 2022 01:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbiHRB03 (ORCPT ); Wed, 17 Aug 2022 21:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242571AbiHRB02 (ORCPT ); Wed, 17 Aug 2022 21:26:28 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BADA1D00 for ; Wed, 17 Aug 2022 18:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785987; x=1692321987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hHWcbUOR/4p2YcGBqG8IYm6E/IJGBYbUG1/LuV/jTHg=; b=rw9JjhuB6kpfrLk5MDroXFFqDLKjvOjc4Vd40CMtH+t6l05vHbYeTqKY 3E36dTYMu0I6P9VyJG/BExfmqHonarZpjIPDOaDu6P7JKbUdEnzsoHj/J rehc+d4I07cW7zT2lFX+VRuITWALHeMHiFsA8Rw4/pmxUduX2vBZ/thwn tUAIA6AMeBtlGJWDgPi9oHCIZv/NTAfs+sS3AmC00SDcf9ZBVKtJwXNaB zmj0QCE3DkQ7GzNV0bjhYHV5x4lPTnzW56aN7kLANBthPdx6eICS0DRc6 Nxpxf7YzUELD5lqOWpe1e4rt77cia91v24ERV5RnFNLWxPzkgYl6e12+q A==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085638" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:27 +0800 IronPort-SDR: G4pj9Ch2cNiA/zxT5v/dSe0bHn/Em5urpfMAg06Hupz8OM3n9j6YR+UEJSWY1DLqovc6bBraCQ bL4lmk58Nc6njfuATvDVzM60MJsZn7AMu5vTYt+idr5WKHopWqzS2NeIlVhdZKtFIs/u9CYcP3 EWJ7hA9g2DeVB/WGH1BzfoB7jfCx1uxylGfQhtyJ+75qhHFgqpDQcOHcqZ340RXV/JbJKE/BuJ bFpqZmco+gLHOeUTBKN2pp7Fxq8zNEO9Wwe2a9uZx5SFqcAVwWlQqxA4V2NvNdhYO+O8V0FJV/ pLNQm3bPSBw0CuPY0rxpHZLk Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:54 -0700 IronPort-SDR: s7z9nYVDic+XBz7eElNs25jCbloUMbvid7gft4NyVd1wrrsd6QXnFIuVWRBicHvvdKUGAE5pC7 gCP54tXcXWB07mp0VyyO2jWhL3bhUly4TvHXaqc5qdm9RklyKxwpOmsXIiS68bRX1pA9KdCQg2 wwDgRyAiRf2UhfuuApqT0pWnb86yxY9m07TVxMaS20gVqK2Sl9N+A+7JxljuXvWiDLqsLHU2FI /lbxKkgwN+Y6IrZzAHxWINRWw/4dh7b2JAOQctYJVGbX1fIxgM5MeIGFlpLWky1oZuTdttbXKH 2WU= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:27 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 1/6] common/rc: avoid module load in _have_driver() Date: Thu, 18 Aug 2022 10:26:19 +0900 Message-Id: <20220818012624.71544-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The helper function _have_driver() checks availability of the specified driver, or module, regardless whether it is loadable or not. When the driver is loadable, it loads the module for checking, but does not unload it. This makes following test cases fail. Such failure happens when nvmeof-mp test group is executed after nvme test group with tcp transport. _have_driver() for tcp transport loads nvmet and nvmet-tcp modules. nvmeof-mp test group tries to unload the nvmet module but it fails because of dependency to the nvmet-tcp module. To avoid the failure, do not load module in _have_driver() using -n dry run option of the modprobe command. While at it, fix a minor problem of modname '-' replacement. Currently, only the first '-' in modname is replaced with '_'. Replace all '-'s. Fixes: e9645877fbf0 ("common: add a helper if a driver is available") Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Christoph Hellwig --- common/rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 01df6fa..8150fee 100644 --- a/common/rc +++ b/common/rc @@ -30,9 +30,10 @@ _have_root() { _have_driver() { - local modname="${1/-/_}" + local modname="${1//-/_}" - if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q "${modname}"; then + if [[ ! -d "/sys/module/${modname}" ]] && + ! modprobe -qn "${modname}"; then SKIP_REASONS+=("driver ${modname} is not available") return 1 fi From patchwork Thu Aug 18 01:26:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A37A2C28B2B for ; Thu, 18 Aug 2022 01:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242575AbiHRB0a (ORCPT ); Wed, 17 Aug 2022 21:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242571AbiHRB03 (ORCPT ); Wed, 17 Aug 2022 21:26:29 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99EB2A031B for ; Wed, 17 Aug 2022 18:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785988; x=1692321988; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4OWpSCTcZijPgiFp6MTHHj4KNHWiOMwVmdoA8J0Xfcc=; b=Z8DOyKI8nB9t56BS4zMu6QLvO74gXYU3lo3b18MtEfweh2zefBa2vo1l savl7aOCAfNyM+k82ixyKcmxt65azRUWq7stiqGsCc9/F2aWIv9bLz0Xc CJ3qICiN1Lt/arRVmpfQ31g50I2hVSIkbWqKwUHIcxBdlbCFLdoXLmUYa TzDcOf7ACKWIaJW4CfcKq9olxU/EIV+RMi7I3TZAc2YaOk5TOPvpk5Nzg oTNaz3RprQuL1ci9HtMJna1hbYIUbCzzoem5PgHx4hizXmwgS63sPbLLa aOUuwo6+0ZF4cv1NVrTqvPZMJ4DNzMgvn78nf3DO+owd2gZIm+R9izwjw w==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085640" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:28 +0800 IronPort-SDR: UKj8CkhIstvyiC3rlbg97bu6eJ7FTEYdQ54AC82nRvt4gYfxFnwe/ahd8ivhyZno2rVWcJl+4r RXLkd6ASG2UWoIAydbt13rNZatj4gJWjRfCVV7fZ67bOSa8kMBomyHWje7PHULMF2HJJAXoTMM hEPRDWBG2XnqTQvrtVYSA/NjuVqphfQI+xeieTD0GlMirdzt+2sy6+xKoFohcgOtJVujTME50R cn+efK0TMq23flTCV2ISnVKw44VnrFYS4geoJBUf92G/RIyq+BowcV9t22aF9KzJ0MxZoMg3LZ lo4sTaJh4tEBGIgLFgC7ogRr Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:55 -0700 IronPort-SDR: y3DGspFYXxqHhBzttORfKQy5achm9pj9KplLb8pbHcJ2B0LzjF93YJjoszgZQ/IxUiaPu/bVVT Cgi4OT7cGKnm/ggf97nLceFVqnMADtSPxO2mfPeaBemOaARzkhW0tk553weoXy4iOfzsqqPBcj IkDr2Sh2CLJ33lxiQZhX42Xhmx6luY5KRwWK2JsewpNaQRMVyyKyxsG8VZAM/Q5BsE10aQaiev RzU79Rr/wFNbkWAxA+I7eKd3PkLkPBdUhteiTJ4Y1nQEohaeVjJiO+bJjxX+Cpn6jtAU3f/Usp lzc= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:28 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 2/6] nbd/rc: load nbd module explicitly Date: Thu, 18 Aug 2022 10:26:20 +0900 Message-Id: <20220818012624.71544-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org After the commit "common/rc: avoid module load in _have_driver()", _have_driver() no longer loads specified module. However, nbd test cases and _have_nbd_netlink() function assume that the module is loaded by calling _have_driver(). This causes test case failures and unexpected skips. To fix them, load and unload modules explicitly in functions _start_nbd_server*(), _stop_nbd_server*() and _have_nbd_netlink(). Signed-off-by: Shin'ichiro Kawasaki --- tests/nbd/rc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/nbd/rc b/tests/nbd/rc index 9c1c15b..32eea45 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -28,17 +28,21 @@ _have_nbd() { } _have_nbd_netlink() { + local ret=0 + if ! _have_nbd; then return 1 fi if ! _have_program genl-ctrl-list; then return 1 fi + modprobe -q nbd if ! genl-ctrl-list | grep -q nbd; then SKIP_REASONS+=("nbd does not support netlink") - return 1 + ret=1 fi - return 0 + modprobe -qr nbd + return $ret } _wait_for_nbd_connect() { @@ -62,6 +66,7 @@ _wait_for_nbd_disconnect() { } _start_nbd_server() { + modprobe -q nbd truncate -s 10G "${TMPDIR}/export" cat > "${TMPDIR}/nbd.conf" << EOF [generic] @@ -73,17 +78,20 @@ EOF _stop_nbd_server() { kill -SIGTERM "$(cat "${TMPDIR}/nbd.pid")" + modprobe -qr nbd rm -f "${TMPDIR}/nbd.pid" rm -f "${TMPDIR}/export" } _start_nbd_server_netlink() { + modprobe -q nbd truncate -s 10G "${TMPDIR}/export" nbd-server 8000 "${TMPDIR}/export" >/dev/null 2>&1 } _stop_nbd_server_netlink() { killall -SIGTERM nbd-server + modprobe -qr nbd rm -f "${TMPDIR}/export" } From patchwork Thu Aug 18 01:26:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6697C3F6B0 for ; Thu, 18 Aug 2022 01:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242571AbiHRB0a (ORCPT ); Wed, 17 Aug 2022 21:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242574AbiHRB0a (ORCPT ); Wed, 17 Aug 2022 21:26:30 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E64A1A4D for ; Wed, 17 Aug 2022 18:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785989; x=1692321989; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0tYaAQ7mV6RGdu7wNnqXIDpi/EGElDG83oOeRqsY1Rk=; b=e6vSQm33SL5dGFO9B0u/j5yBw7tBC3gtEg+g9+tLvXmm4NJ+C0WPVoM3 eSMLM7WhGXoZhfeqC2CQOR9i3eSkpKhENDHTxqs1HEs3Zr1ObaXZmy8E4 KUEzXf8g/DSUqIVauDC0vlC5bwW0BeFaGuVsbS9ILXedbTbfPB8DtWGnE A1cVSGcNKrTIDjeDhppbKbWGKDgXRIlNN88xurmhR3BLr2IYANSDRD3uR oJ6C40EImbI9T/AygGOBWT8IuxLl4SOCnmVNyrftdMnG7RV+CRWXMEiY9 0Hdj3NKk3XgqVTs9W827deY9pLemPuBq9F/GA/MVyssR9JPLe8MR9RC6Y Q==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085641" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:29 +0800 IronPort-SDR: qt1pJwaKz5TIjtEY0uNWUoitPI1QVeIGua0q+aIJhm/zY/5UMk7E/i6N710haFpfN1zVGP6wqw p7h3BnFcx+P2BL9896JZ+DCuQAY/wV4rJwaQpGDEZWZrShvFNoamrZjw+xF+bWvhOAxUWxkTQG BhhBUci4nDjCKlql7l63ogh2M563NPns8SuBgyjuFSHkCLYYeoH5BHFS2sWA/qf0FftaC7/UO2 vRtHhBiC1gbHBPRTFqjAHo3O8CCUZqPL451oemv/d9UqpyxGhi18hA5ySNvV0UlfMPIiL9jWFQ czBbLRBcvkbVMn6gR1NdnPfy Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:56 -0700 IronPort-SDR: j0O2FWgQmXMeCuw6mHtHqfy/wzNWCZUk54ppXlrZfvo0FRODV9eTwcAwuZx+nUjzafR7hj/u1a T4nRqU51CoQHzkFe49FT7fjLbH6Hr2Maexq+0L7nC0tkro10M9XJFT6KDqm5BU1nNmZ3i747bN iQIz0/87BQhXtgavN3H6EyRXMVi5HMyTxq9tWaoeuFz9P5SanNWhtf4EE9drarYcCQJsO6KW5q j1+MQGadX8Pz5hzdz/V3ODbANHB0zXgIt8URm0N7uI6hyIHso1oxeVdclnImuVZUtUZ6ai2BS9 qh8= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:29 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 3/6] common/rc: ensure modules are loadable in _have_modules() Date: Thu, 18 Aug 2022 10:26:21 +0900 Message-Id: <20220818012624.71544-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The commit e9645877fbf0 ("common: add a helper if a driver is available") introduced the helper function _have_driver() to check the driver or module is available no matter whether it is a loadable module or built-in module. It was assumed that _have_modules() whould check that specified modules are loadable and not built-in. However, the function _have_modules() returns true even if the specified modules are built-in and not loadable. This causes failures of some test cases on test system with built-in modules such as nbd/004. It also means that _have_modules() and _have_driver() have same functionality. To avoid the unexpected failures, fix _have_modules() to return false when the specified modules are built-in. Check if loadable module file exists by searching the module file path. If the module file does not exist, return false. Also add comments to describe the difference between _have_driver() and _have_modules(). Signed-off-by: Shin'ichiro Kawasaki --- common/rc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 8150fee..ee2289c 100644 --- a/common/rc +++ b/common/rc @@ -28,6 +28,22 @@ _have_root() { return 0 } +_module_file_exists() +{ + local ko_underscore=${1//-/_}.ko + local ko_hyphen=${1//_/-}.ko + local libpath + local -i count + + libpath="/lib/modules/$(uname -r)/kernel" + count=$(find "$libpath" -name "$ko_underscore" -or \ + -name "$ko_hyphen" | wc -l) + ((count)) && return 0 + return 1 +} + +# Check that the specified module or driver is available, regardless of whether +# it is built-in or built separately as a module. _have_driver() { local modname="${1//-/_}" @@ -41,12 +57,14 @@ _have_driver() return 0 } +# Check that the specified modules are available as loadable modules and not +# built-in the kernel. _have_modules() { local missing=() local module for module in "$@"; do - if ! modprobe -n -q "$module"; then + if ! _module_file_exists "${module}"; then missing+=("$module") fi done From patchwork Thu Aug 18 01:26:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0FFDC25B08 for ; Thu, 18 Aug 2022 01:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242576AbiHRB0c (ORCPT ); Wed, 17 Aug 2022 21:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242574AbiHRB0b (ORCPT ); Wed, 17 Aug 2022 21:26:31 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7880A031B for ; Wed, 17 Aug 2022 18:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785990; x=1692321990; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M33W326ck6VqWXZzKOxU9GqsWCe3rR0fORcGJbK42U4=; b=jxj2PrIyqaFwdu39lzohmzqP/Z1aqXr+jA80zh0W2M/bw1mGVDMzXNQB RbaKXTh1J8rj6qyzf+LitpBqIK40HfBtbuXEPuZeRq7cfsja2zModyWDn TC22tsJf6Ud04yDyWZu7rjDgIifvBXnEy7cNXeQUBcxteZx5JnzESyUpv tj7WcJYcJmKIqFTWfRkPnw8ApOT/Mvn5BcAFImemORcTmGkVGDP3wuWop j1CBvZwvv9NxzdsP8qbhrpQXqMi9rIQW/cnSJNQoH0Oqsp0tUc54UPJXe NVBPFv0vx6VC32HAEhq+WMHC174go5dtt94kehmdYHpJCBcdWOlNu6380 g==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085642" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:30 +0800 IronPort-SDR: gotQ6YyuD8XIyGH2Y67lTn/smjO2rck8p/xZO0S9e3Sz8Di4oYw9LCZghS5apcmjxelrNz7f8s 0dHRZ771Udyus/sBK76Gu8bvawhumxV1yKNDneZKX3O4ua+TNyGpkA2BWs6XiBKwPgdg4NYpkj qGWARtp2Z5knSLOIv55+ZS6AL1/K4u7edxexWC94jqOsWoQfqoBqJiD89Oq0q8GCKDcwKeOu5l oLN/PGA+gjvd+d4FbOBcmQJB2qKeOgr4zt/Ka4kPwKn9dm9bfiEldCKMHTYei/NVS76sdKvIWG /WJoVsQODpgfVnvmx2yViWrK Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:57 -0700 IronPort-SDR: o2yXgii89pw7RAN0btsw3+VEulcfgtV4qi6cooJsZ0SipgIovdGUoJFPUBacMZjWmnzwPdiMFC xFFbuxKHUZPWJnz3Sc6BPb4whgupX5eHSpyWZ1Lw6KkamdAJiEjdnrH1QKwuG0PazxSkCBPGGh jix2YXF3mOQYT2MmVL1yK63YQJXT6qxa2TraWr9+vi1BfzY8YlxEkH7mkCwF1ha/bD1gIkb8Ck uH1cGXwS8OoDDDt3fJFasBmAASWXMhb3MZo0kHKoh+Xu4MWDnFv59QHnZvu1Qy6xfXKUb5axHW E1c= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:30 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 4/6] common,tests: replace _have_driver() with _have_drivers() Date: Thu, 18 Aug 2022 10:26:22 +0900 Message-Id: <20220818012624.71544-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The helper function _have_driver() checks single driver but it is often required to check multiple drivers. Rename _have_driver() to _have_drivers() and improve it to check multiple drivers. This makes its usage consistent with _have_modules(). Signed-off-by: Shin'ichiro Kawasaki --- common/null_blk | 2 +- common/rc | 30 ++++++++++++++++++++---------- tests/nbd/rc | 2 +- tests/nvme/rc | 12 +++++------- tests/scsi/rc | 2 +- tests/zbd/009 | 2 +- tests/zbd/010 | 2 +- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/common/null_blk b/common/null_blk index 52eb486..15bb35e 100644 --- a/common/null_blk +++ b/common/null_blk @@ -7,7 +7,7 @@ . common/shellcheck _have_null_blk() { - _have_driver null_blk + _have_drivers null_blk } _remove_null_blk_devices() { diff --git a/common/rc b/common/rc index ee2289c..4b01fc3 100644 --- a/common/rc +++ b/common/rc @@ -42,15 +42,25 @@ _module_file_exists() return 1 } -# Check that the specified module or driver is available, regardless of whether -# it is built-in or built separately as a module. -_have_driver() -{ - local modname="${1//-/_}" +# Check that the specified modules or drivers are available, regardless of +# whether they are built-in or built separately as module files. +_have_drivers() { + local missing=() + local driver modname + + for driver in "$@"; do + modname=${driver//-/_} + if [[ ! -d "/sys/module/${modname}" ]] && + ! modprobe -qn "${modname}"; then + missing+=("$driver") + fi + done - if [[ ! -d "/sys/module/${modname}" ]] && - ! modprobe -qn "${modname}"; then - SKIP_REASONS+=("driver ${modname} is not available") + if [[ ${#missing} -gt 1 ]]; then + SKIP_REASONS+=("the following drivers are not available: ${missing[*]}") + return 1 + elif [[ ${#missing} -eq 1 ]]; then + SKIP_REASONS+=("${missing[0]} driver is not available") return 1 fi @@ -98,7 +108,7 @@ _have_module_param_value() { local expected_value="$3" local value - if ! _have_driver "$modname"; then + if ! _have_drivers "$modname"; then return 1; fi @@ -147,7 +157,7 @@ _have_src_program() { } _have_loop() { - _have_driver loop && _have_program losetup + _have_drivers loop && _have_program losetup } _have_blktrace() { diff --git a/tests/nbd/rc b/tests/nbd/rc index 32eea45..d3ec084 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -11,7 +11,7 @@ group_requires() { } _have_nbd() { - if ! _have_driver nbd; then + if ! _have_drivers nbd; then return 1 fi if ! _have_program nbd-server; then diff --git a/tests/nvme/rc b/tests/nvme/rc index ff13ea2..df13548 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -18,23 +18,21 @@ _nvme_requires() { _have_program nvme case ${nvme_trtype} in loop) - _have_driver nvme-loop + _have_drivers nvme-loop _have_configfs ;; pci) - _have_driver nvme + _have_drivers nvme ;; tcp) - _have_driver nvme-tcp - _have_driver nvmet-tcp + _have_drivers nvme-tcp nvmet-tcp _have_configfs ;; rdma) - _have_driver nvme-rdma - _have_driver nvmet-rdma + _have_drivers nvme-rdma nvmet-rdma _have_configfs _have_program rdma - _have_driver rdma_rxe || _have_driver siw + _have_drivers rdma_rxe || _have_drivers siw ;; *) SKIP_REASONS+=("unsupported nvme_trtype=${nvme_trtype}") diff --git a/tests/scsi/rc b/tests/scsi/rc index 3b4a33c..d9750c0 100644 --- a/tests/scsi/rc +++ b/tests/scsi/rc @@ -15,7 +15,7 @@ group_device_requires() { } _have_scsi_generic() { - _have_driver sg + _have_drivers sg } _require_test_dev_is_scsi() { diff --git a/tests/zbd/009 b/tests/zbd/009 index 483cbf6..4d6a637 100755 --- a/tests/zbd/009 +++ b/tests/zbd/009 @@ -33,7 +33,7 @@ have_good_mkfs_btrfs() { requires() { _have_fio - _have_driver btrfs + _have_drivers btrfs _have_module_param scsi_debug zone_cap_mb _have_program mkfs.btrfs _have_scsi_debug diff --git a/tests/zbd/010 b/tests/zbd/010 index 6d634b0..ef5e0fc 100644 --- a/tests/zbd/010 +++ b/tests/zbd/010 @@ -11,7 +11,7 @@ QUICK=1 requires() { _have_fio - _have_driver f2fs + _have_drivers f2fs _have_modules null_blk _have_module_param scsi_debug zone_cap_mb _have_program mkfs.f2fs From patchwork Thu Aug 18 01:26:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4D02C32771 for ; Thu, 18 Aug 2022 01:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242574AbiHRB0c (ORCPT ); Wed, 17 Aug 2022 21:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242600AbiHRB0c (ORCPT ); Wed, 17 Aug 2022 21:26:32 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98851A1A4D for ; Wed, 17 Aug 2022 18:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785991; x=1692321991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PqmQnyM3qKpwghVIz6xzLRKD6Pyldj2w2Y8ZoWnvYvQ=; b=o6xtCprG7H7Bp7JNMPN04emd+G81XaX3e+RtEpX66irpUv0pF3HT2ZLL UaUjGOnB9EFDiItthQ7ZoemY3kDbkXfRLlLvW+UqiU4Q0iiZZPiSw+0yh Gbgut5ppuUPQBNXF41QacqDqMN0v1tua4/ru6FIoOO+lkMpz4XP/qYZ1X kz7jX6PBVJ7RTskKj9MFvllqzqrhMQbxLIFO1LIWosrCixA5bGAwEy+WF bKnEer60JSvC3WOhjh3CwFJiT0xxLY8vcEzMKXouRiDgHdRVDmstFl7H0 Ub2jPsEZjnDwzZulQNRn8r73ub6VylpybjMEZF4Rkr+ywpqY7Pm4kma3g w==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085644" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:31 +0800 IronPort-SDR: ehEvzukAONQgoqgn27d2zFjWsKe3OA8HujRa1566Tc0uopyHq2Y96g8WerIM2NOggsIrct3z78 fti2SUlmIxa+stABaBzoHVcmn0Vg4KJlFGVDrNywE3HmJ4WJtRM3ipO3IuLS3c/+PLB5CZLt0t taarWJUOAnPK0tW/UNvU6lzqpOopR9L5E3MAbcxhKZRonL/HM70eq7cmWUcKMinQe8M/KjR25N +7VsEY4tABwi2tXeV7dZzNSdP5d+0U8EJH6D6SZPDx7ep59hjZO4jRibprINRL7L25Urr/ZyHv VjAiCBVwskA77DNPDXQbtFuI Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:58 -0700 IronPort-SDR: BgWDNkaume6irAMSgX9SHaoAk/I3kQndzyQTv2H0Ha0hMGm4XJD0/ZKD+ieTMcsEWCo24nGEqL rK3eooZLHOSz5qJdK7kc0xdgvCVEZIbqJAUWRExaG6HblOtdwZe2AS3hlGTR1Z73pVI0zOj1Ae e3xEJzqGmsyjFyPYU7Tu4lyMn2EDMrko77wUui2MyxBUF9RzJ4t6XEctyZXOKUo46KN5GZEvmp Xm/1f18Wm4kvbkyAAA8n7mcCz8E+kHIYrIh5jw3EExGnqXOLyeSzzEno5j/Kp0t1KDAVntpUJS ehU= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:31 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 5/6] block/001: use _have_drivers() in place of _have_modules() Date: Thu, 18 Aug 2022 10:26:23 +0900 Message-Id: <20220818012624.71544-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The drivers sd_mod and sr_mod do not need to be loadable. Replace the check with _have_drivers() and allow test with built-in modules. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/001 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/block/001 b/tests/block/001 index 5f05fa8..a84d0a1 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,7 +13,8 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_scsi_debug && _have_modules sd_mod sr_mod + _have_scsi_debug + _have_drivers sd_mod sr_mod } stress_scsi_debug() { From patchwork Thu Aug 18 01:26:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12946607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04B4AC28B2B for ; Thu, 18 Aug 2022 01:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242601AbiHRB0e (ORCPT ); Wed, 17 Aug 2022 21:26:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242600AbiHRB0d (ORCPT ); Wed, 17 Aug 2022 21:26:33 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCE99A031B for ; Wed, 17 Aug 2022 18:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660785992; x=1692321992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gidMCjksyDoobZco5DsPMXmlo5oysRo95C8k0fCVQHk=; b=K8+5sVN5N+siSoMYjwEFwbTZs7fPXEHm2RnJTEs4XdS7qZQG3cB7liWa +Rf138kab7y+SgQVplOdeRJ1G94Pm12nK6wxR0/b1Drw8i/TMjVh+SWoA t1o3rktkWEd9rrph+ahuS69OFfM4lTMAyWKucIIeQojSsAnDEYA2z958r sv1A1pzbJMmbqD2ojYsWcB81zvPq0thb6EX7ZCqFwCqLOuVzNZi9KgbDR n7eM0C31MQEJXvMDNpyAeZV9q32vnNvGd1hXvpCUZPg83aKSFy0zSQeoU aF+FquQVFLxuYR6DJid0oJx41F2UVyF1aiOLBeMet4CUAEYzpRB1RqLYN w==; X-IronPort-AV: E=Sophos;i="5.93,244,1654531200"; d="scan'208";a="321085647" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Aug 2022 09:26:32 +0800 IronPort-SDR: uNymg+GCsDhwO3Vo3IJXUfmGqNBT/bNahLgXV8o/QjRTTAYxUuGK5sSqbbpmXp96cU+9q0gaIS Qguxv09+Y+sZaPe1GM6N7+oF89CroGR8nyaT+X8eXSjqEMfCFgGQAWHGjUxCbDrL1H/GqIrnmx 9tAQxlyG94cWdr4JNgeb0NBaRNOUmRdw/dDSNQ7tNuHiFePlDNGNa11hHW1yz2RmgW6VQBYeYd sEGT2M8Bmdlaii9rViaU1bu1Qb8fpNR6RS7mSfuHUq60A9VgqqyVd5OH/x0h+mgVIrg0FIfwog 0dNaVmZSuJCXvnV+Xty4WpEk Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 17 Aug 2022 17:41:59 -0700 IronPort-SDR: We15CybPik55AKWzSPc/BJp3u9isR28UR5vYDbOYp38S47x3gkXW8wnrIVin2uHhK+XpOxwMuK zRpC/shlKljcNfo2ILwtjzPUmOlO+Y2xgyiNDTQbiJW9Uvc9bw/cICrbTH//jscsSRKP3d92S9 lL4eJLtKtWb2ETqD+mGBCtEa8ywGTDkDepbjgSQQ5MsEYkTUXMsll+Ic9qM/785+LFUjvjqw/D O2uGd8Z0FIdaqeO+qPsHGlwGqvfuYXet5eqm/cGS0KBApSlb9A/42ngBptb88y03siaKbR7ePU 2Ws= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 17 Aug 2022 18:26:32 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 6/6] srp/rc: allow test with built-in sd_mod and sg drivers Date: Thu, 18 Aug 2022 10:26:24 +0900 Message-Id: <20220818012624.71544-7-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> References: <20220818012624.71544-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The srp test group can be executed with built-in sd_mod and sg drivers. Check the drivers with _have_drivers() in place of _have_modules. Signed-off-by: Shin'ichiro Kawasaki --- tests/srp/rc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/srp/rc b/tests/srp/rc index 94ee97c..46c75c6 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -28,13 +28,18 @@ is_lio_configured() { } group_requires() { - local m name p required_modules + local m name p required_drivers required_modules _have_configfs || return if is_lio_configured; then SKIP_REASONS+=("LIO must be unloaded before the SRP tests are run") return fi + required_drivers=( + sd_mod + sg + ) + _have_drivers "${required_drivers[@]}" required_modules=( dm_multipath dm_queue_length @@ -51,9 +56,6 @@ group_requires() { scsi_dh_alua scsi_dh_emc scsi_dh_rdac - sd_mod - sd_mod - sg target_core_iblock target_core_mod )