diff mbox series

[blktests,2/9] common/scsi_debug, tests/*: re-define _have_scsi_debug

Message ID 20230417124728.458630-3-shinichiro@fastmail.com (mailing list archive)
State New, archived
Headers show
Series support built-in scsi_debug | expand

Commit Message

Shin'ichiro Kawasaki April 17, 2023, 12:47 p.m. UTC
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

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 <shinichiro.kawasaki@wdc.com>
---
 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(-)

Comments

Chaitanya Kulkarni April 18, 2023, 8:10 p.m. UTC | #1
On 4/17/23 05:47, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> 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 <shinichiro.kawasaki@wdc.com>
> ---
>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
diff mbox series

Patch

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() {