From 4dc6c8da6ed938f12a42f167839100ab551ae8d1 Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Fri, 25 Apr 2025 14:21:48 +0900 Subject: [PATCH] t/zbd: add run-tests-against-scsi_debug The newly added test cases in t/zbd/test-zbd-support 72 and 73 require error injection feature. They can be run with either null_blk or scsi_debug, which provides the error injection feature. To run the test cases easily with scsi_debug, add another script run-tests-against- scsi_debug. It simply prepares a zoned scsi_debug device and run the two test cases. Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20250425052148.126788-9-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- t/zbd/run-tests-against-scsi_debug | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 t/zbd/run-tests-against-scsi_debug diff --git a/t/zbd/run-tests-against-scsi_debug b/t/zbd/run-tests-against-scsi_debug new file mode 100755 index 00000000..b50d7a24 --- /dev/null +++ b/t/zbd/run-tests-against-scsi_debug @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (C) 2020 Western Digital Corporation or its affiliates. +# +# SPDX-License-Identifier: GPL-2.0 +# +# A couple of test cases in t/zbd/test-zbd-support script depend on the error +# injection feature of scsi_debug. Prepare a zoned scsi_debug device and run +# only for the test cases. + +declare dev sg scriptdir + +scriptdir="$(cd "$(dirname "$0")" && pwd)" + +modprobe -qr scsi_debug +modprobe scsi_debug add_host=1 zbc=host-managed zone_nr_conv=0 + +dev=$(dmesg | tail -5 | grep "Attached SCSI disk" | grep -Po ".* \[\Ksd[a-z]*") + +if ! grep -qe scsi_debug /sys/block/"${dev}"/device/vpd_pg83; then + echo "Failed to create scsi_debug device" + exit 1 +fi + +sg=$(echo /sys/block/"${dev}"/device/scsi_generic/*) +sg=${sg##*/} + +echo standard engine: +"${scriptdir}"/test-zbd-support -t 72 -t 73 /dev/"${dev}" +echo libzbc engine with block device: +"${scriptdir}"/test-zbd-support -t 72 -t 73 -l /dev/"${dev}" +echo libzbc engine with sg node: +"${scriptdir}"/test-zbd-support -t 72 -t 73 -l /dev/"${sg}" -- 2.25.1