TESTS: tweak inquiry blocklimits test

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2014-09-27 12:54:34 -07:00
parent f3205bb095
commit d411f12bbc

View File

@@ -38,9 +38,10 @@ test_inquiry_block_limits(void)
CHECK_FOR_SBC;
logging(LOG_VERBOSE, "Block device. Verify that we can read Block Limits VPD");
logging(LOG_VERBOSE, "Block device. Verify that we can read Block "
"Limits VPD");
ret = inquiry(sd, &bl_task,
1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64,
1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) {
@@ -57,45 +58,46 @@ test_inquiry_block_limits(void)
goto finished;
}
logging(LOG_VERBOSE, "Verify that the PageLength matches up with the size of the DATA-IN buffer.");
logging(LOG_VERBOSE, "Verify that the PageLength matches up with the "
"size of the DATA-IN buffer.");
CU_ASSERT_EQUAL(bl_task->datain.size, bl_task->datain.data[3] + 4);
if (bl_task->datain.size != bl_task->datain.data[3] + 4) {
logging(LOG_NORMAL, "[FAILURE] Invalid PageLength returned. "
"Was %d but expected %d",
bl_task->datain.data[3], bl_task->datain.size - 4);
} else {
logging(LOG_VERBOSE, "[SUCCESS] PageLength matches DataIn buffer size");
logging(LOG_VERBOSE, "[SUCCESS] PageLength matches DataIn "
"buffer size");
}
logging(LOG_VERBOSE, "Verify that the PageLength matches SCSI-level.");
/* if it is not SBC3 then we assume it must be SBC2 */
if (sbc3_support) {
logging(LOG_VERBOSE, "Device claims SBC-3. Verify that " "PageLength == 0x3C");
logging(LOG_VERBOSE, "Device claims SBC-3. Verify that " "page size is >= 60");
} else {
logging(LOG_VERBOSE, "Device is not SBC-3. Verify that "
"PageLength == 0x0C (but allow 0x3C too. Some SBC-2 "
"PageLength == 8 (but allow >= 60 too. Some SBC-2 "
"devices support some SBC-3 features.");
}
switch (bl_task->datain.data[3]) {
case 0x3c:
/* accept 0x3c (==SBC-3) for all levels */
if (!sbc3_support) {
logging(LOG_NORMAL, "[WARNING] SBC-3 pagelength (0x3C) "
"returned but SBC-3 support was not claimed "
"in the standard inquiry page.");
}
break;
case 0x0c:
/* only accept 0x0c for levels < SBC-3 */
if (!sbc3_support) {
break;
}
/* fallthrough */
default:
CU_FAIL("[FAILED] Invalid pagelength returned");
logging(LOG_NORMAL, "[FAILURE] Invalid PageLength returned.");
}
if (bl_task->datain.data[3] == 8) {
if (sbc3_support) {
logging(LOG_NORMAL, "[FAILURE] Invalid PageLength "
"returned. SBC3 claimed but page length "
"is 8.");
CU_FAIL("[FAILED] Invalid pagelength returned. "
"SBC3 claimed but page length is 8.");
}
} else if (bl_task->datain.size >= 60) {
if (!sbc3_support) {
logging(LOG_NORMAL, "[WARNING] SBC-3 pagelength "
"(>=60) returned but SBC-3 support was not "
"claimed in the standard inquiry page.");
CU_FAIL("[WARNING] SBC-3 pagelength "
"(>=60) returned but SBC-3 support was not "
"claimed in the standard inquiry page.");
}
}
if (bl_task->datain.data[3] != 0x3c) {
goto finished;
@@ -108,7 +110,7 @@ test_inquiry_block_limits(void)
*/
logging(LOG_VERBOSE, "Try reading the logical block provisioning VPD");
ret = inquiry(sd, &lbp_task,
1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64,
1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 255,
EXPECT_STATUS_GOOD);
if (ret == 0) {
lbp = scsi_datain_unmarshall(lbp_task);