Skip to content

Commit 18914ab

Browse files
shroffnikawasaki
authored andcommitted
srp: skip test if scsi_transport_srp module is loaded and in use
The srp/* tests requires exclusive access to scsi_transport_srp module. Running srp/* tests would definitely fail if the test can't get exclusive access of scsi_transport_srp module as shown below: $ lsmod | grep scsi_transport_srp scsi_transport_srp 327680 1 ibmvscsi $ ./check srp/001 srp/001 (Create and remove LUNs) [failed] runtime ... 0.249s tests/srp/rc: line 263: /sys/class/srp_remote_ports/port-0:1/delete: Permission denied tests/srp/rc: line 263: /sys/class/srp_remote_ports/port-0:1/delete: Permission denied modprobe: FATAL: Module scsi_transport_srp is in use. error: Invalid argument error: Invalid argument So if the scsi_transport_srp module is loaded and in use then skip running srp/* tests. Signed-off-by: Nilay Shroff <[email protected]> Tested-by: Disha Goel <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> [Shin'ichiro: removed extra spaces and fixed a shellcheck warning] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 67aff55 commit 18914ab

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

common/rc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ _have_module() {
7878
return 0
7979
}
8080

81+
_module_not_in_use() {
82+
local refcnt
83+
84+
_have_module "$1" || return
85+
86+
if [ -d "/sys/module/$1" ]; then
87+
refcnt="$(cat /sys/module/"$1"/refcnt)"
88+
if [ "$refcnt" -ne "0" ]; then
89+
SKIP_REASONS+=("module $1 is in use")
90+
fi
91+
fi
92+
}
93+
8194
_have_module_param() {
8295
_have_driver "$1" || return
8396

tests/srp/rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ group_requires() {
6161
_have_module scsi_debug
6262
_have_module target_core_iblock
6363
_have_module target_core_mod
64+
_module_not_in_use scsi_transport_srp
6465

6566
for p in mkfs.ext4 mkfs.xfs multipath multipathd pidof rdma \
6667
sg_reset fio; do

0 commit comments

Comments
 (0)