[PATCH v2 8/8] t/zbd: add run-tests-against-scsi_debug
Shin'ichiro Kawasaki <[email protected]>
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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.49.0