TESTS: Relax the tests for BlockLimit VPD page length.

Discussions on linux-scsi indicate that some SBC-2 devices may provide
some SBC-3 features and thus a SBC-3 BlockLimit page.

Supporting more than you claim is a transgression but a relatively minor
one, so lets turn a blind eye to it.
Supporting less than you claim is a serious transgression and will always
result in a harsh test failure.
This commit is contained in:
Ronnie Sahlberg
2013-05-14 20:37:20 -07:00
parent e9b79807ae
commit c7238aa426

View File

@@ -27,7 +27,7 @@
void void
test_inquiry_block_limits(void) test_inquiry_block_limits(void)
{ {
int ret, expected_pl; int ret;
struct scsi_inquiry_block_limits *inq_bl; struct scsi_inquiry_block_limits *inq_bl;
struct scsi_task *bl_task = NULL; struct scsi_task *bl_task = NULL;
struct scsi_inquiry_logical_block_provisioning *lbp = NULL; struct scsi_inquiry_logical_block_provisioning *lbp = NULL;
@@ -67,23 +67,28 @@ test_inquiry_block_limits(void)
/* if it is not SBC3 then we assume it must be SBC2 */ /* if it is not SBC3 then we assume it must be SBC2 */
if (sbc3_support) { if (sbc3_support) {
logging(LOG_VERBOSE, "Device claims SBC-3. Verify that " "PageLength == 0x3C"); logging(LOG_VERBOSE, "Device claims SBC-3. Verify that " "PageLength == 0x3C");
expected_pl = 0x3c;
} else { } else {
logging(LOG_VERBOSE, "Device is not SBC-3. Verify that " logging(LOG_VERBOSE, "Device is not SBC-3. Verify that "
"PageLength == 0x0C"); "PageLength == 0x0C (but allow 0x3C too. Some SBC-2 "
expected_pl = 0x0c; "devices support some SBC-3 features.");
} }
CU_ASSERT_EQUAL(bl_task->datain.data[3], expected_pl); switch (bl_task->datain.data[3]) {
if (bl_task->datain.data[3] != expected_pl) { case 0x3c:
logging(LOG_NORMAL, "[FAILURE] Invalid PageLength returned. " /* accept 0x3c (==SBC-3) for all levels */
"Was %d but expected %d", break;
bl_task->datain.data[3], expected_pl); case 0x0c:
} else { /* only accept 0x0c for levels < SBC-3 */
logging(LOG_VERBOSE, "[SUCCESS] PageLength matches SCSI SBC " if (!sbc3_support) {
"level"); break;
}
/* fallthrough */
default:
CU_FAIL("[FAILED] Invalid pagelength returned");
logging(LOG_NORMAL, "[FAILURE] Invalid PageLength returned.");
} }
if (!sbc3_support) {
if (bl_task->datain.data[3] != 0x3c) {
goto finished; goto finished;
} }