TESTS: fix some bugs in the tests for INQUIRY

This commit is contained in:
Ronnie Sahlberg
2013-04-26 17:43:06 -07:00
parent e33194d94a
commit 78e02737c6
2 changed files with 15 additions and 4 deletions

View File

@@ -75,6 +75,7 @@ test_inquiry_alloc_length(void)
logging(LOG_NORMAL, "[SKIPPED] This device does not claim "
"SPC-3 or later");
CU_PASS("[SKIPPED] Not SPC-3 or later");
goto finished;
}
logging(LOG_VERBOSE, "Version is SPC-3 or later. Read INQUIRY data using 16-bit allocation length");
@@ -88,6 +89,7 @@ test_inquiry_alloc_length(void)
CU_ASSERT_EQUAL(ret, 0);
finished:
if (task != NULL) {
scsi_free_scsi_task(task);
task = NULL;

View File

@@ -71,15 +71,24 @@ test_inquiry_standard(void)
CU_FAIL("Invalid version in INQUIRY data");
}
logging(LOG_VERBOSE, "Verify response-data-format is 2");
logging(LOG_VERBOSE, "Verify response-data-format is 2 "
"(SPC-2 or later)");
if (inq->response_data_format != 2) {
logging(LOG_NORMAL, "[FAILED] Response data format is "
"invalid. Must be 2 but device returned %d",
inq->response_data_format);
}
CU_ASSERT_EQUAL(inq->response_data_format, 2);
logging(LOG_VERBOSE, "Verify additional-length is correct");
if (inq->additional_length != task->datain.size - 5) {
logging(LOG_NORMAL, "[FAILED] Bad additional length "
"returned. Should be %d but device returned %d.",
task->datain.size - 5,
inq->additional_length);
}
CU_ASSERT_EQUAL(inq->additional_length, task->datain.size - 5);
logging(LOG_VERBOSE, "Verify Hi-Sup is set");
CU_ASSERT_EQUAL(inq->hisup, 1);
logging(LOG_VERBOSE, "Verify VENDOR_IDENTIFICATION is in ASCII");
for (i = 8; i < 16; i++) {
/* SPC-4 4.4.1 only characters 0x00 and 0x20-0x7E allowed */