TESTS: Fix WRITESAME tests to handle targets that don't like datalen == 0

Recent SBC specs say (when the WSNZ bit is set to one and the NUMBER OF LOGICAL
BLOCKS field is set to zero) or (if MAXIMUM WRITE SAME LENGTH is greater than 0
and the number of logical blocks specified to be written exceeds the MAXIMUM
WRITE SAME LENGTH) the server should terminate with CHECK CONDITION, set the
sense key to ILLEGAL REQUEST and the additional sense code to INVALID FIELD IN
CDB.

Update the WRITESAME tests to cope with this.
This commit is contained in:
Sitsofe Wheeler
2014-01-14 11:53:04 +00:00
parent 38ba5b6c0e
commit e1659b1973
3 changed files with 54 additions and 2 deletions

View File

@@ -44,8 +44,13 @@ test_writesame10_0blocks(void)
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support WRITESAME10. Skipping test");
return;
} else if (ret == -3) {
CU_PASS("[SKIPPED] Target does not support WRITESAME10 with NUMBER OF LOGICAL BLOCKS == 0");
} else if (ret == -4) {
CU_PASS("[SKIPPED] Number of WRITESAME10 logical blocks to be written exceeds MAXIMUM WRITE SAME LENGTH");
} else {
CU_ASSERT_EQUAL(ret, 0);
}
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks one block past end-of-LUN");
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1,