Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions common/scsi_debug
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,33 @@
#
# scsi_debug helper functions.

SD_PARAM_PATH=/sys/module/scsi_debug/parameters
SD_PSEUDO_PATH=/sys/bus/pseudo/drivers/scsi_debug

_have_scsi_debug() {
_have_driver scsi_debug

if _module_file_exists scsi_debug; then
_have_loadable_scsi_debug
return $?
fi

if [[ -e "$SD_PSEUDO_PATH/add_host" ]] && \
[[ $(cat "$SD_PSEUDO_PATH/add_host") -gt 1 ]]; then
SKIP_REASONS+=("scsi_debug already has multiple hosts configured")
return 1
fi
}

SD_PARAM_PATH=/sys/module/scsi_debug/parameters
SD_PSEUDO_PATH=/sys/bus/pseudo/drivers/scsi_debug
_have_loadable_scsi_debug() {
_have_module scsi_debug || return 1

if [[ -d /sys/module/scsi_debug ]] && \
[[ ! ${MODULES_TO_UNLOAD[*]} =~ scsi_debug ]]; then
SKIP_REASONS+=("scsi_debug is already loaded before test")
return 1
fi
}

_scsi_debug_key_path() {
local key=${1}
Expand Down
2 changes: 1 addition & 1 deletion tests/block/009
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DESCRIPTION="check page-cache coherency after BLKDISCARD"

requires() {
_have_module scsi_debug
_have_loadable_scsi_debug
_have_program xfs_io
}

Expand Down
2 changes: 1 addition & 1 deletion tests/block/025
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DESCRIPTION="do a huge discard with 4k sector size"

requires() {
_have_module scsi_debug
_have_loadable_scsi_debug
}

test() {
Expand Down
2 changes: 1 addition & 1 deletion tests/block/028
Original file line number Diff line number Diff line change
Expand Up @@ -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_module scsi_debug
_have_loadable_scsi_debug
}

test_pi() {
Expand Down
2 changes: 1 addition & 1 deletion tests/block/032
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ QUICK=1

requires() {
_have_xfs
_have_module scsi_debug
_have_loadable_scsi_debug
}

test() {
Expand Down
2 changes: 1 addition & 1 deletion tests/loop/004
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ QUICK=1

requires() {
_have_program xfs_io
_have_module scsi_debug
_have_loadable_scsi_debug
_have_src_program loblksize
_have_loop_set_block_size
}
Expand Down
2 changes: 1 addition & 1 deletion tests/md/002
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DESCRIPTION="test md atomic writes"
QUICK=1

requires() {
_have_driver scsi_debug
_have_scsi_debug
_stacked_atomic_test_requires
}

Expand Down
2 changes: 1 addition & 1 deletion tests/scsi/007
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DESCRIPTION="Trigger the SCSI error handler"
QUICK=1

requires() {
_have_module scsi_debug
_have_loadable_scsi_debug
}

start_tracing() {
Expand Down
2 changes: 1 addition & 1 deletion tests/scsi/009
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DESCRIPTION="test scsi atomic writes"
QUICK=1

requires() {
_have_driver scsi_debug
_have_scsi_debug
_have_xfs_io_atomic_write
}

Expand Down
2 changes: 1 addition & 1 deletion tests/srp/rc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ group_requires() {
_have_kver 5 5
_have_iproute2 190404
fi
_have_module scsi_debug
_have_loadable_scsi_debug
_have_module target_core_iblock
_have_module target_core_mod
_module_not_in_use scsi_transport_srp
Expand Down
2 changes: 1 addition & 1 deletion tests/zbd/008
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DESCRIPTION="check no stale page cache after BLKZONERESET and data read race"
TIMED=1

requires() {
_have_module scsi_debug
_have_loadable_scsi_debug
_have_module_param scsi_debug zbc
_have_program xfs_io
}
Expand Down
2 changes: 1 addition & 1 deletion tests/zbd/009
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requires() {
_have_driver btrfs
_have_module_param scsi_debug zone_cap_mb
_have_program mkfs.btrfs && have_good_mkfs_btrfs
_have_module scsi_debug
_have_loadable_scsi_debug
}

test() {
Expand Down
2 changes: 1 addition & 1 deletion tests/zbd/010
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ requires() {
_have_module null_blk
_have_module_param scsi_debug zone_cap_mb
_have_program mkfs.f2fs
_have_module scsi_debug
_have_loadable_scsi_debug
}

test() {
Expand Down
Loading