* [PATCH blktests 1/7] nvme: use _have_loop instead of _have_modules loop
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 2/7] common: add a helper if a driver is available Christoph Hellwig
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Also check for the losetup existance.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/nvme/002 | 2 +-
tests/nvme/003 | 2 +-
tests/nvme/004 | 2 +-
tests/nvme/005 | 3 +--
tests/nvme/006 | 2 +-
tests/nvme/008 | 2 +-
tests/nvme/010 | 2 +-
tests/nvme/012 | 2 +-
tests/nvme/014 | 2 +-
tests/nvme/015 | 2 +-
tests/nvme/018 | 2 +-
tests/nvme/019 | 2 +-
tests/nvme/021 | 2 +-
tests/nvme/022 | 2 +-
tests/nvme/023 | 2 +-
tests/nvme/024 | 2 +-
tests/nvme/025 | 2 +-
tests/nvme/026 | 2 +-
tests/nvme/027 | 2 +-
tests/nvme/028 | 2 +-
tests/nvme/029 | 2 +-
tests/nvme/030 | 2 +-
tests/nvme/031 | 2 +-
23 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/tests/nvme/002 b/tests/nvme/002
index ca11c11..6c6ae5f 100755
--- a/tests/nvme/002
+++ b/tests/nvme/002
@@ -11,7 +11,7 @@ DESCRIPTION="create many subsystems and test discovery"
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_loop
}
diff --git a/tests/nvme/003 b/tests/nvme/003
index 101c184..2ba6954 100755
--- a/tests/nvme/003
+++ b/tests/nvme/003
@@ -12,7 +12,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/004 b/tests/nvme/004
index 4b0b7ae..9dda538 100755
--- a/tests/nvme/004
+++ b/tests/nvme/004
@@ -13,7 +13,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/005 b/tests/nvme/005
index 9f3e388..de567a7 100755
--- a/tests/nvme/005
+++ b/tests/nvme/005
@@ -12,8 +12,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop && \
- _have_module_param_value nvme_core multipath Y
+ _have_loop && _have_module_param_value nvme_core multipath Y
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/006 b/tests/nvme/006
index 9230dc6..d993861 100755
--- a/tests/nvme/006
+++ b/tests/nvme/006
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/008 b/tests/nvme/008
index 219fe9b..5568fe4 100755
--- a/tests/nvme/008
+++ b/tests/nvme/008
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/010 b/tests/nvme/010
index 08e39d5..b7b1d51 100755
--- a/tests/nvme/010
+++ b/tests/nvme/010
@@ -11,7 +11,7 @@ TIMED=1
requires() {
_nvme_requires
- _have_fio && _have_modules loop
+ _have_fio && _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/012 b/tests/nvme/012
index 6bb4972..c9d2438 100755
--- a/tests/nvme/012
+++ b/tests/nvme/012
@@ -14,7 +14,7 @@ requires() {
_nvme_requires
_have_xfs
_have_fio
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/014 b/tests/nvme/014
index 48f8caa..d13cff7 100755
--- a/tests/nvme/014
+++ b/tests/nvme/014
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/015 b/tests/nvme/015
index e33cfde..bb52ba2 100755
--- a/tests/nvme/015
+++ b/tests/nvme/015
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/018 b/tests/nvme/018
index 7f407da..315e795 100755
--- a/tests/nvme/018
+++ b/tests/nvme/018
@@ -12,7 +12,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/019 b/tests/nvme/019
index 8259e2e..4cb3509 100755
--- a/tests/nvme/019
+++ b/tests/nvme/019
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/021 b/tests/nvme/021
index fb77f9c..6ee0af1 100755
--- a/tests/nvme/021
+++ b/tests/nvme/021
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/022 b/tests/nvme/022
index 62c4690..1d76ffa 100755
--- a/tests/nvme/022
+++ b/tests/nvme/022
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/023 b/tests/nvme/023
index bce21b5..b65be07 100755
--- a/tests/nvme/023
+++ b/tests/nvme/023
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/024 b/tests/nvme/024
index ffec36c..f756797 100755
--- a/tests/nvme/024
+++ b/tests/nvme/024
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/025 b/tests/nvme/025
index 3d3f01b..941bf36 100755
--- a/tests/nvme/025
+++ b/tests/nvme/025
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/026 b/tests/nvme/026
index 2f56077..c3f06c2 100755
--- a/tests/nvme/026
+++ b/tests/nvme/026
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/027 b/tests/nvme/027
index 53f0664..0ad663a 100755
--- a/tests/nvme/027
+++ b/tests/nvme/027
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/028 b/tests/nvme/028
index 3d9084f..7de977a 100755
--- a/tests/nvme/028
+++ b/tests/nvme/028
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/029 b/tests/nvme/029
index 960e5f5..f8b4cbb 100755
--- a/tests/nvme/029
+++ b/tests/nvme/029
@@ -12,7 +12,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/030 b/tests/nvme/030
index c6d485e..20fef69 100755
--- a/tests/nvme/030
+++ b/tests/nvme/030
@@ -11,7 +11,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
diff --git a/tests/nvme/031 b/tests/nvme/031
index 7c18a64..4e17982 100755
--- a/tests/nvme/031
+++ b/tests/nvme/031
@@ -19,7 +19,7 @@ QUICK=1
requires() {
_nvme_requires
- _have_modules loop
+ _have_loop
_require_nvme_trtype_is_fabrics
}
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 2/7] common: add a helper if a driver is available
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 1/7] nvme: use _have_loop instead of _have_modules loop Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 3/7] common: fix _have_module_param_value to work with built-in drivers Christoph Hellwig
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Unlike _have_modules this allows allows for a built-in driver.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/rc | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/common/rc b/common/rc
index 5e35e21..2d0fd88 100644
--- a/common/rc
+++ b/common/rc
@@ -28,6 +28,18 @@ _have_root() {
return 0
}
+_have_driver()
+{
+ local modname="${1/-/_}"
+
+ if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q "${modname}"; then
+ SKIP_REASON="driver ${modname} is not available"
+ return 1
+ fi
+
+ return 0
+}
+
_have_modules() {
local missing=()
local module
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 3/7] common: fix _have_module_param_value to work with built-in drivers
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 1/7] nvme: use _have_loop instead of _have_modules loop Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 2/7] common: add a helper if a driver is available Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 4/7] common: do not require loop support to be modular Christoph Hellwig
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Don't bother to call modprobe directly and just check the /sys/module/
directory. Also switch to using descriptive variable names for the
parameters.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/rc | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/common/rc b/common/rc
index 2d0fd88..c4df814 100644
--- a/common/rc
+++ b/common/rc
@@ -74,17 +74,22 @@ _have_module_param() {
}
_have_module_param_value() {
+ local modname="${1/-/_}"
+ local param="$2"
+ local expected_value="$3"
local value
- modprobe "$1"
+ if ! _have_driver "$modname"; then
+ return 1;
+ fi
- if ! _have_module_param "$1" "$2"; then
+ if ! _have_module_param "$modname" "$param"; then
return 1
fi
- value=$(cat "/sys/module/$1/parameters/$2")
- if [[ "${value}" != "$3" ]]; then
- SKIP_REASON="$1 module parameter $2 must be set to $3"
+ value=$(cat "/sys/module/$modname/parameters/$param")
+ if [[ "${value}" != "$expected_value" ]]; then
+ SKIP_REASON="$modname module parameter $param must be set to $expected_value"
return 1
fi
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 4/7] common: do not require loop support to be modular
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
` (2 preceding siblings ...)
2022-06-01 6:48 ` [PATCH blktests 3/7] common: fix _have_module_param_value to work with built-in drivers Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 5/7] nbd: do not require nbd " Christoph Hellwig
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Use _have_driver instead of _have_modules in _have_loop as nothing requires
the loop driver to be modular.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/rc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/rc b/common/rc
index c4df814..b1cc157 100644
--- a/common/rc
+++ b/common/rc
@@ -128,7 +128,7 @@ _have_src_program() {
}
_have_loop() {
- _have_modules loop && _have_program losetup
+ _have_driver loop && _have_program losetup
}
_have_blktrace() {
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 5/7] nbd: do not require nbd support to be modular
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
` (3 preceding siblings ...)
2022-06-01 6:48 ` [PATCH blktests 4/7] common: do not require loop support to be modular Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 6/7] scsi: don't require sg to be built in Christoph Hellwig
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Use _have_driver instead of _have_modules in _have_nbd as nothing requires
the nbd driver to be modular.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/nbd/rc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/nbd/rc b/tests/nbd/rc
index 9d0e3d1..118553c 100644
--- a/tests/nbd/rc
+++ b/tests/nbd/rc
@@ -7,11 +7,11 @@
. common/rc
group_requires() {
- _have_root && _have_nbd && modprobe nbd
+ _have_root && _have_nbd
}
_have_nbd() {
- if ! _have_modules nbd; then
+ if ! _have_driver nbd; then
return 1
fi
if ! _have_program nbd-server; then
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 6/7] scsi: don't require sg to be built in
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
` (4 preceding siblings ...)
2022-06-01 6:48 ` [PATCH blktests 5/7] nbd: do not require nbd " Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-01 6:48 ` [PATCH blktests 7/7] nvme: don't require the nvme drivers " Christoph Hellwig
2022-06-03 1:23 ` reduce the dependency on modules v2 Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Use _have_driver instead of _have_modules in _have_scsi_generic as
nothing requires the sg driver to be modular.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/scsi/rc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/scsi/rc b/tests/scsi/rc
index c8d2f42..0751e77 100644
--- a/tests/scsi/rc
+++ b/tests/scsi/rc
@@ -15,7 +15,7 @@ group_device_requires() {
}
_have_scsi_generic() {
- _have_modules sg
+ _have_driver sg
}
_require_test_dev_is_scsi() {
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH blktests 7/7] nvme: don't require the nvme drivers to be built in
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
` (5 preceding siblings ...)
2022-06-01 6:48 ` [PATCH blktests 6/7] scsi: don't require sg to be built in Christoph Hellwig
@ 2022-06-01 6:48 ` Christoph Hellwig
2022-06-03 1:23 ` reduce the dependency on modules v2 Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-06-01 6:48 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block
Use _have_driver instead of _have_modules to check for the availability
of the nvme drivers, and don't bother checking at all for drivers that
are pulled in as dependencies.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/nvme/rc | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index ccdccf9..998b181 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -16,21 +16,23 @@ _nvme_requires() {
_have_program nvme
case ${nvme_trtype} in
loop)
- _have_modules nvmet nvme-core nvme-loop
+ _have_driver nvme-loop
_have_configfs
;;
pci)
- _have_modules nvme nvme-core
+ _have_driver nvme
;;
tcp)
- _have_modules nvmet nvme-core nvme-tcp nvmet-tcp
+ _have_driver nvme-tcp
+ _have_driver nvmet-tcp
_have_configfs
;;
rdma)
- _have_modules nvmet nvme-core nvme-rdma nvmet-rdma
+ _have_driver nvme-rdma
+ _have_driver nvmet-rdma
_have_configfs
_have_program rdma
- _have_modules rdma_rxe || _have_modules siw
+ _have_driver rdma_rxe || _have_driver siw
;;
*)
SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}"
@@ -125,11 +127,11 @@ _cleanup_nvmet() {
shopt -u nullglob
trap SIGINT
- modprobe -r nvme-"${nvme_trtype}" 2>/dev/null
+ modprobe -rq nvme-"${nvme_trtype}" 2>/dev/null
if [[ "${nvme_trtype}" != "loop" ]]; then
- modprobe -r nvmet-"${nvme_trtype}" 2>/dev/null
+ modprobe -rq nvmet-"${nvme_trtype}" 2>/dev/null
fi
- modprobe -r nvmet 2>/dev/null
+ modprobe -rq nvmet 2>/dev/null
if [[ "${nvme_trtype}" == "rdma" ]]; then
stop_soft_rdma
fi
@@ -137,11 +139,11 @@ _cleanup_nvmet() {
_setup_nvmet() {
_register_test_cleanup _cleanup_nvmet
- modprobe nvmet
+ modprobe -q nvmet
if [[ "${nvme_trtype}" != "loop" ]]; then
- modprobe nvmet-"${nvme_trtype}"
+ modprobe -q nvmet-"${nvme_trtype}"
fi
- modprobe nvme-"${nvme_trtype}"
+ modprobe -q nvme-"${nvme_trtype}"
if [[ "${nvme_trtype}" == "rdma" ]]; then
start_soft_rdma
for i in $(rdma_network_interfaces)
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: reduce the dependency on modules v2
2022-06-01 6:48 reduce the dependency on modules v2 Christoph Hellwig
` (6 preceding siblings ...)
2022-06-01 6:48 ` [PATCH blktests 7/7] nvme: don't require the nvme drivers " Christoph Hellwig
@ 2022-06-03 1:23 ` Shinichiro Kawasaki
7 siblings, 0 replies; 9+ messages in thread
From: Shinichiro Kawasaki @ 2022-06-03 1:23 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On Jun 01, 2022 / 08:48, Christoph Hellwig wrote:
> Hi Shin'ichiro,
>
> this series reduces the dependency of blktests on modular builds
> of various block drivers. There are still plenty of tests that
> do require modules, mostly because a lot of scsi_debug and null_blk
> can only be set at load time, but I plan to address those in the
> kernel soon.
Thanks, applied!
--
Shin'ichiro Kawasaki
^ permalink raw reply [flat|nested] 9+ messages in thread