From patchwork Tue Aug 23 00:11: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: 12951556 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 23D65C28D13 for ; Tue, 23 Aug 2022 00:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239058AbiHWANd (ORCPT ); Mon, 22 Aug 2022 20:13:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239059AbiHWAMi (ORCPT ); Mon, 22 Aug 2022 20:12:38 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EEDD5755F for ; Mon, 22 Aug 2022 17:11: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=1661213517; x=1692749517; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jTZXUzzS2AomIcHu5Uz4hCAu6Gt+l0cufOy8BrFzpk8=; b=bdpEmhpM4ev2F6jAItAv+1anWY4DZpMSOlW+Z5zXsZZo5UYdRP7dzyW/ wUrolzkydwU8qAqIC1XKa+mAdMjUp6ATpUGg+FEq9nuCnZx2M3tdfSFBr KpJe20w5n+5qEsRHEzW5sm3ZZ5yEY7XI/xxkrbxCMgAjjPncomiUX0AW7 q1Sm47/4tAPrv9TjCcgeXQu9bnCzzCmG+8KrKH5BogbfxTodfTxZAYJeA ehWP6hYMLP9te9my3TP/+aVVvyveLHYCiemolQtiZ8UJfTwy62DSrVbP+ 1Dr88VNA0kufRPVixSVYb9n42jDr4FO6BTLnk96+wLokoG2MK1CekvsQG A==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645295" 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; 23 Aug 2022 08:11:56 +0800 IronPort-SDR: IjkvYGWUEIoQd1U+TxbXAxg3Br+5yPT7zq95FnhWUeo6dtCMVQ+JMxYQf0RJ5KKXUxuGiqaN7U /ICHLi7FflDPvynlJbe7dyXmXXIGSGiFjG6YWNiZIskXpaoEo8iLN2kl1bVSaeyhtl8R72vwOA d/8ql92Uy52HMFazWP5qVaunbvP2nJ9Jd2MAt3Yrry+mJfMSobtImoVHx0aK2S/cqcZ9tet+mL B6eDV4hDWydfeo0e+d0W9kK6DeJxhkLnqUNQQKOXou+89h76IdmEzZ/2Lx2liRN0Ol9g5omRtE WFNRaufMLTEloZoYYEEAYDpz 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; 22 Aug 2022 16:32:36 -0700 IronPort-SDR: ++/SEFyC9olSlb2UA5TRuuivaCd7UXuWgiCb5fdmU53yqdef0NSBUnBKhah0x0Eg8pTEUBe2/g fXJDzkjH9VtTFfijKjnSzCSF3hZTQGhmqFhOoXlZdMiBoi6+EAOdd81uGu1Z6j8iphu2giglj6 f+kB6ejHNpAFYsvyOIhk0gy+QrEwqrO68JzA5aR52TE2ghIQmv+qWLjo4vSPIfVNKPKn+dIEJ+ YpbEsXSdwDKhrvxkXDh/iXN1LV7JWsXZ1m3RriwnyH72BxYgJ4qiMA6ZHFVsncSKr5R6ersPvx jGw= 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; 22 Aug 2022 17:11:56 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 1/6] common/rc: avoid module load in _have_driver() Date: Tue, 23 Aug 2022 09:11:48 +0900 Message-Id: <20220823001154.114624-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-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 Reviewed-by: Bart Van Assche --- common/rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 01df6fa..5b34c60 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 Tue Aug 23 00:11: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: 12951557 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 58B09C32792 for ; Tue, 23 Aug 2022 00:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239074AbiHWANq (ORCPT ); Mon, 22 Aug 2022 20:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238938AbiHWAMk (ORCPT ); Mon, 22 Aug 2022 20:12:40 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E405722D for ; Mon, 22 Aug 2022 17:11: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=1661213518; x=1692749518; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P+dzON1EaG+p3+uSBAk03JFfGaNTV71TpQFCrs4EsXU=; b=Cz5EDrIgjnrpO3rlkHBlKJcQwPshuQM+J/EiGkxc/hEpWUfEwDJ3zk+r iXsm93FO88rm12o1scOrk2gw7HJO/EfszqcKijS0+28M01rr4xorTrwuH oNAb3RTCJr3teDy9Dx1fnKGzG9ji7lKb/ABIkABgJqhZAxTpfsIhfAvmx aZOcIHz8w2FhQNY2Bdvh7CRkF4by9Zlyf/rh7RV9hxM5iB/a+vJc1q26D b5cNNSpIah3Yv45OKPF8Go/UfIKQBXXPhTvjp+zN4EvFQC+y6tpXSLDXb XnmovNnPTS0Urh0HbSfyd+WGMaPUi/Ilfl/zTIeNCOWIVPPE9LKwOYELc w==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645297" 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; 23 Aug 2022 08:11:58 +0800 IronPort-SDR: PAiRfLrc/G5j9FZuJ6bgsEXoVFvkwqyNWnKyaj7OfSgMsQuFJm8K3doz2IDeCIbhi67TB2Ov38 7tQpHX6yVnRAPKq71QZh+X2pmXY1BUafLrQMDJVFZGIw14kys6EzhGX5J2EhCuVvD36s9E34HM SCzH7BCCbTFG9Ufd+2FaB3GFN8o1fieDCPwoMv47whVCx0g3JsS3kcTC6/mAHADA1C3gXCFi5C ltdM6YcLkIoMJVQOmBDq6rTc9d8ECSH2F8Cn6PmoHcq+6xbLYuXviIltStg1qywR5+GhUsmITA Qzqj/vSB7yH/57A1ym2Rneqc 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; 22 Aug 2022 16:32:38 -0700 IronPort-SDR: bF/GWDZyvwy0u0ZT2WDrRjxJ4u88M/bfzMYDS7i5ZhNKio/z+Jv56tVovQotaA1874eAfyMhZs mLu2+dwrrdt3okF/UpSDyPive7yiKmkzjIMjEJ30WRYLW0Rfa+rIYXdyC3v/YSAl1tQ/Er2xw9 FTeFLZC2sz5a513RwuY8LyJVHmLhKK4/zUHUqmtshR3wgorxkbaAtsYYR5th47aJPiPf5eLUzr 2oBhe7gFpZkk1yOBNy1CWldv/0jOqLh3yRTwZ8OrY5XsFLacsMmIywfxaLD20U1iqIs9EGPPub vOo= 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; 22 Aug 2022 17:11:57 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 2/6] nbd/rc: load nbd module explicitly Date: Tue, 23 Aug 2022 09:11:49 +0900 Message-Id: <20220823001154.114624-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-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 Reviewed-by: Christoph Hellwig --- 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 Tue Aug 23 00:11: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: 12951560 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 0B0C3C28D13 for ; Tue, 23 Aug 2022 00:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235552AbiHWANt (ORCPT ); Mon, 22 Aug 2022 20:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239090AbiHWAM7 (ORCPT ); Mon, 22 Aug 2022 20:12:59 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CADFA57574 for ; Mon, 22 Aug 2022 17:12:04 -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=1661213524; x=1692749524; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4/XFfV4kCUhvf4bZuDwajupxV3MKZBJzi/NHaXHlh/w=; b=giYEQxXF2NRdPS4OpQTsNfn9W4AfRoCxnVrPJd6sP5oXM4XLFYl7T4Ho Q9gIfX+rMrQMqtBDRIpcFTrgIQNMOiJ3SgJKAAqiR/QHOso6bCdHy3HB3 z31I/l95bNb70lh3cFwdOFb4U4rLAD3SKdbeYfLBv7lEdM64umgm+2Jc9 UAFmzWl3FAAM3m7E3m40m+ytfa2plq529p5YYRme3SXhgaWpCQKuHb3Ja 0jIL5QAhxKZ7kkPz0wmB/+eWokwHLg9VRGpNWrU3ooSKhVc0erB/JaHa2 Yn3pHIVa/pzPPqJ7Ms9J+hq6SdhTZ4mrH7D/v9QMUX3epKTdgZNLzwcYT w==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645299" 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; 23 Aug 2022 08:11:59 +0800 IronPort-SDR: UnkEELwsD7+IbALB404XNVbEYulUSo9HluaRoTZnMgU2xGxqnbeRTQZg/br1nLKmh+cmDMv5Vb CATprOqmHWwK/DRIk7NMRBqt7FBlFgP4WGKz1bmpW5ly0LUdI5inaPP0giRHiiKbapt3E+ug3L RbKdigR2xBzEGhVWn4azlcIq6HaboGL7ICx3R9JvT1ejLklQLSGRp4gnnx0fUPOcZSCLUcgXvz KZCwOVZrAYhW2YpSiDO6nW5Nyf23rbPhd3Diz1xOKuNb4qQjeIMq9T69aJo+qWLldpeS/qvBh0 CAGMV6k2Xb99Qp/1iQp3/Jt8 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; 22 Aug 2022 16:32:39 -0700 IronPort-SDR: Vt9Ro6Ar2qSjXdRkXRDeX9tuzM7lfvBTPghLO4WWFeTzRGmOo+fmNOZNypL6a+uVQcwx8wKZCX CEO0iY/dvGRtMkYb/0ujHrBa0IieabCnVAZRacr26Pfpgjs66mWQ6EnHtYgZnzN+p3MJtaRFEw WjyQ/v5BBHG+R5NzoHwJapnnlRS55f1J7s9uSHze7PTuCvT6pPGF48qczK4CqivAqH9WbB0Jfc gf7ArzcSxkIwdO2BbcgKG88Q342b7V9VSA1V28i3W6pdmlT6gUXhJ918r5s2f9h2M90P1dZ5yF yFw= 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; 22 Aug 2022 17:11:58 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 3/6] common/rc: ensure modules are loadable in _have_modules() Date: Tue, 23 Aug 2022 09:11:50 +0900 Message-Id: <20220823001154.114624-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-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 Reviewed-by: Christoph Hellwig --- common/rc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 5b34c60..8681a46 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" -o \ + -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 Tue Aug 23 00:11: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: 12951559 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 0B269C32792 for ; Tue, 23 Aug 2022 00:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239127AbiHWANs (ORCPT ); Mon, 22 Aug 2022 20:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239080AbiHWAMk (ORCPT ); Mon, 22 Aug 2022 20:12:40 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0280757576 for ; Mon, 22 Aug 2022 17:12:04 -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=1661213524; x=1692749524; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=at2tOZdLHOH8i8ObFqSTHPkq/kSI/3sKjiuvGcoXHcI=; b=E53OsWe6aVNFehMob32kkabG43H6O1wnpqN4YfeNdpws8KemEzsCHGXF 2FRU3+ZSt5I43XqLuiFgX9k+DddCrlYoBXVIsg7UJ99mQkfur7G6yZGB8 Bqq8XjZnYgaEaq4H+Ifgh4sFuhuUDHoaG9N+xTevtTtvrL+yRkengkRv/ lIwI0kWnbs32TTkPB9UClbA5IYru7zQkB8FZ/10uom8+2Qsg8MR+dQfNi x2dazTY3a2bO+24KuMqMKiN68eZ1f+cOQWxEPjhK9KRYYASPlAp112kZu GR3rxgZkRr3kbHOKYdl7yJzyc06qMIQpkCG4RT3tKr3emhDdC0M83aqpp g==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645300" 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; 23 Aug 2022 08:12:00 +0800 IronPort-SDR: M8DXVMwGGNaZIP1CUgUyFyQcYqHGgHFDu8koOCckwoVIvy0DPXAOYyBDmh60YCvPnyIZ4JjaLw Gw54zdJm6X4GiFgu+XOu7ii5r1Eof9INDglY2QeEe0hIUqEVVdtO2A3Yjafq6NXGubkA31M9E5 Pprk4QGyYSBwAHBA2bzYiUZbL7APlKW0TA2RxKIUQ/a9Gt8X7/jLm5TR8qefZXS2nzIY/KOJde 4agdINF7padccQ4DV6E7C44uqtVENC9X4N/Qxak8LidHUjuQW2/VlDA5mhJt5007DaZ9M5V0WM KJ2Co2drV6V1eLA5snUf2Nsj 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; 22 Aug 2022 16:32:40 -0700 IronPort-SDR: 0QpxU9YnYHRPOLEuSe21Ox7qNAkqgJHDxNVvQ8qAO1ArX2umZVC6pJppUm+EEi4j4ASJeEBEZb a3pBAbAoXsQmV82ARw3VdsxDCeHeQzTdNtXcihZbNBQX0qIxu4PwvFr/b/mRheCDjIAAYVgCTr NvYqaqciNEZSXkowvaD+92eMfyFovsyNxnO+W223lIkRwtxp9LN602zSEnFCoatwljmHvyRl/y wn3PZClrF9eCDy+gVcajlySXii640gK/Uw9olJxIEGjSK2cJHvwn+KPaC6KQtbCDuPeLN0GE3D JFY= 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; 22 Aug 2022 17:11:59 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 4/6] block/001: use _have_driver() in place of _have_modules() Date: Tue, 23 Aug 2022 09:11:51 +0900 Message-Id: <20220823001154.114624-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-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_driver() and allow test with built-in modules. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/001 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/block/001 b/tests/block/001 index 5f05fa8..fb93932 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,7 +13,9 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_scsi_debug && _have_modules sd_mod sr_mod + _have_scsi_debug + _have_driver sd_mod + _have_driver sr_mod } stress_scsi_debug() { From patchwork Tue Aug 23 00:11:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12951558 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 3862EC28D13 for ; Tue, 23 Aug 2022 00:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239125AbiHWANr (ORCPT ); Mon, 22 Aug 2022 20:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239015AbiHWANA (ORCPT ); Mon, 22 Aug 2022 20:13:00 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53825757B for ; Mon, 22 Aug 2022 17:12:06 -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=1661213526; x=1692749526; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rT85oT/MXoAQesbzieTU6OjeJzP2KtJtZIMvb45VVa4=; b=AOyIFZfEGiHfwpDBUN/R60OtVjuYriPyQLyvgIMdpPS8JFqmxjwfAX6n fpiPj4rCl3rL0OAE5jatpDL61T5949Y2EL0+OGSXvCzNMcjMzXu5ctWON 78gVEaga+83Qd2arNVkDypYwe7BCM43iLFTtcBjDfMgSRxDanXE8OgW+x OuCJ3d41WY6x9Bef5AK/TUtE3mwpE3Tcfgg1imYairvTEjVmdtkkbTRGl Q7mt4Be69LbVWojjZmkUZIrZLfaUDohTTOqkhDVXe2E+o4qhucbN4BHrd zjXtkpjGlFX3XujEJQ2PyzqGjkJAq70g7mUQSM+xkLOyQsNgm6jX7me3P w==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645302" 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; 23 Aug 2022 08:12:01 +0800 IronPort-SDR: rbrN4lVR/3LEgG+v6A4uy7/CA26P6sbi4HUxVKhNeUsNhF+ZuJE+BiQ8Jl7x3MCckaRHz/AoPe pKwf6lvXxekf8V60+OqcC4S9VYkW/WJbh/YfWehEMPfy+fE+QED53HQHasr2ELvHW1Rbz3OLN9 nNG9WtYyPw2syNYoyRAxn1NLk6QQdFpL2oS8t1dbI0HnZZKn7yqgk+dsVcb0+5kbWrBuowaz8l a/l90lYJt0tecXG+DoyoZxamEfpLm2TUikW7EcCny99P6CSiRrRWSoUz3PoFAScoaP5sU9Itku UtCr49iq7SSrIp4l0UwnPJn5 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; 22 Aug 2022 16:32:41 -0700 IronPort-SDR: ewm1CRR0jFgGhyTlsnh1bHFK6XbN39zci7RMS7XCclDut7dfapv6HOdbTq1GD3twD9QP69+ixK dNiFwY3/eSpNcuhWp6VmxhFdrd1S3vFw2iweCc1QXau02FQWQeBp0jqGK9oe/w2vqRhjyvj6nf PcUTjHPhgklxlIUNo5WuiYqdwFS/2u+ivA9aEQDBih+ZPhmu1ol513phevmNDoX4UI1Fte+qYv D1baf52W4SEGD808d5g+w+IC3LJAPYv7G/PmYsPbOncP7VO8f70z2eegaTlhVt7uwDwOCnBFo1 SJA= 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; 22 Aug 2022 17:12:01 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 5/6] srp/rc: allow test with built-in sd_mod and sg drivers Date: Tue, 23 Aug 2022 09:11:52 +0900 Message-Id: <20220823001154.114624-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-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_driver() in place of _have_modules. Signed-off-by: Shin'ichiro Kawasaki --- tests/srp/rc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/srp/rc b/tests/srp/rc index 94ee97c..13dddf2 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -35,6 +35,8 @@ group_requires() { SKIP_REASONS+=("LIO must be unloaded before the SRP tests are run") return fi + _have_driver sd_mod + _have_driver sg required_modules=( dm_multipath dm_queue_length @@ -51,9 +53,6 @@ group_requires() { scsi_dh_alua scsi_dh_emc scsi_dh_rdac - sd_mod - sd_mod - sg target_core_iblock target_core_mod ) From patchwork Tue Aug 23 00:11:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12951561 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 5C290C32774 for ; Tue, 23 Aug 2022 00:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238561AbiHWANu (ORCPT ); Mon, 22 Aug 2022 20:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238261AbiHWANR (ORCPT ); Mon, 22 Aug 2022 20:13:17 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBC55788D for ; Mon, 22 Aug 2022 17:12:09 -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=1661213529; x=1692749529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rcWAWKQ+gQlcpUMQfxKLW7gJ8sGcBFqT00P9MNyZgyk=; b=i2b+LImNvh1QSkYugKkBhEyYYz/H5AzmT4iMKBqkVwaWwgZKMB9FJxCX uJ3gjJ+V8ffHB1LuBG3WaRdz5uYMMyW01PbVujo0gPP8uQ5IpB9w4qk/D GeWNLF89WL7tNN9ne+DEWe8BFKxsC6DTKR0+5IyUIsWm4lBf0At8W9ABv 9tb6Nr7KbBK3Wc6+0ER80+gjSzUQMIl1sXJ3ivdDXT2o1+VCIMrLruqEh c1fdpecFUdVa7/i9P1//1sl3w1yViaoBeX+9pWL5kNZ183tNWhGzYGRhy uIETW1XvHi637mgaG06tfNNj+GToRTfwjnn/ACu0fQIInovgmLbXf93I8 g==; X-IronPort-AV: E=Sophos;i="5.93,255,1654531200"; d="scan'208";a="313645303" 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; 23 Aug 2022 08:12:02 +0800 IronPort-SDR: o+waiWYaA3pfwVhGEGJK5ARLHHZyboKAyRk1gaqNDYZEsoxCHO4tKTRlnMeQ9QxbjlPGAa2ejH nyOd01k5IRlR+axrcutOWCmez2+s4KexyUAhiD9CPYiOADPvWtlbCU9EEqGD9Nms2lSovb7qmA oQvXxoBgUbR2d7oM99uhvDC1qbC4SdHkVlDKBpRy0kxCZgI5gWHIRebjW0yZX7dr5ndqT5l7rR u+tveQ+817taaVYq1nDZxrhiumAhk6w6Rx96tW9r7i8u4+DW6orUJhl3xqPL/K5KQ12ALP+StC ZZmeAoenWUOE7n8nolYIwH4+ 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; 22 Aug 2022 16:32:43 -0700 IronPort-SDR: CZN0W3mU2MoQfqsg5Fz6vyy4IgdyikuoDQcHZ3RUC0TxxLJdV2JvtcJFX+x5tVhozumbbkft89 5Pm5TTdZ/Q2oYQxzvs837hdcoSBLv1eP8C6ougDQXJ/kUYOtbNxoJHWuAdYtbRK3vD1eNKhraI 6muDeudRJmsGAGIf1iN0fpVJaw2t4ezixpLtncwJseNnxbsZX678PpecWM4G3IjiK3+jRj5Q6+ kNnO2HJ4diJj5tqSRN9MURFn4D2gRcGMeiFX1rNoApfj0wA8iABLsHv7d9sn0wCLHhvGoctLFZ dTo= 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; 22 Aug 2022 17:12:02 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v4 6/6] common,tests: replace _have_modules() with _have_module() Date: Tue, 23 Aug 2022 09:11:53 +0900 Message-Id: <20220823001154.114624-7-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> References: <20220823001154.114624-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The helper functions _have_modules() and _have_driver() have similar roles, but they take different number of arguments. The former takes multiple module names and the latter takes single module name. To make their usage consistent, modify _have_modules() to _have_module() to take single argument. This improves readability by checking one module per line. Signed-off-by: Shin'ichiro Kawasaki --- common/rc | 19 ++++--------------- common/scsi_debug | 2 +- tests/nbd/004 | 2 +- tests/nvmeof-mp/rc | 32 +++++++++++++++----------------- tests/srp/015 | 2 +- tests/srp/rc | 40 +++++++++++++++++++--------------------- tests/zbd/010 | 2 +- 7 files changed, 42 insertions(+), 57 deletions(-) diff --git a/common/rc b/common/rc index 8681a46..be69a4d 100644 --- a/common/rc +++ b/common/rc @@ -57,22 +57,11 @@ _have_driver() return 0 } -# Check that the specified modules are available as loadable modules and not +# Check that the specified module is available as a loadable module and not # built-in the kernel. -_have_modules() { - local missing=() - local module - - for module in "$@"; do - if ! _module_file_exists "${module}"; then - missing+=("$module") - fi - done - if [[ ${#missing} -gt 1 ]]; then - SKIP_REASONS+=("the following modules are not available: ${missing[*]}") - return 1 - elif [[ ${#missing} -eq 1 ]]; then - SKIP_REASONS+=("${missing[0]} module is not available") +_have_module() { + if ! _module_file_exists "${1}"; then + SKIP_REASONS+=("${1} module is not available") return 1 fi return 0 diff --git a/common/scsi_debug b/common/scsi_debug index 95da14e..ae13bb6 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -5,7 +5,7 @@ # scsi_debug helper functions. _have_scsi_debug() { - _have_modules scsi_debug + _have_module scsi_debug } _init_scsi_debug() { diff --git a/tests/nbd/004 b/tests/nbd/004 index 98afd09..deb9673 100755 --- a/tests/nbd/004 +++ b/tests/nbd/004 @@ -11,7 +11,7 @@ DESCRIPTION="module load/unload concurrently with connect/disconnect" QUICK=1 requires() { - _have_modules nbd + _have_module nbd } module_load_and_unload() { diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index b7ca611..ed27b5c 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -12,7 +12,7 @@ nvme_port=7777 ini_timeout=1 group_requires() { - local m name p required_modules + local m name p _have_kernel_config_file || return # Since the nvmeof-mp tests are based on the dm-mpath driver, these @@ -25,22 +25,20 @@ group_requires() { fi _have_configfs || return - required_modules=( - dm_multipath - dm_queue_length - dm_service_time - null_blk - rdma_cm - ib_ipoib - ib_umad - nvme-rdma - nvmet-rdma - rdma_rxe - scsi_dh_alua - scsi_dh_emc - scsi_dh_rdac - ) - _have_modules "${required_modules[@]}" || return + + _have_module dm_multipath + _have_module dm_queue_length + _have_module dm_service_time + _have_module null_blk + _have_module rdma_cm + _have_module ib_ipoib + _have_module ib_umad + _have_module nvme-rdma + _have_module nvmet-rdma + _have_module rdma_rxe + _have_module scsi_dh_alua + _have_module scsi_dh_emc + _have_module scsi_dh_rdac for p in mkfs.ext4 mkfs.xfs multipath multipathd pidof rdma fio; do _have_program "$p" || return diff --git a/tests/srp/015 b/tests/srp/015 index e03b204..d303921 100755 --- a/tests/srp/015 +++ b/tests/srp/015 @@ -10,7 +10,7 @@ TIMED=1 requires() { # See also iproute commit 4336c5821a7b ("rdma: add 'link add/delete' # commands"). - _have_modules siw && _have_kver 5 5 && _have_iproute2 190404 + _have_module siw && _have_kver 5 5 && _have_iproute2 190404 } test_disconnect_repeatedly() { diff --git a/tests/srp/rc b/tests/srp/rc index 13dddf2..23f87e4 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -28,7 +28,7 @@ is_lio_configured() { } group_requires() { - local m name p required_modules + local m name p _have_configfs || return if is_lio_configured; then @@ -37,26 +37,24 @@ group_requires() { fi _have_driver sd_mod _have_driver sg - required_modules=( - dm_multipath - dm_queue_length - dm_service_time - ib_ipoib - ib_srp - ib_srpt - ib_umad - ib_uverbs - null_blk - rdma_cm - rdma_rxe - scsi_debug - scsi_dh_alua - scsi_dh_emc - scsi_dh_rdac - target_core_iblock - target_core_mod - ) - _have_modules "${required_modules[@]}" || return + + _have_module dm_multipath + _have_module dm_queue_length + _have_module dm_service_time + _have_module ib_ipoib + _have_module ib_srp + _have_module ib_srpt + _have_module ib_umad + _have_module ib_uverbs + _have_module null_blk + _have_module rdma_cm + _have_module rdma_rxe + _have_module scsi_debug + _have_module scsi_dh_alua + _have_module scsi_dh_emc + _have_module scsi_dh_rdac + _have_module target_core_iblock + _have_module target_core_mod for p in mkfs.ext4 mkfs.xfs multipath multipathd pidof rdma \ sg_reset fio; do diff --git a/tests/zbd/010 b/tests/zbd/010 index 6d634b0..35143b8 100644 --- a/tests/zbd/010 +++ b/tests/zbd/010 @@ -12,7 +12,7 @@ QUICK=1 requires() { _have_fio _have_driver f2fs - _have_modules null_blk + _have_module null_blk _have_module_param scsi_debug zone_cap_mb _have_program mkfs.f2fs _have_scsi_debug