]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
scsi/006: skip cache types which disable read cache for SATA drives
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 30 Mar 2022 01:32:14 +0000 (10:32 +0900)
committerOmar Sandoval <osandov@fb.com>
Mon, 9 May 2022 19:11:16 +0000 (12:11 -0700)
The test case scsi/006 sets four cache types to test target SCSI
devices. Two cache types out of the four, "none" and "write back, no
read (daft)" disable read cache. However, these two types do not work
for SATA drives since SAT specification requires Disable Read Cache is
always set to zero in the caching mode page. It results in invalid
argument error and the test case failure.

To avoid the failure, skip the cache types which disable read cache if
the test devices are SATA drives. To check the device, add a helper
function _test_dev_is_sata in scsi/rc.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/scsi/006
tests/scsi/rc

index 74df39d77f229ad843abfbe7d405653e9cada9d4..fe1d2024238ea2db257cdf7b435f790ae1838314 100755 (executable)
@@ -35,6 +35,10 @@ test_device() {
        original_cache_type="$(cat "$cache_type_path")"
        for cache_type in "${cache_types[@]}"; do
                echo "$cache_type"
+               # SAT requires Read Cache Disable always set to zero.
+               # Skip cache types which disable read cache for SATA drives.
+               _test_dev_is_sata && [[ $cache_type == none ]] ||
+                       [[ $cache_type =~ "no read" ]] && continue
                ( echo "$cache_type" > "$cache_type_path" ) |& grep -v "Invalid argument"
                if [[ ${PIPESTATUS[0]} -eq 0 ]]; then
                        # If setting the cache type succeeded, it should now
index 1477cecc5593f4c673b730eb38a838734d6c263a..c8d2f4211ecc51ea88341436c685ecc7b516465a 100644 (file)
@@ -37,3 +37,7 @@ _require_test_dev_is_scsi_disk() {
 _get_test_dev_sg() {
        echo "${TEST_DEV_SYSFS}"/device/scsi_generic/sg* | grep -Eo "sg[0-9]+"
 }
+
+_test_dev_is_sata() {
+       [[ $(<"${TEST_DEV_SYSFS}"/device/vendor) == "ATA     " ]]
+}