From patchwork Wed Jul 27 08:52:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930240 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 F3A82C04A68 for ; Wed, 27 Jul 2022 08:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbiG0Iw5 (ORCPT ); Wed, 27 Jul 2022 04:52:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbiG0Iwz (ORCPT ); Wed, 27 Jul 2022 04:52:55 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1AE845F7F for ; Wed, 27 Jul 2022 01:52:54 -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=1658911974; x=1690447974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jE1UUO61ZO/O5Zl3qaKzai51tWR1Wq2s6F5R7t0tbAc=; b=o+j074DENN7YqoTG7OYphYrghBV4jn/ptmmVNE8tpePuz983h2dBxX/t eqZmR6/CL8ryad7eEBV6GII5MvCV8nvjFNo6v6quDXLDgjEgH/enjt3tQ 01hf/xMbUgnDL5TypI4okM2jRbXv6FXZc03x/nhEjLPs6Mto8w3PgvKCN +m8Uh4DSjdGN0P2XmaMiDcOWD/xyh0I0o2dDNwTUIJo8CDMa1WLgAshtq QygPQkyercOg6dDnAxdMCEAf0CW9QGsMvLPsoNAglJfEHtPDal3HEjbqf IAV7DGPP/+NINGcJpzzPrdwHgi3+Atnn+HnF90bNygdUizMa98/UhbT7V w==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584974" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:53 +0800 IronPort-SDR: h+evnnAQTaQogwWSRo2aKl9vSj9ZFLzGxgrXAI6guSrt+haOUDwGxZWZ4O/EuM378ydaKj9Ehd KzVCrt8In64FsP18G7Ux41VFyrmyELjt6HlQpIDRo6O60d8fn6EpKn85jpO18JTCELnqlP3JKn vAQOa3uIl8hCjv1lq+fBpB2xTjCCVKmtNc8pOmZllKwaUsv1XrRr42bM85ao2Tw6HKCnPRCFmV VZ0itMEcBensHCte1biJdClavipBdq36QM3oaHrwOxxspACGEWEc4pgy1HshJeukNNm5hxOaVd rncRD8xfYo66HBUmtqonzhxQ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:06 -0700 IronPort-SDR: a7TixAOU2A0pDnmX05byJ3t34g/gAafskW341Xc3VMtCCcxhmtVnH0KpJngaLfs1BZridxeAa2 8H66wOyYYPyFeOVZXd4pHOTDwpTNM0GrjvqJ8E9jkt6vCjq2oLuKBN3cleaO0tLySQfXkzVXjd an09m5fWOEAhCixnA9HALjHJsKzNPEI4ZHPZkm4hu3w757fwOpk2HkjzROKKp2t/oCJcZ8YB4T grozRWKJVKM7cqD2nM/DyZxBMmpUI6BUszwJp5U7hWY9uIK2RKryxH8FbPM8rdoaFmV089jblx TPc= 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; 27 Jul 2022 01:52:54 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 1/6] common/rc: avoid module load in _have_driver() Date: Wed, 27 Jul 2022 17:52:46 +0900 Message-Id: <20220727085251.1474340-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 Wed Jul 27 08:52:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930239 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 1131EC19F29 for ; Wed, 27 Jul 2022 08:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbiG0Iw5 (ORCPT ); Wed, 27 Jul 2022 04:52:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiG0Iw4 (ORCPT ); Wed, 27 Jul 2022 04:52:56 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D2946D83 for ; Wed, 27 Jul 2022 01:52:55 -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=1658911975; x=1690447975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WvOnCWOa9FoGp8j6yKay3efEtXc+6xbc6ZlBDhjCd6s=; b=n8J2SStGIpptBYJYSEXHnrOQakm/oBAKQvOBfgInozCd4PALCrjAaCBX kJ4MPZT6Gb6rnkrX0iHl2ig90Pzn60Afv578BF7Di3iFuRNJvaiHLbgU0 TL6kLdAwZdEwfIQrtpIE4xOI13pkiO0D5LX05yoZzjeMHS+ItpmW2gg21 kIkLQv/pCHN+5ufNjmkWHJyqUdQx1Tmqshkhs70Wuv256fKqav95V1E2Y Ij+eYiv0UiLwh+FYuoVeDAWg/MXTT2HSy2e6dbEqWntB/rvIfoqouDoln sbSCEVVxPB/zvDgMmVJ+tyNGqlJb4/JOE8kfx0EQRmqasFJRDT5EOnSdU w==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584975" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:54 +0800 IronPort-SDR: YVIEofBUA8lXs/+nkFUUWS7ZfLWAD2eLzaR25yWEnaufeINjCqdIJzq9EvVsosfYIa3XWR4/st AFRZtxRtTTEUXGB0BJujwO7yuWamloUaxyTtIv4tRd141gH8CiSSDLHLx/q57/bIsF3k2291kf /wlTO4EG9e5swZykSDR/7hAoPESaSDizsMm+EDe1f4CXxbpGQ3kgqSq/6tpKk2t0f/5h10pd+a gByOuDMJik0S0MyRJNg9dCUztrSiL2VSI3ZdADpOpYAMek2tTTL8bAwlQcntl0IjHhJY9e7V8W mdKLxjHLO56D/MnRis56/1Zf Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:07 -0700 IronPort-SDR: MdjPGhRUGRYvGQvvi2T81m6jYSKMDCwqqkISCwG9RRHUG7PXVD2JgkOv3snRziCkkhZKdP10lG KHeAWhAVhtDpiSX5d+BOIZ3U1VBDs0Z69qjnpk3mpZOtg3OFu5LwVTXrd/DYl7IdgMc/oUkB0/ JPxIZKEHmkW13DAWRUzHfpXz3qbWyQSQPt8LjSI1F2o/J4piP9fdabVFPwlO0ovvXOZ/o9nVC6 kcPsim12wFbMYuU03CShMJQQ7pdU9UDi2CsXxluB1Rtm8TRNqEKD3SyfyUu409D+AU2l7XDMKu jyI= 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; 27 Jul 2022 01:52:55 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 2/6] nbd/rc: load nbd module explicitly Date: Wed, 27 Jul 2022 17:52:47 +0900 Message-Id: <20220727085251.1474340-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 Wed Jul 27 08:52:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930241 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 3EB5FC19F2C for ; Wed, 27 Jul 2022 08:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbiG0Iw7 (ORCPT ); Wed, 27 Jul 2022 04:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbiG0Iw5 (ORCPT ); Wed, 27 Jul 2022 04:52:57 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBCE546D88 for ; Wed, 27 Jul 2022 01:52:56 -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=1658911976; x=1690447976; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2obaopggOapRz6dEOPBLVSK8fM+e2f3KuoJzYWGrSzk=; b=MUlmASGC3d7IysTn0ejOHuHR9M3mpeKucCsNX3nBzlTfj21OYdj5wP/0 c2HLbKovGsHUT00Khp4UXr2VJgO9GloNTeQ1vzH9T1gYC1cpr8lHCN6Zy tB/BzcZb2z6qjzMD9TOininbK87uxzmTNrVMdOzOsavllXRes62TqtUr2 zZ9wa4vQiKu+guQugN4rwRLTqHyavkxNox1bFIjdO1tv8Mr2eRiFjka11 EXp+GUEK40ifo70EjpUcc1iZW0IJssWLUxJ0EZioziErU81AJsqp3t6dX iIY2xd3sirpJGC9MJeT735rPXtvdepOrGfKKn2kOhsdSCGlkvCL+4kW00 A==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584980" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:55 +0800 IronPort-SDR: 5HusYWdUpGwgOrs/3IvoLwDWSlBC6hyWuqjfbXhTKgRBA8YLC0QLKCFZHSRTfeRFxHpZQXulcD igKzrictzFtWSSfeqi2Ow7beux/jg60rEwidZXAMr2lWfsb8Gaah80X5UILnc/WaQNF7oCk0wi LWOld4uD6HCnOl9SEnEFpiQjbHQ0jxXzYC2DJz5VA4RcBQJUbJQqrCaCx945PAz5+Oo3B2CQ4/ QZ6v8K5d7x0Yb48X8Z/M5g4yuH9s6aUR5ZNAKUb08agUN5tS3RAmXYZ1NBk28cTSsqgP83V++9 XM+XdBnsTc02njvGPQOYmiGQ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:07 -0700 IronPort-SDR: OzU8ATJEKRBcaIseZCwCrUAotgk0QmCjvbUgU9hqBiURpHW68DAnSYSrtddw2fANs3ywFWPndm YJz8/Na8cjh2pA4EtPm7TyLDcyp4aW7TI2n2kaCTUfqaFh69nSQ1d+QXUX5/R5oKVb4kD+vukp VFocglxD7rHGJRL/0QSp2kJpR9dmotSrs6sxWoADFq5KHCh8SmbbkS506n8LRBz1XP/Q4gmxb2 ChaCI0q1qcGFEAfYBh935866aApNOVLDZ/GFNP6la66w0+xvkJpJ5JnHytKggDlodPbpncwCp3 W+s= 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; 27 Jul 2022 01:52:55 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 3/6] common/rc: ensure modules are loadable in _have_modules() Date: Wed, 27 Jul 2022 17:52:48 +0900 Message-Id: <20220727085251.1474340-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 Wed Jul 27 08:52:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930242 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 AABF2C3F6B0 for ; Wed, 27 Jul 2022 08:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbiG0Iw7 (ORCPT ); Wed, 27 Jul 2022 04:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiG0Iw5 (ORCPT ); Wed, 27 Jul 2022 04:52:57 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFCE46D89 for ; Wed, 27 Jul 2022 01:52:56 -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=1658911976; x=1690447976; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3DvL2Kg2gd7W9ys71YLEKa5R2XUTS0He9LVGavCq4vE=; b=chXOGUlVc+6hZcOb85f/iksPiE1RukWVA8G1LfDzSisG6/oZGYYjjnSq JGtVIl+dreDrsEGxNVOrRQNTNXRNu5eYQInRFOWwVyRbWCXIotkvVT0PK +Pt3iJyNrqmAE1LMtcVJeTaMzp2xrU/TCqU9U941hPlJARlpYGjFX3Kfc mUttmasFTXZQXIafmBFKr5gnxRbemns/vsW1FtbYfZjISR+zsWK+EB8el axxsrB7FeGAj+sCgxA0W3KoDEOXZGPariLONvpGnYF0SDLlSo1SDWUdob YQqHWU523bmM80QnKwL0T68LoGgrFMdxDEv2c7Qbky3K1jGs/9AF+Jnwz A==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584983" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:56 +0800 IronPort-SDR: 6Nj0BKzZF/gtX04SdomMx5jOuxSmabDHQIob+6VBvKOrDjDPFOg4u9gdL/SH24oPMgiLtGpTrv xE2N9bNh0XEKYs4CN2J31owqwd2dUxPFRVnnPeDtBHXdNHfykMnicQ4KRhHQoq5ERWVFlOZtQX tI9ArdnbGoW+OtvFEGWci0kmvn6ZNSHrkft0iIRVohFuSscXrfN5ydVvX46K+hnaMVFJQAbUiT GKA4PPkcGsV07hEpVDuAej7G8fIgOi7hDj3uK4Xthk1hl7Sg0QihM6XhOjIDwZL+0+aHPuLUn9 oELhSEvFuEY5N2ss+iyt4EgU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:08 -0700 IronPort-SDR: eE24adwTteVdiqIK164dtNNWl4JnXEpxIpHPdFc15OXhD/TKPFN2MFcrie2Jg0xHJYL4sceb1h UET6xm6Efr7eu73/YHAzwwjsCsDFsO8+CujNdmDxVIqYLo/MT/DpBnxPQzK74mSFDbdqbOnXiF kIbLjf1kRRkJVYzd0tTK0zLDkSD2XLpFmd2bfAckdVzw8hBLJ4trpPU0kxho489vPdx5YYDTLY 7ffMoL5jxleSledbT9z7pLhvolsaAe1p4dOYN+qsQwDCWRE4uFU8Nc33j4rA5plOWqSmrit7sw L3E= 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; 27 Jul 2022 01:52:56 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 4/6] common,tests: replace _have_driver() with _have_drivers() Date: Wed, 27 Jul 2022 17:52:49 +0900 Message-Id: <20220727085251.1474340-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 +- 5 files changed, 28 insertions(+), 20 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() { From patchwork Wed Jul 27 08:52:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930243 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 55A34C04A68 for ; Wed, 27 Jul 2022 08:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbiG0IxA (ORCPT ); Wed, 27 Jul 2022 04:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiG0Iw6 (ORCPT ); Wed, 27 Jul 2022 04:52:58 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D9FB46D83 for ; Wed, 27 Jul 2022 01:52:57 -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=1658911977; x=1690447977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e2KohEWTMAXisI4mz3YJiUD4xuDwO4eqXzG6jXsMgtU=; b=dq2yQYqMMEPxyFhsJ3Kl472OQcO0sNLl5LMN2Vds/ga+7Sa6cCQoGVRV UlXkPYuK4BBplBL0h8CrzQxpeV+D8qBNYdHA3B9/aaHfm269hAP5qkOV3 0Tz9AvQI9zI99Fp4IUe8+Q4S15fobbmMOtM7iqdfgoeBwtU/dhcL8sx4/ mapIyBGosIdRgoSyZYcH9tAYqV3YD2LQn8oPbQrx41dhx5TIA2nxuB++i NyVdV1Oy948o7arqQZnYiYBhHFbMMcyzqvElW5i4/tN4acBL87lInYAXn fYEOkzRGmsBapZdZhkoBPnodBRMD4bsA+5THJPPrNohpK7t6lhO5aacJ/ w==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584987" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:57 +0800 IronPort-SDR: 4PFjASfWVAlFyIRv/3JxMlms4n49YcNcV394XHsnF++XEHUrIeVxrR4gPFNK24vB+gcG5vgztw fTJvZ9GdcNLJcpheO4V6CqWaERlSqEnunI+JvlU5NLLooXrrwH8UF7eBcwGsfzuGuz1JQzROA/ ibatqIkukIJCYGepIGczsNI8rNuLq7oxtPzCoZiL+mC6MLieqHVLt89Fcj7aTKdVFtKW1tpApU 3Z0Muaw6yQoy1aqxboDopDgrN3EADRXtAVsMr90orpiw3lsbaeklm8EWw/2I0bjyF9kogrDy9F iGVG5AO5pTe8oZY+ZLry0eff Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:09 -0700 IronPort-SDR: /H5f5xQM5YhnmJBLf6lnEHgVi30YmOAVuDO/hxmRDwhNENx4FCdY+MPKy5zf0+L0RNY828tygz cNk93kiEWjSid0ElCrDVVhHqaH+jNYH8WB1yDHZpNLvhQw90hhOaDC9c2muflhLjHLqlJ3l7nn buL4+mc1Jnq69L1trfLvAA+I2NdgsC8qzkZdW/gemQjd8DUtt/LQaDPQ7MNfbmFNLq9O+5VVdN 98iPkHGacFk+MiwLXOYdHCYuxAkXT78cpoHpfLpoZe2eKxse4Q8dGkL/V7hYh63Q8YwDFfLmJI F9c= 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; 27 Jul 2022 01:52:57 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 5/6] block/001: use _have_drivers() in place of _have_modules() Date: Wed, 27 Jul 2022 17:52:50 +0900 Message-Id: <20220727085251.1474340-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 Wed Jul 27 08:52:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12930244 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 42936C19F2D for ; Wed, 27 Jul 2022 08:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbiG0IxA (ORCPT ); Wed, 27 Jul 2022 04:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbiG0Iw7 (ORCPT ); Wed, 27 Jul 2022 04:52:59 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B772046D8C for ; Wed, 27 Jul 2022 01:52:58 -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=1658911978; x=1690447978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FuJxPAQuEVxYFqdrcw7CgJn80w9jEhJ0pB1tM1eFiZY=; b=bcYUyUVVdbEdRNGXjpur1hV1T+/PJAkKXsSWuLsVYtewcPdnmU/Bkp7Q 1XECgGmO9ISfEUKpaVq7aMvyvIRcs57GORTWzYMnkyK2y8MBOXsxLEcJZ 9wq6EidsBwdOZEed+x1VL6lFL28UEeaPHVc+DgoxraQMMbrQg3DW+ldgg qnkZrpjWtLWYGdwqScfhhLwYMMgDjZqZK8BfAtOoM0xEMkBM/FTqwOka5 UXYjTo6kdWJYfaVGOJqF3leHRt++7NsBAGimbEQ209V8NyUX952Owoni7 qf37iZylisOm6wTueMNL7neVZutu9XpxGwgtM90F6dzXipcruTUSOiYR2 g==; X-IronPort-AV: E=Sophos;i="5.93,195,1654531200"; d="scan'208";a="205584989" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2022 16:52:58 +0800 IronPort-SDR: 09+gCHQjgEcL2B4+VwAZkGSUioDvj9Z/bTr/fSTBFZGFHq5lKbR81IDoY5a5f3N/Ti2aAv/Q5/ pxyWLId9peKLhFsGdvZmTHRe/SqmrcL6Q3BQla19zjCQPnkxUVUO/zrAvs86GNITFtElxor7Tg Jwam1Ozm6t06xJTtpTWmtfjLle1hsN2GHYL6sJ4dRh72zR0tPbezKj1skSJNI36ogMlE8kDOEx Pow4dS09r7mqawMkf0jIAyjUTUZJzKVLmGJQBzcGmlZMJv487wHj/rBdWttD3owHk+95wLcDAJ RfetHZM2MELh/FBfRDulA+Kz Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Jul 2022 01:14:10 -0700 IronPort-SDR: hFfG8tBt2UxA3j9/mQu8hNAy5BZQAy1BKWjtYn45sMHyWXcxca3NDlW/oyMQLDwW/OUYFLKHYb PrCOqxX4GT6JBd/yD6w8nWaFZEXZHFi3uu8aduA10lKeK3mn9RoYTGProA+5buqUxCegY629SV mK9TUtp1hs2eUu49Jl8Fik5g5oE38gBoifJ0Vwl9aFmFKc+bYZFcdscQxYJwKel8Q2b/nRsqCi 7svdbUBHOZ6uRiN91jqiW78YHwLYv/AOlZ0sAwE+twE4glMgxDTfPc+BYxF6RXuv4cnmb15t0L /Ks= 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; 27 Jul 2022 01:52:58 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 6/6] srp/rc: allow test with built-in sd_mod and sg drivers Date: Wed, 27 Jul 2022 17:52:51 +0900 Message-Id: <20220727085251.1474340-7-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220727085251.1474340-1-shinichiro.kawasaki@wdc.com> References: <20220727085251.1474340-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 )