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. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- tests/scsi/006 | 4 ++++ tests/scsi/rc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/scsi/006 b/tests/scsi/006 index 74df39d..fe1d202 100755 --- a/tests/scsi/006 +++ b/tests/scsi/006 @@ -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 diff --git a/tests/scsi/rc b/tests/scsi/rc index 1477cec..c8d2f42 100644 --- a/tests/scsi/rc +++ b/tests/scsi/rc @@ -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 " ]] +} -- 2.34.1