TESTS: fix some bugs in the tests for INQUIRY
This commit is contained in:
@@ -75,6 +75,7 @@ test_inquiry_alloc_length(void)
|
|||||||
logging(LOG_NORMAL, "[SKIPPED] This device does not claim "
|
logging(LOG_NORMAL, "[SKIPPED] This device does not claim "
|
||||||
"SPC-3 or later");
|
"SPC-3 or later");
|
||||||
CU_PASS("[SKIPPED] Not 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");
|
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);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
|
finished:
|
||||||
if (task != NULL) {
|
if (task != NULL) {
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
task = NULL;
|
task = NULL;
|
||||||
|
|||||||
@@ -71,15 +71,24 @@ test_inquiry_standard(void)
|
|||||||
CU_FAIL("Invalid version in INQUIRY data");
|
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);
|
CU_ASSERT_EQUAL(inq->response_data_format, 2);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Verify additional-length is correct");
|
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);
|
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");
|
logging(LOG_VERBOSE, "Verify VENDOR_IDENTIFICATION is in ASCII");
|
||||||
for (i = 8; i < 16; i++) {
|
for (i = 8; i < 16; i++) {
|
||||||
/* SPC-4 4.4.1 only characters 0x00 and 0x20-0x7E allowed */
|
/* SPC-4 4.4.1 only characters 0x00 and 0x20-0x7E allowed */
|
||||||
|
|||||||
Reference in New Issue
Block a user