@@ -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
@@ -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 " ]]
+}
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@wdc.com> --- tests/scsi/006 | 4 ++++ tests/scsi/rc | 4 ++++ 2 files changed, 8 insertions(+)