CC+: Bart, On Feb 02, 2025 / 00:10, Nilay Shroff wrote: > 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. Thanks. I think this is a good improvement. > > Signed-off-by: Nilay Shroff <nilay@xxxxxxxxxxxxx> > --- > common/rc | 11 +++++++++++ > tests/srp/rc | 1 + > 2 files changed, 12 insertions(+) > > diff --git a/common/rc b/common/rc > index bcb215d..73e0b9a 100644 > --- a/common/rc > +++ b/common/rc > @@ -78,6 +78,17 @@ _have_module() { > return 0 > } > > +_have_module_not_in_use() { > + _have_module "$1" || return > + > + if [ -d "/sys/module/$1" ]; then > + refcnt="$(cat /sys/module/$1/refcnt)" > + if [ "$refcnt" -ne "0" ]; then > + SKIP_REASONS+=("module $1 is in use") > + fi > + fi > +} Spaces are used for indents. Please use tabs instead. Nit: "refcnt" is not declared as a local variable. Let's declare it. Or, it would be the better to avoid "refcnt". Instead, $(< /sys/module/$1/refcnt) can be used as follows. Either way is fine for me. if [ -d "/sys/module/$1" ] && (($(</sys/module/"$1"/refcnt) != 0)); then SKIP_REASONS+=("module $1 is in use") fi