TEST: READ6 add a test to verify that READ6 with transferlength

gets 256 blocks of data back from the target.
This commit is contained in:
Ronnie Sahlberg
2013-05-30 19:16:57 -07:00
parent 5713c2d363
commit 5494580b4a

View File

@@ -51,4 +51,31 @@ test_read6_simple(void)
i * block_size, block_size, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Transfer length == 0 means we want to transfer "
"256 blocks");
logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 "
"(meaning 256 blocks)");
/* 256 is converted to 0 when the CDB is marshalled by the helper */
task = iscsi_read6_sync(iscsic, tgt_lun, 0,
256 * block_size, block_size);
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ6 command: "
"failed with sense. %s", iscsi_get_error(iscsic));
scsi_free_scsi_task(task);
}
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
logging(LOG_VERBOSE, "Verify that we did get 256 blocks of data back");
if (task->datain.size == (int)(256 * block_size)) {
logging(LOG_VERBOSE, "[SUCCESS] Target returned 256 blocks of "
"data");
} else {
logging(LOG_NORMAL, "[FAILED] Target did not return 256 "
"blocks of data");
}
CU_ASSERT_EQUAL(task->datain.size, (int)(256 * block_size));
}