From patchwork Tue Apr 25 11:47:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13223212 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 52F06C6FD18 for ; Tue, 25 Apr 2023 11:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233424AbjDYLsT (ORCPT ); Tue, 25 Apr 2023 07:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233539AbjDYLsS (ORCPT ); Tue, 25 Apr 2023 07:48:18 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC28413C2C; Tue, 25 Apr 2023 04:48:03 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 2C8F52B066F9; Tue, 25 Apr 2023 07:48:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 25 Apr 2023 07:48:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682423282; x= 1682423882; bh=8g6EvhdGCq2wC/q3XFsQYHoYVIEBXGvDsLbPrkyIUkQ=; b=k XBn7XL/In3YgAEuibI+1IYbwkaJULRx+diZaeSf4vVNwkGl8ZJB5fE0B9jaU52fV f7eIDWnClKRcvCqOQsxOn0UUTN8AY4qurqKHUVXbYece0xjpZydf+e/rm6Aq9TaQ ov1/MmzbhlwSJG7ez906KC3GrtdwcwLMakwqzJgnEiWH+pAF+9g55iC/ZjpRpBwx 2NqanMLYcecsfs0MHDOubUgSzEvV9lhWFNgMqme/ab+okOVuzKpQmxfkd9cLIi12 +qy0cpln7yCTYN15FHu9kAOJ5X2aaJsv8L61IWTcZ/BIjrFVqw397KPzQQUAm27l ymMHn9faqZumvRXuj7RtQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=ie1e949a3.fm3; t= 1682423282; x=1682423882; bh=8g6EvhdGCq2wC/q3XFsQYHoYVIEBXGvDsLb PrkyIUkQ=; b=a4siOPpH/tpxgIo5/8DUQ2XEznd2FpbRksvChb9Uz15o7SC9sRq QzBR/Clv/amqutN96drOrloiRhAa7Au9LIdUR4utsRcpeHlRxq0O2spCNsrO1Z9m i+jz+CvhU4wkr5qQFIwIzVuBwleio6avHJ1Qgr4DuKS00k9jSJU5w8j6NjnPEEot aNyPhQzsM4xmdgClpsRXcmYlgffS6HJSedpPv0E2Ul9fIzsOI7pDRR6LvF6nlWBp rrIE5lDzGjboDGdiZpfEQBtfr7NAZgO+5wy7cwXaHYdzfWNlxCPIw3A3M2zDFV89 XulN92g1Rw5NHb9ZbHtx/GL/bPIliY49y2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 07:48:00 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 1/6] common/rc: skip module file check if modules path does not exist Date: Tue, 25 Apr 2023 20:47:40 +0900 Message-Id: <20230425114745.376322-2-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki When all of the kernel modules are built-in, /lib/modules/*/kernel path may not exist. In this case, check for the path results in failure. Skip the check when the path does not exist. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- common/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/common/rc b/common/rc index af4c0b1..f67b434 100644 --- a/common/rc +++ b/common/rc @@ -36,6 +36,7 @@ _module_file_exists() local -i count libpath="/lib/modules/$(uname -r)/kernel" + [[ ! -d $libpath ]] && return 1 count=$(find "$libpath" -name "$ko_underscore*" -o \ -name "$ko_hyphen*" | wc -l) ((count)) && return 0 From patchwork Tue Apr 25 11:47:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13223215 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 08A4BC77B71 for ; Tue, 25 Apr 2023 11:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233977AbjDYLs0 (ORCPT ); Tue, 25 Apr 2023 07:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233908AbjDYLsY (ORCPT ); Tue, 25 Apr 2023 07:48:24 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5EE083F0; Tue, 25 Apr 2023 04:48:06 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 27F9D2B066FA; Tue, 25 Apr 2023 07:48:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 25 Apr 2023 07:48:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682423285; x= 1682423885; bh=g8baYDk7aVrvyjffaFc8A3P2vBztf7fqyBAqrD5H8oY=; b=t ukT+SMbV3yIq0hsnyiJn/EEYy5Nv+ygK/TWooG58Oj/me/O0E8GaQZenX8ajqrT5 H7XPqGP446V0KAhueQvu0sRdpMFoLQiGgWqFEP4fCO/G2lCVOVFDBIuRWgrt+BiP P18k1k35/rfrj38sI53bPSmHspCTqBd9VXGSownuaAZ91atZY9NeJdRpVr+uxQB9 Yv6fCH5RGvgZwo19aG8CUltJOhAYoJWgk2E6zQf5372tUshiXw1sJja3EhajcycU YciJ/68lCGggzhVkJxB5w8G+6JLx3gXczylEuA3qrHC/Md4lE1FyfDtK6swEfe5p 0MVzkSWTCXxjZ+RNgu2uw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=ie1e949a3.fm3; t= 1682423285; x=1682423885; bh=g8baYDk7aVrvyjffaFc8A3P2vBztf7fqyBA qrD5H8oY=; b=Ny72jVuM+5luDrvKCoMwPI9V+5AtsJKbeYtaTHR9Ivimn3PHRX7 KXpLBGnvtRKBGuVhz4hlvhRk69DZBbJwcHwAORtHF13P28nB6r5t8/uQAiqEhWYe md4Q9APQwMYf6DUUHiryHqFC9o+7UpiXDGqcqIBIfiX92V51CD9QvT1A09t6bMsb m+xw2RJ/yW39Rein3haR1YIplFcsrRNKNfbgdTbi9DQ0zB8WJjvJEmn6ZHsFdEBj YpMvAsf0ymOL1aRdfbJAtAle2vpCoKDWAjg7gzT0EU8p2hqsvmOhl2adiPMtZjxy hbroKQldEyGna8s3PnUVoYgaiWq7KHs2SMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 07:48:03 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 2/6] common/scsi_debug, tests/*: re-define _have_scsi_debug Date: Tue, 25 Apr 2023 20:47:41 +0900 Message-Id: <20230425114745.376322-3-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki As a preparation to adapt test cases to built-in scsi_debug module, re- define the _have_scsi_debug function. It checks that the scsi_debug module is built as a loadable module. Modify it to check that the scsi_debug module is available as built-in module or loadable module. Also replace all _have_scsi_debug calls in test cases with "_have_module scsi_debug" so that the change of _have_scsi_debug do not affect the test cases. Following commits will modify them to call _have_scsi_debug, only for test cases ready to run with built-in scsi_debug. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- common/scsi_debug | 2 +- tests/block/001 | 2 +- tests/block/002 | 3 ++- tests/block/009 | 3 ++- tests/block/025 | 2 +- tests/block/027 | 4 +++- tests/block/028 | 2 +- tests/block/032 | 3 ++- tests/loop/004 | 5 ++++- tests/scsi/004 | 2 +- tests/scsi/005 | 3 ++- tests/scsi/007 | 2 +- tests/zbd/008 | 5 +++-- tests/zbd/009 | 2 +- tests/zbd/010 | 2 +- 15 files changed, 26 insertions(+), 16 deletions(-) diff --git a/common/scsi_debug b/common/scsi_debug index ae13bb6..5f73354 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -5,7 +5,7 @@ # scsi_debug helper functions. _have_scsi_debug() { - _have_module scsi_debug + _have_driver scsi_debug } _init_scsi_debug() { diff --git a/tests/block/001 b/tests/block/001 index fb93932..2ea3754 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,7 +13,7 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_scsi_debug + _have_module scsi_debug _have_driver sd_mod _have_driver sr_mod } diff --git a/tests/block/002 b/tests/block/002 index 05d00d2..a5f3ee5 100755 --- a/tests/block/002 +++ b/tests/block/002 @@ -12,7 +12,8 @@ DESCRIPTION="remove a device while running blktrace" QUICK=1 requires() { - _have_blktrace && _have_scsi_debug + _have_blktrace + _have_module scsi_debug } test() { diff --git a/tests/block/009 b/tests/block/009 index df36edb..d3ea42a 100755 --- a/tests/block/009 +++ b/tests/block/009 @@ -12,7 +12,8 @@ DESCRIPTION="check page-cache coherency after BLKDISCARD" requires() { - _have_scsi_debug && _have_program xfs_io + _have_module scsi_debug + _have_program xfs_io } test() { diff --git a/tests/block/025 b/tests/block/025 index f746c1c..4c48e9f 100755 --- a/tests/block/025 +++ b/tests/block/025 @@ -12,7 +12,7 @@ DESCRIPTION="do a huge discard with 4k sector size" requires() { - _have_scsi_debug + _have_module scsi_debug } test() { diff --git a/tests/block/027 b/tests/block/027 index b60f62c..ab6369b 100755 --- a/tests/block/027 +++ b/tests/block/027 @@ -19,7 +19,9 @@ QUICK=1 CAN_BE_ZONED=1 requires() { - _have_cgroup2_controller io && _have_scsi_debug && _have_fio + _have_cgroup2_controller io + _have_module scsi_debug + _have_fio } scsi_debug_stress_remove() { diff --git a/tests/block/028 b/tests/block/028 index 5140d94..13b3278 100755 --- a/tests/block/028 +++ b/tests/block/028 @@ -12,7 +12,7 @@ DESCRIPTION="do I/O on scsi_debug with DIF/DIX enabled" DMESG_FILTER="sed -r 's/(guard tag error at sector|ref tag error at location)/blktests failure: \\1/'" requires() { - _have_scsi_debug + _have_module scsi_debug } test_pi() { diff --git a/tests/block/032 b/tests/block/032 index b07b7ab..8975879 100755 --- a/tests/block/032 +++ b/tests/block/032 @@ -13,7 +13,8 @@ DESCRIPTION="remove one mounted device" QUICK=1 requires() { - _have_xfs && _have_scsi_debug + _have_xfs + _have_module scsi_debug } test() { diff --git a/tests/loop/004 b/tests/loop/004 index fab34e8..ca52d80 100755 --- a/tests/loop/004 +++ b/tests/loop/004 @@ -11,7 +11,10 @@ DESCRIPTION="combine loop direct I/O mode and a custom block size" QUICK=1 requires() { - _have_program xfs_io && _have_scsi_debug && _have_src_program loblksize && _have_loop_set_block_size + _have_program xfs_io + _have_module scsi_debug + _have_src_program loblksize + _have_loop_set_block_size } test() { diff --git a/tests/scsi/004 b/tests/scsi/004 index b5ef2dd..f0845c1 100755 --- a/tests/scsi/004 +++ b/tests/scsi/004 @@ -18,7 +18,7 @@ DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command" CAN_BE_ZONED=1 requires() { - _have_scsi_debug + _have_module scsi_debug } test() { diff --git a/tests/scsi/005 b/tests/scsi/005 index 22fb495..efd3d82 100755 --- a/tests/scsi/005 +++ b/tests/scsi/005 @@ -11,7 +11,8 @@ DESCRIPTION="test SCSI device blacklisting" QUICK=1 requires() { - _have_scsi_debug && _have_module_param scsi_debug inq_vendor + _have_module scsi_debug + _have_module_param scsi_debug inq_vendor } test() { diff --git a/tests/scsi/007 b/tests/scsi/007 index e7088a1..547a735 100755 --- a/tests/scsi/007 +++ b/tests/scsi/007 @@ -12,7 +12,7 @@ DESCRIPTION="Trigger the SCSI error handler" QUICK=1 requires() { - _have_scsi_debug + _have_module scsi_debug } config_hz() { diff --git a/tests/zbd/008 b/tests/zbd/008 index c625bad..55b5b6c 100755 --- a/tests/zbd/008 +++ b/tests/zbd/008 @@ -13,8 +13,9 @@ DESCRIPTION="check no stale page cache after BLKZONERESET and data read race" TIMED=1 requires() { - _have_scsi_debug && _have_module_param scsi_debug zbc && - _have_program xfs_io + _have_module scsi_debug + _have_module_param scsi_debug zbc + _have_program xfs_io } test() { diff --git a/tests/zbd/009 b/tests/zbd/009 index 483cbf6..c0ce1f2 100755 --- a/tests/zbd/009 +++ b/tests/zbd/009 @@ -36,7 +36,7 @@ requires() { _have_driver btrfs _have_module_param scsi_debug zone_cap_mb _have_program mkfs.btrfs - _have_scsi_debug + _have_module scsi_debug have_good_mkfs_btrfs } diff --git a/tests/zbd/010 b/tests/zbd/010 index 35143b8..c5cb76a 100755 --- a/tests/zbd/010 +++ b/tests/zbd/010 @@ -15,7 +15,7 @@ requires() { _have_module null_blk _have_module_param scsi_debug zone_cap_mb _have_program mkfs.f2fs - _have_scsi_debug + _have_module scsi_debug } test() { From patchwork Tue Apr 25 11:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13223214 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 75061C6FD18 for ; Tue, 25 Apr 2023 11:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233966AbjDYLsZ (ORCPT ); Tue, 25 Apr 2023 07:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233901AbjDYLsY (ORCPT ); Tue, 25 Apr 2023 07:48:24 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0F2468A; Tue, 25 Apr 2023 04:48:09 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 0F5D22B066B3; Tue, 25 Apr 2023 07:48:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 25 Apr 2023 07:48:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682423288; x= 1682423888; bh=Lgv7zBNwsGhepSdHkyWfO85nqwIblTAETSpxgkvJfMU=; b=I c1Wmi7uXjgIktKuzmFOF3j4Cm6Dk58s0gEiW+fu/SxeqMVlzf2zYYZUgTjRiI/yH +yt8nqZC6/4lwkVysLN1UfX0n0GopII3Qf7djemxvCCSnt8KDLA9ITZZWkYIdQtK zY2uLxSRCEPkEwqzC8QbrkMEgVi/pw6QNZgO3aWXQU10NxsQf32tkYn0XPmoc4z5 /bs8+yTqSDZYer8BEUlHZZD1L/DitJQdQoitUAs4y3dLwzuTXVirwo81h/aTgvGf xuHt+axW4dW7MaYYBtPKCEdxMyFN7BEAO04QmjvvzLqWI2FnFuOwzVVbsYT6cDO1 DXSrGdzDUADlHfpc/oKRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=ie1e949a3.fm3; t= 1682423288; x=1682423888; bh=Lgv7zBNwsGhepSdHkyWfO85nqwIblTAETSp xgkvJfMU=; b=CaPpwUm7OI+osRv7wTKNayqZnfx1x9VKY0tZ0eGdsE9j+Bm2NQ7 ygglVzgoFxGmtRlClpCKnnXDamfOJ0in9IBUaaCTDI9nlZrTXQ9Y38CbbSLP/6RA Gtzj+FJ51aGIsrWyo2gpbbailQ8CtGoQKdsfoMLHonn9I1xCut6Avtrxz56u09HR Sfrs5gnYRZ/BYLdlmf3e/7FfKU/e1w5lPwm8mfVd4YgVAo2kihhhiTD3IxXU4hwM Y8WKPkS/7M0VZTACuemFT4V0K4//s7wGdJFKxe31IPpkRaQ2iOyyTyckblYMrp18 OPdFWCh1Tl5vHXA0qUO+pKF0PEMAuxlX4fA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 07:48:06 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 3/6] common/scsi_debug: factor out _setup_scsi_debug_vars Date: Tue, 25 Apr 2023 20:47:42 +0900 Message-Id: <20230425114745.376322-4-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki As a preparation to introduce a new helper function to configure scsi_debug device with built-in scsi_debug module, factor out a part of _init_scsi_debug to a new function _setup_scsi_debug_vars. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- common/scsi_debug | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/common/scsi_debug b/common/scsi_debug index 5f73354..0bf768a 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -8,22 +8,7 @@ _have_scsi_debug() { _have_driver scsi_debug } -_init_scsi_debug() { - local -a args=("$@") - - if (( RUN_FOR_ZONED )); then - if ! _have_module_param scsi_debug zbc; then - return - fi - args+=(zbc=host-managed zone_nr_conv=0) - fi - - if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then - return 1 - fi - - udevadm settle - +_setup_scsi_debug_vars() { local host_sysfs host target_sysfs target SCSI_DEBUG_HOSTS=() SCSI_DEBUG_TARGETS=() @@ -55,6 +40,25 @@ _init_scsi_debug() { return 0 } +_init_scsi_debug() { + local -a args=("$@") + + if (( RUN_FOR_ZONED )); then + if ! _have_module_param scsi_debug zbc; then + return + fi + args+=(zbc=host-managed zone_nr_conv=0) + fi + + if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then + return 1 + fi + + udevadm settle + + _setup_scsi_debug_vars +} + _exit_scsi_debug() { unset SCSI_DEBUG_HOSTS unset SCSI_DEBUG_TARGETS From patchwork Tue Apr 25 11:47:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13223216 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 1D58CC77B7F for ; Tue, 25 Apr 2023 11:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233368AbjDYLs2 (ORCPT ); Tue, 25 Apr 2023 07:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233942AbjDYLsZ (ORCPT ); Tue, 25 Apr 2023 07:48:25 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3C54EF1; Tue, 25 Apr 2023 04:48:12 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 11CA42B066FB; Tue, 25 Apr 2023 07:48:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 25 Apr 2023 07:48:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682423291; x= 1682423891; bh=3o57Vu+6cMoSzzSV06r+8NKcwF7Yj7YTR1aMvfIynN0=; b=L HV0Ab1C/A26Sp/b7iTkvrPEmChQs6oWfcD5R5Ynptc5++Wj3/g8m63w96iqmn9LP befD0eoRZn6mH6SxzgsXlI+vKAUdiDx+A/khwnQ2JOL1A5zJvSPUsDAsh2R64LFR 8nXdKn7VPtRS71ct/xnEHBQ7xDJvlGTekoyUdeyG4a1H0UC17awoiquSWa0khid9 JJVwxNvviGNb2CjIZnf/nu1SO+lYGjMQYbQWgPixtmGJ8FiSemVW1lFRzGjm3NsG gEPhRFEESAwgCp7rbdD8Tk/YkGImPIaa/jmLLgjn6L2dwE8FCzJqjKXnEs9ppTSO NKHdlkC+mY3Fd00KLYNYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=ie1e949a3.fm3; t= 1682423291; x=1682423891; bh=3o57Vu+6cMoSzzSV06r+8NKcwF7Yj7YTR1a MvfIynN0=; b=RvXDoIhGq5LyCC9C1F67F+1gp8GMwZp+VxZeqsRDIOvDpaO1Qjn if36CI2R3CsxwpXO84ivMf+RncvtOABKirBxcMUvB6v4XdZoeo5FR/WPtOWsevBJ 2wf2hnI+ss3+LPmsEvCK5OsRhkHv2IOuOf9H2DBUQadZI0nhqjT/OJjjk7gtZGD2 uWYYJc90XilqHOjYRX4ZuXxUJ4WCzQrjdawx6FWZ5YgMje78IzyhyTlKabRA5TTE qQeZQMYfpoTrVnHjq0zl/lhat5DplVOHwb1P1OcAya5Cf3cF3BtwL5kr9WDCbUvI 33BslNlfMteJvq7bBv4EPtC1cTOeMrdxAnw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 07:48:09 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 4/6] common/scsi_debug: introduce _configure_scsi_debug Date: Tue, 25 Apr 2023 20:47:43 +0900 Message-Id: <20230425114745.376322-5-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki To set up scsi_debug devices with built-in scsi_debug module, introduce a new helper function _configure_scsi_debug. It works in similar manner as _init_scsi_debug which sets up scsi_debug devices with loadable scsi_debug module. _configure_scsi_debug takes parameters of scsi_debug devices in format of 'key=value' as its arguments. It calls another new helper function _scsi_debug_key_path to find sysfs files corresponding to the keys in /sys/bus/pseudo/drivers/scsi_debug or /sys/module/scsi_debug/parameters. When the file is found, write the value to the file. Before setting the parameters through sysfs files, save current values of scsi_debug parameters in ORIG_SCSI_DEBUG_PARAMS. Use the saved values to restore parameters in _exit_scsi_debug. Do this value restore not only for the parameters modified in _configure_scsi_debug but also for the parameters modified by test cases. Among the parameters, 'add_host' has special meaning to add new hosts. Then handle it separately so that it is set at last in _configure_scsi_debug, and restored at first in _exit_scsi_debug. Also record the hosts which exist before _configure_scsi_debug in the array ORIG_SCSI_DEBUG_HOSTS. Those hosts should not be used for testing, then do not add them to SCSI_DEBUG_HOSTS. Signed-off-by: Shin'ichiro Kawasaki --- common/scsi_debug | 112 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/common/scsi_debug b/common/scsi_debug index 0bf768a..3d83d8a 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -8,16 +8,51 @@ _have_scsi_debug() { _have_driver scsi_debug } +SD_PSEUDO_PATH=/sys/bus/pseudo/drivers/scsi_debug +SD_PARAM_PATH=/sys/module/scsi_debug/parameters + +_scsi_debug_key_path() { + local key=${1} + + path="${SD_PSEUDO_PATH}/$key" + if [[ ! -e $path ]]; then + path="${SD_PARAM_PATH}/$key" + fi + if [[ ! -w $path ]]; then + return 1 + fi + + echo "$path" +} + +declare -a SCSI_DEBUG_HOSTS +declare -a SCSI_DEBUG_TARGETS +declare -a SCSI_DEBUG_DEVICES +declare -a ORIG_SCSI_DEBUG_HOSTS +declare -A ORIG_SCSI_DEBUG_PARAMS +declare SCSI_DEBUG_ADD_HOST_RESTORE_VALUE + _setup_scsi_debug_vars() { local host_sysfs host target_sysfs target + local -i i + SCSI_DEBUG_HOSTS=() SCSI_DEBUG_TARGETS=() SCSI_DEBUG_DEVICES=() + for host_sysfs in /sys/class/scsi_host/*; do if [[ "$(cat "${host_sysfs}/proc_name")" = scsi_debug ]]; then host="${host_sysfs#/sys/class/scsi_host/host}" + local orig_host=0 + for ((i=0;i<${#ORIG_SCSI_DEBUG_HOSTS[@]};i++)); do + if (( host == ORIG_SCSI_DEBUG_HOSTS[i])); then + orig_host=1 + fi + done + ((orig_host)) && continue SCSI_DEBUG_HOSTS+=("$host") for target_sysfs in /sys/class/scsi_device/"$host":*; do + [[ ! -e $target_sysfs ]] && break target="${target_sysfs#/sys/class/scsi_device/}" SCSI_DEBUG_TARGETS+=("$target") SCSI_DEBUG_DEVICES+=("$(ls "$target_sysfs/device/block")") @@ -59,10 +94,85 @@ _init_scsi_debug() { _setup_scsi_debug_vars } +_configure_scsi_debug() { + local -a args=("$@") + local -a values + local key value path add_host_value=1 + local -i i + + udevadm settle + + # fall back to _init_scsi_debug because scsi_debug is loadable + if _module_file_exists scsi_debug; then + _init_scsi_debug "${args[@]}" + return + fi + + # zoned device is not yet configurable due to read-only zbc parameter + if (( RUN_FOR_ZONED )) && ! _have_module scsi_debug; then + return 1 + fi + + # List SCSI_DEBUG_HOSTS before configuration + ORIG_SCSI_DEBUG_HOSTS=() + _setup_scsi_debug_vars >& /dev/null + ORIG_SCSI_DEBUG_HOSTS=("${SCSI_DEBUG_HOSTS[@]}") + + # Save current values of all scsi_debug parameters except add_host + ORIG_SCSI_DEBUG_PARAMS=() + for path in "$SD_PSEUDO_PATH"/* "$SD_PARAM_PATH"/*; do + if [[ -f $path && ! $path =~ add_host ]] && + [[ $(stat -c "%A" "$path") =~ rw ]]; then + ORIG_SCSI_DEBUG_PARAMS["$path"]="$(<"$path")" + fi + done + + # Modify parameters specifeid with key=value arguments + for o in "$@"; do + key=${o%=*} + value=${o#*=} + values+=("${value}") + if ! path=$(_scsi_debug_key_path "$key"); then + echo "sysfs to write $key is not avaialbe" + return 1 + fi + if [[ $key == add_host ]]; then + add_host_value=${value} + else + echo "restore $path" >> /tmp/debug + echo -n "$value" > "$path" + fi + done + + echo "${add_host_value}" > ${SD_PSEUDO_PATH}/add_host + SCSI_DEBUG_ADD_HOST_RESTORE_VALUE="-${add_host_value}" + + udevadm settle + + _setup_scsi_debug_vars +} + _exit_scsi_debug() { + local path value + unset SCSI_DEBUG_HOSTS unset SCSI_DEBUG_TARGETS unset SCSI_DEBUG_DEVICES udevadm settle - modprobe -r scsi_debug + + if _module_file_exists scsi_debug; then + modprobe -r scsi_debug + return + fi + + echo "${SCSI_DEBUG_ADD_HOST_RESTORE_VALUE}" > ${SD_PSEUDO_PATH}/add_host + + # Restore parameters modified in _configure_scsi_debug or during test + for path in "${!ORIG_SCSI_DEBUG_PARAMS[@]}"; do + value=${ORIG_SCSI_DEBUG_PARAMS[$path]} + if [[ "$value" != $(<"$path") ]]; then + echo -n "$value" > "$path" + fi + done + unset ORIG_SCSI_DEBUG_PARAMS } From patchwork Tue Apr 25 11:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13223217 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 53A9EC7EE21 for ; Tue, 25 Apr 2023 11:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233937AbjDYLs3 (ORCPT ); Tue, 25 Apr 2023 07:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbjDYLsZ (ORCPT ); Tue, 25 Apr 2023 07:48:25 -0400 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D3659CD; Tue, 25 Apr 2023 04:48:18 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id ECF172B066FC; Tue, 25 Apr 2023 07:48:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 25 Apr 2023 07:48:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682423294; x= 1682423894; bh=mj3LqWfjihVWv+zbTeME8/Bh8GDHTxC6knqcFWrBxrk=; b=O BrQQtArUh8bcWroB35Hb/hN7xXBjc46Ym6YALi5Gt2G4X5u32B5q3f4v51JSw9go Rz/eRpa6EGvVdrQ0eEPme3cMvPswC9pNz+DVXAGwQ4gRsCAVFZ5q91nSZSZTG1VT 4c92T92PidnpoaPNfIA6g8tFip7w7tbNuXMiAhPGXxAAme+phe518UyCCF+LEDdm ItUZoBrwConzfvRljUiBEkd6hmdgVlfXeubOzxhWzxbZn4JyfJquJnO7SH/8kO8f 2E8w+YLSv9JbhxmK3CtqAp1CtydXkHyZt4CXC/32/2/W0WU6struYZC2+6K/fQRt ZBPf3qsv/t9dgO/d27qeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=ie1e949a3.fm3; t= 1682423294; x=1682423894; bh=mj3LqWfjihVWv+zbTeME8/Bh8GDHTxC6knq cFWrBxrk=; b=alYLqy36Bkk8GFp/B6jHO8K5IhclpVkO14NLYLEV8QnXGLCJENc z3tPf1xFZc6sK8ZcVZbKNJ4rh86HRk/v+hh23o/fEf3JbuaiPAJwpgdwzmLXDsn6 Sr1Wdv4B6mhjPUUvtTDQXrU7fkKAnOb5VLiM3Nuc2EPgqwPAG5kqWzq1owCFj00W 93q3V6x0k/dmW/beHjh3uGwKhfu0wSN1b9Zf/1x3pOdU2YZcfOkL3rsiSQ/9HLhO JuiEe3LrerRNINgu8e4NklvF+6zoeKXxVcQheUh/mLv9c2RtH/JE92z7VX0UyeBI tCyjJHRLY4IX3QXKYQ5/hk+lskyC+6rB1YQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 07:48:12 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 5/6] scsi/{004,005}: allow to run with built-in scsi_debug Date: Tue, 25 Apr 2023 20:47:44 +0900 Message-Id: <20230425114745.376322-6-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki To allow the test case run with build-in scsi_debug, replace '_have_module scsi_debug' with _have_scsi_debug, and replace _init_scsi_debug with _configure_scsi_debug. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Chaitanya Kulkarni --- tests/scsi/004 | 4 ++-- tests/scsi/005 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/scsi/004 b/tests/scsi/004 index f0845c1..7d0af54 100755 --- a/tests/scsi/004 +++ b/tests/scsi/004 @@ -18,13 +18,13 @@ DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command" CAN_BE_ZONED=1 requires() { - _have_module scsi_debug + _have_scsi_debug } test() { echo "Running ${TEST_NAME}" - if ! _init_scsi_debug add_host=1 max_luns=1 statistics=1 every_nth=1; then + if ! _configure_scsi_debug max_luns=1 statistics=1 every_nth=1; then return 1 fi echo 5 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/timeout" diff --git a/tests/scsi/005 b/tests/scsi/005 index efd3d82..bfa1014 100755 --- a/tests/scsi/005 +++ b/tests/scsi/005 @@ -11,7 +11,7 @@ DESCRIPTION="test SCSI device blacklisting" QUICK=1 requires() { - _have_module scsi_debug + _have_scsi_debug _have_module_param scsi_debug inq_vendor } @@ -33,7 +33,7 @@ test() { for inq in "${inqs[@]}"; do vendor="${inq:0:8}" model="${inq:8:16}" - if ! _init_scsi_debug inq_vendor="$vendor" inq_product="$model"; then + if ! _configure_scsi_debug inq_vendor="$vendor" inq_product="$model"; then continue fi vendor="$(cat "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/vendor")" From patchwork Wed Apr 26 10:06:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shin'ichiro Kawasaki X-Patchwork-Id: 13224355 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 ACA17C77B60 for ; Wed, 26 Apr 2023 10:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240301AbjDZKGr (ORCPT ); Wed, 26 Apr 2023 06:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbjDZKGq (ORCPT ); Wed, 26 Apr 2023 06:06:46 -0400 Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E533344A6; Wed, 26 Apr 2023 03:06:37 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 7DF2C2B06855; Wed, 26 Apr 2023 06:06:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 26 Apr 2023 06:06:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1682503594; x= 1682507194; bh=XS+A2EyuWt8WLj8nQhjcPl1FG93psrNw71yORB+BVXw=; b=a Nom9mA9U0yfqPG2d1vraQJZPhYRMo7I2t2dUPQR37EUScaJmd+o+h17klyYOs3cy jIkB73EMScNz4GHttsW27cLusuE7E/IXfZdNuAw2UC4dVodshrIoMvS1X7BjzRlG dYtf+qOV3x8yndSXmOOM2HzQaWAiVcHG4SR2cKA0Ew9P1H1421CG42MrE5oepAvU yerUsIrrt5mI4bxCsA7DPt0xCUiM72yfgAENrXoLdAL8TtlaUsShAchdlRGP3BNm XybBxAfbx+tq7uO7cMYR26T9tiwPDDrhoa/LVdvUB1vqn7/GEvRIeZFBe86d8OBa g1T2oeRf0ly0Z+TObhUcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1682503594; x= 1682507194; bh=XS+A2EyuWt8WLj8nQhjcPl1FG93psrNw71yORB+BVXw=; b=J lpXa71VHAGR4GOn1SC7xGJtIZx4KU/w+ZFi52qmTlUd5rliqnJ53HycnUYIzwh67 SsHvlx485ORSEJX1OeokC6IiqA/F8I9Me26eoLzYF+ZWERJ7sWG6EjHyYvjCZqb1 mn2+f+Sj5VoVg5B9fc0tYSiWWDtWo29AnrNm6ndgHoJ1pI6Wkw9WGACWk2oxJjJz FkY0wmlsedPsjqijyMrCmcrjNW6HmJqD/q3VghDSBFwcdvnvEvPHldXi/T9GcXyY /aISqBSP8l7hsn4ZY8fw3COfPVt7s96DoqLtb4t/EdXNyDhfDy91kcldfsyvSIqu rWig/q5SkzzYhiSCOobMQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedugedgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhhihhn kdhitghhihhrohcumfgrfigrshgrkhhiuceoshhhihhnihgthhhirhhosehfrghsthhmrg hilhdrtghomheqnecuggftrfgrthhtvghrnhepgffggeffjeegfeeuteegueekvdfhledu hfehffdtiedthfetleeifeeihfeukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhhihhnihgthhhirhhosehfrghsthhmrghilhdrtgho mh X-ME-Proxy: Feedback-ID: ie1e949a3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Apr 2023 06:06:32 -0400 (EDT) From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Chaitanya Kulkarni , Shin'ichiro Kawasaki , Shin'ichiro Kawasaki Subject: [PATCH blktests v2 6/6] block/{001,002,027}: allow to run with built-in scsi_debug and sd_mod Date: Wed, 26 Apr 2023 19:06:11 +0900 Message-Id: <20230426100611.2120-1-shinichiro@fastmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425114745.376322-1-shinichiro@fastmail.com> References: <20230425114745.376322-1-shinichiro@fastmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Shin'ichiro Kawasaki To allow the test cases run with build-in scsi_debug, replace '_have_module scsi_debug' with _have_scsi_debug, and replace _init_scsi_debug with _configure_scsi_debug. Also to allow block/001 run with built-in sd_mod, replace '_have_module sd_mod' with '_have_kernel_option BLK_DEV_SD'. When sd_mod driver is built-in, /sys/module/sd_mod directory is not created. Then _have_driver() can not detect availability of the driver. Instead, refer the kernel config to check availability of the driver. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- tests/block/001 | 6 +++--- tests/block/002 | 4 ++-- tests/block/027 | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/block/001 b/tests/block/001 index 2ea3754..32dd22f 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,13 +13,13 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_module scsi_debug - _have_driver sd_mod + _have_scsi_debug + _have_kernel_option BLK_DEV_SD _have_driver sr_mod } stress_scsi_debug() { - if ! _init_scsi_debug "$@"; then + if ! _configure_scsi_debug "$@"; then return fi diff --git a/tests/block/002 b/tests/block/002 index a5f3ee5..b16d014 100755 --- a/tests/block/002 +++ b/tests/block/002 @@ -13,13 +13,13 @@ QUICK=1 requires() { _have_blktrace - _have_module scsi_debug + _have_scsi_debug } test() { echo "Running ${TEST_NAME}" - if ! _init_scsi_debug delay=0; then + if ! _configure_scsi_debug delay=0; then return 1 fi diff --git a/tests/block/027 b/tests/block/027 index ab6369b..a79a115 100755 --- a/tests/block/027 +++ b/tests/block/027 @@ -20,12 +20,12 @@ CAN_BE_ZONED=1 requires() { _have_cgroup2_controller io - _have_module scsi_debug + _have_scsi_debug _have_fio } scsi_debug_stress_remove() { - if ! _init_scsi_debug "$@"; then + if ! _configure_scsi_debug "$@"; then return fi