diff mbox series

[blktests] common/ublk: avoid modprobe failure for built-in ublk_drv

Message ID 20230705103522.3383196-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests] common/ublk: avoid modprobe failure for built-in ublk_drv | expand

Commit Message

Shin'ichiro Kawasaki July 5, 2023, 10:35 a.m. UTC
When ublk_drv driver is not a loadable module but a built-in module,
modprobe for the driver fails in _init_ublk. This results in unexpected
test case skips with the message "requires ublk_drv".

To not skip the test cases with built-in ublk_drv, call modprobe only
when the driver is loadable and its module file exists. Also, do not set
SKIP_REASONS to handle modprobe failure as test case failure.

Fixes: 840ccf1fc33e ("block/033: add test to cover gendisk leak")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/ublk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ming Lei July 5, 2023, 3:24 p.m. UTC | #1
On Wed, Jul 05, 2023 at 07:35:22PM +0900, Shin'ichiro Kawasaki wrote:
> When ublk_drv driver is not a loadable module but a built-in module,
> modprobe for the driver fails in _init_ublk. This results in unexpected
> test case skips with the message "requires ublk_drv".
> 
> To not skip the test cases with built-in ublk_drv, call modprobe only
> when the driver is loadable and its module file exists. Also, do not set
> SKIP_REASONS to handle modprobe failure as test case failure.
> 
> Fixes: 840ccf1fc33e ("block/033: add test to cover gendisk leak")
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Looks fine,

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming
Shin'ichiro Kawasaki July 14, 2023, 1:58 p.m. UTC | #2
On Jul 05, 2023 / 23:24, Ming Lei wrote:
[...]
> Looks fine,
> 
> Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks for the review. Appiled.
diff mbox series

Patch

diff --git a/common/ublk b/common/ublk
index 198c4db..8278d56 100644
--- a/common/ublk
+++ b/common/ublk
@@ -27,8 +27,7 @@  _init_ublk() {
 	_remove_ublk_devices > /dev/null 2>&1
 
 	modprobe -rq ublk_drv
-	if ! modprobe ublk_drv; then
-		SKIP_REASONS+=("requires ublk_drv")
+	if _module_file_exists ublk_drv && ! modprobe ublk_drv; then
 		return 1
 	fi