From: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> To allow the test case run with build-in scsi_debug, replace '_have_module scsi_debug' with _have_scsi_debug, and replace _init_scsi_debug with _configure_scsi_debug. Also, save and restore the values of scsi_debug parameters 'opts' and 'ndelay'. The test case modifies the parameters and do not restore their original values. It is fine when scsi_debug is loadable since scsi_debug is unloaded after the test case run. However, when scsi_debug is built- in, the modified parameters may affect following test cases. To avoid potential impact on following test cases, save original values of the parameters and restore them at the end of the test case. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- tests/scsi/004 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/scsi/004 b/tests/scsi/004 index f0845c1..110b5f4 100755 --- a/tests/scsi/004 +++ b/tests/scsi/004 @@ -18,15 +18,22 @@ DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command" CAN_BE_ZONED=1 requires() { - _have_module scsi_debug + _have_scsi_debug } test() { + local opts ndelay + echo "Running ${TEST_NAME}" - if ! _init_scsi_debug add_host=1 max_luns=1 statistics=1 every_nth=1; then + if ! _configure_scsi_debug max_luns=1 statistics=1 every_nth=1; then return 1 fi + + # save scsi_debug parameters + opts=$(</sys/bus/pseudo/drivers/scsi_debug/opts) + ndelay=$(</sys/bus/pseudo/drivers/scsi_debug/ndelay) + echo 5 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/timeout" # every_nth RW with full queue gets SAM_STAT_TASK_SET_FULL echo 0x800 > /sys/bus/pseudo/drivers/scsi_debug/opts @@ -42,7 +49,11 @@ test() { while grep -q -F "in_use_bm BUSY:" "/proc/scsi/scsi_debug/${SCSI_DEBUG_HOSTS[0]}"; do sleep 1 done - echo 1 > /sys/bus/pseudo/drivers/scsi_debug/ndelay + + # restore scsi_debug parameters + echo "$opts" > /sys/bus/pseudo/drivers/scsi_debug/opts + echo "$ndelay" > /sys/bus/pseudo/drivers/scsi_debug/ndelay + _exit_scsi_debug echo "Test complete" -- 2.39.2