TESTS: update the READ tests to the new API

Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
This commit is contained in:
Ronnie Sahlberg
2014-09-17 13:03:23 -07:00
committed by Ronnie Sahlberg
parent 4b2e9bd417
commit 28b0a0ab11
52 changed files with 324 additions and 803 deletions

View File

@@ -62,6 +62,9 @@ int invalid_cdb_ascqs[1] = {
int write_protect_ascqs[1] = {
SCSI_SENSE_ASCQ_WRITE_PROTECTED
};
int sanitize_ascqs[1] = {
SCSI_SENSE_ASCQ_SANITIZE_IN_PROGRESS
};
struct scsi_inquiry_standard *inq;
struct scsi_inquiry_logical_block_provisioning *inq_lbp;
@@ -2114,653 +2117,96 @@ int
read10(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
unsigned char *data,
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
{
struct scsi_task *task;
int ret;
logging(LOG_VERBOSE, "Send READ10 LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read10_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ10 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ10 command: "
"failed with sense. %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ10 returned SUCCESS.");
return 0;
}
int
read10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ10 (Expecting INVALID_FIELD_IN_CDB) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
logging(LOG_VERBOSE, "Send READ10 (Expecting %s) LBA:%d"
" blocks:%d rdprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
scsi_status_str(status),
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read10_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ10 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ10 successful but should "
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
logging(LOG_NORMAL, "[FAILED] READ10 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"INVALID_FIELD_IN_CDB. Sense:%s\n",
iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
task = scsi_cdb_read10(lba, datalen, blocksize, rdprotect,
dpo, fua, fua_nv, group);
assert(task != NULL);
if (data != NULL) {
task = iscsi_scsi_command_sync(iscsi, lun, task, NULL);
ret = check_result("READ10", iscsi, task, status, key, ascq, num_ascq);
if (data) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ10 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
return 0;
}
int
read10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ10 (Expecting LBA_OUT_OF_RANGE) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read10_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ10 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ10 successful but should "
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
if (task) {
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
logging(LOG_NORMAL, "[FAILED] READ10 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ10 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
return 0;
}
int
read10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ10 (Expecting MEDIUM_NOT_PRESENT) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read10_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ10 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ10 successful but should "
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_NOT_READY
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
logging(LOG_NORMAL, "[FAILED] READ10 Should have failed "
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
"with %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ10 returned MEDIUM_NOT_PRESENT.");
return 0;
return ret;
}
int
read12(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
unsigned char *data,
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
{
struct scsi_task *task;
int ret;
logging(LOG_VERBOSE, "Send READ12 LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read12_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ12 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
return -2;
}
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ12 command: "
"failed with sense. %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ12 returned SUCCESS.");
return 0;
}
int
read12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ12 (Expecting INVALID_FIELD_IN_CDB) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
logging(LOG_VERBOSE, "Send READ12 (Expecting %s) LBA:%d"
" blocks:%d rdprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
scsi_status_str(status),
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read12_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ12 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
return -2;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ12 successful but should "
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
logging(LOG_NORMAL, "[FAILED] READ12 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"INVALID_FIELD_IN_CDB. Sense:%s\n",
iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
task = scsi_cdb_read12(lba, datalen, blocksize, rdprotect,
dpo, fua, fua_nv, group);
assert(task != NULL);
if (data != NULL) {
task = iscsi_scsi_command_sync(iscsi, lun, task, NULL);
ret = check_result("READ12", iscsi, task, status, key, ascq, num_ascq);
if (data) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ12 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
return 0;
}
int
read12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ12 (Expecting LBA_OUT_OF_RANGE) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read12_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ12 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
if (task) {
scsi_free_scsi_task(task);
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
return -2;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ12 successful but should "
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
logging(LOG_NORMAL, "[FAILED] READ12 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ12 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
return 0;
}
int
read12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ12 (Expecting MEDIUM_NOT_PRESENT) "
"LBA:%d blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read12_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ12 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
return -2;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ12 successful but should "
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_NOT_READY
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
logging(LOG_NORMAL, "[FAILED] READ12 Should have failed "
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
"with %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ12 returned MEDIUM_NOT_PRESENT*.");
return 0;
return ret;
}
int
read16(struct iscsi_context *iscsi, int lun, uint64_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
unsigned char *data,
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
{
struct scsi_task *task;
int ret;
logging(LOG_VERBOSE, "Send READ16 LBA:%" PRId64 " blocks:%d "
"rdprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read16_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ16 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
if (sbc3_support) {
logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support.");
return -1;
} else {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed.");
return -2;
}
}
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ16 command: "
"failed with sense. %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ16 returned SUCCESS.");
return 0;
}
int
read16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ16 (Expecting INVALID_FIELD_IN_CDB) "
"LBA:%" PRId64 " blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
logging(LOG_VERBOSE, "Send READ16 (Expecting %s) LBA:%" PRIu64
" blocks:%d rdprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
scsi_status_str(status),
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read16_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ16 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
if (sbc3_support) {
logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support.");
return -1;
} else {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed.");
return -2;
}
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ16 successful but should "
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
logging(LOG_NORMAL, "[FAILED] READ16 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"INVALID_FIELD_IN_CDB. Sense:%s\n",
iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
task = scsi_cdb_read16(lba, datalen, blocksize, rdprotect,
dpo, fua, fua_nv, group);
assert(task != NULL);
if (data != NULL) {
task = iscsi_scsi_command_sync(iscsi, lun, task, NULL);
ret = check_result("READ16", iscsi, task, status, key, ascq, num_ascq);
if (data) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ16 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
return 0;
}
int
read16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ16 (Expecting LBA_OUT_OF_RANGE) "
"LBA:%" PRId64 " blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read16_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ16 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
if (task) {
scsi_free_scsi_task(task);
if (sbc3_support) {
logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support.");
return -1;
} else {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed.");
return -2;
}
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ16 successful but should "
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
logging(LOG_NORMAL, "[FAILED] READ16 failed with wrong sense. "
"Should have failed with ILLEGAL_REQUEST/"
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ16 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
return 0;
}
int
read16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ16 (Expecting MEDIUM_NOT_PRESENT) "
"LBA:%" PRId64 " blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read16_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ16 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
scsi_free_scsi_task(task);
if (sbc3_support) {
logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support.");
return -1;
} else {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed.");
return -2;
}
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ16 successful but should "
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_NOT_READY
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
logging(LOG_NORMAL, "[FAILED] READ16 Should have failed "
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
"with %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ16 returned MEDIUM_NOT_PRESENT.");
return 0;
}
int
read16_sanitize(struct iscsi_context *iscsi, int lun, uint64_t lba,
uint32_t datalen, int blocksize, int rdprotect,
int dpo, int fua, int fua_nv, int group,
unsigned char *data)
{
struct scsi_task *task;
logging(LOG_VERBOSE, "Send READ16 (Expecting SANITIZE_IN_PROGRESS) "
"LBA:%" PRId64 " blocks:%d rdprotect:%d "
"dpo:%d fua:%d fua_nv:%d group:%d",
lba, datalen / blocksize, rdprotect,
dpo, fua, fua_nv, group);
task = iscsi_read16_sync(iscsi, lun, lba, datalen, blocksize,
rdprotect, dpo, fua, fua_nv, group);
if (task == NULL) {
logging(LOG_NORMAL, "[FAILED] Failed to send READ16 command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL, "[FAILED] READ16 successful but should "
"have failed with NOT_READY/SANITIZE_IN_PROGRESS");
scsi_free_scsi_task(task);
return -1;
}
if (task->status != SCSI_STATUS_CHECK_CONDITION
|| task->sense.key != SCSI_SENSE_NOT_READY
|| task->sense.ascq != SCSI_SENSE_ASCQ_SANITIZE_IN_PROGRESS) {
logging(LOG_NORMAL, "[FAILED] READ16 Should have failed "
"with NOT_READY/SANITIZE_IN_PROGRESS But failed "
"with %s", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
return -1;
}
if (data != NULL) {
memcpy(data, task->datain.data, task->datain.size);
}
scsi_free_scsi_task(task);
logging(LOG_VERBOSE, "[OK] READ16 returned SANITIZE_IN_PROGRESS");
return 0;
return ret;
}
int

View File

@@ -35,11 +35,13 @@ extern const char *tgt_url;
#define EXPECT_INVALID_FIELD_IN_CDB SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_ILLEGAL_REQUEST, invalid_cdb_ascqs, 1
#define EXPECT_MISCOMPARE SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_MISCOMPARE, 0, 0
#define EXPECT_WRITE_PROTECTED SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_DATA_PROTECTION, write_protect_ascqs, 1
#define EXPECT_SANITIZE SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_NOT_READY, sanitize_ascqs, 1
int no_medium_ascqs[3];
int lba_oob_ascqs[1];
int invalid_cdb_ascqs[1];
int write_protect_ascqs[1];
int sanitize_ascqs[1];
extern int loglevel;
#define LOG_SILENT 0
@@ -262,19 +264,9 @@ int preventallow(struct iscsi_context *iscsi, int lun, int prevent);
int read6(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data);
int read6_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data);
struct scsi_task *read10_task(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read16_sanitize(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
int read10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int readcapacity10(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi);
int readcapacity10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi);
int readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len);

View File

@@ -101,7 +101,8 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are still unchanged as 'A'", i);
ret = read16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) {
@@ -159,7 +160,8 @@ test_compareandwrite_miscompare(void)
"they are still unchanged as 'A'",
i, num_blocks - i);
ret = read16(iscsic, tgt_lun, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) {

View File

@@ -99,7 +99,8 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are all 'B'", i);
ret = read16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) {
@@ -153,7 +154,8 @@ test_compareandwrite_simple(void)
" and verify they are all 'B'",
i, num_blocks - i);
ret = read16(iscsic, tgt_lun, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) {

View File

@@ -52,13 +52,15 @@ test_mandatory_sbc(void)
logging(LOG_VERBOSE, "Test READ10.");
ret = read10(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL);
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (sbc3_support) {
logging(LOG_VERBOSE, "Test READ16. the device claims SBC-3 support.");
ret = read16(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL);
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -69,18 +69,21 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test READ10 when medium is ejected.");
ret = read10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 when medium is ejected.");
ret = read12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 when medium is ejected.");
ret = read16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READCAPACITY10 when medium is ejected.");

View File

@@ -66,7 +66,8 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf);
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5");
@@ -82,7 +83,8 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf);
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xff");
@@ -113,7 +115,8 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(iscsic, tgt_lun, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf);
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5");
@@ -129,7 +132,8 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(iscsic, tgt_lun, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf);
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xff");

View File

@@ -31,7 +31,8 @@ test_read10_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0");
ret = read10(iscsic, tgt_lun, 0, 0, block_size,
0, 0, 0, 0, 0, NULL);
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (num_blocks > 0x80000000) {
@@ -40,19 +41,22 @@ test_read10_0blocks(void)
}
logging(LOG_VERBOSE, "Test READ10 0-blocks one block past end-of-LUN");
ret = read10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31");
ret = read10_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1");
ret = read10_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -40,9 +40,9 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -52,9 +52,9 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -64,8 +64,9 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -75,9 +76,9 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -37,35 +37,35 @@ test_read10_flags(void)
logging(LOG_VERBOSE, "Test READ10 with DPO==1");
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 0, 0, 0, NULL);
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==1 FUA_NV==0");
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 0, 0, NULL);
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==1 FUA_NV==1");
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 1, 0, NULL);
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==0 FUA_NV==1");
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 0, 1, 0, NULL);
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with DPO==1 FUA==1 FUA_NV==1");
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 1, 1, 0, NULL);
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -42,9 +42,10 @@ test_read10_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
ret = read10(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
}
return;

View File

@@ -38,7 +38,8 @@ test_read10_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -49,7 +50,8 @@ test_read10_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL);
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -31,7 +31,8 @@ test_read12_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0");
ret = read12(iscsic, tgt_lun, 0, 0, block_size,
0, 0, 0, 0, 0, NULL);
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
@@ -45,19 +46,22 @@ test_read12_0blocks(void)
}
logging(LOG_VERBOSE, "Test READ12 0-blocks one block past end-of-LUN");
ret = read12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==2^31");
ret = read12_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==-1");
ret = read12_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -40,9 +40,9 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
@@ -57,9 +57,9 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -69,8 +69,9 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -80,9 +81,9 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -37,8 +37,8 @@ test_read12_flags(void)
logging(LOG_VERBOSE, "Test READ12 with DPO==1");
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 0, 0, 0, NULL);
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
@@ -49,28 +49,28 @@ test_read12_flags(void)
logging(LOG_VERBOSE, "Test READ12 with FUA==1 FUA_NV==0");
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 0, 0, NULL);
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with FUA==1 FUA_NV==1");
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 1, 0, NULL);
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with FUA==0 FUA_NV==1");
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 0, 1, 0, NULL);
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with DPO==1 FUA==1 FUA_NV==1");
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 1, 1, 0, NULL);
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -41,9 +41,10 @@ test_read12_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
ret = read12(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");

View File

@@ -38,7 +38,8 @@ test_read12_simple(void)
break;
}
ret = read12(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
@@ -54,7 +55,8 @@ test_read12_simple(void)
break;
}
ret = read12(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL);
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -33,7 +33,8 @@ test_read16_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0");
ret = read16(iscsic, tgt_lun, 0, 0, block_size,
0, 0, 0, 0, 0, NULL);
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support.");
CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");
@@ -42,19 +43,22 @@ test_read16_0blocks(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN");
ret = read16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==2^63");
ret = read16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL, 0,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, 0x8000000000000000ULL, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==-1");
ret = read16_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -49,9 +49,9 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support.");
CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");
@@ -67,9 +67,9 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, 0x8000000000000000ULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -81,10 +81,10 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun,
1ULL << (64 - ilog2(block_size)),
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun,
1ULL << (64 - ilog2(block_size)),
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -96,10 +96,10 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun,
1ULL << (63 - ilog2(block_size)),
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun,
1ULL << (63 - ilog2(block_size)),
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -110,8 +110,9 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -122,9 +123,9 @@ test_read16_beyond_eol(void)
break;
}
ret = read16_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size,
0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -37,8 +37,8 @@ test_read16_flags(void)
logging(LOG_VERBOSE, "Test READ16 with DPO==1");
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 0, 0, 0, NULL);
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support.");
CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");
@@ -49,28 +49,28 @@ test_read16_flags(void)
logging(LOG_VERBOSE, "Test READ16 with FUA==1 FUA_NV==0");
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 0, 0, NULL);
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with FUA==1 FUA_NV==1");
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 1, 1, 0, NULL);
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with FUA==0 FUA_NV==1");
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
0, 0, 0, 1, 0, NULL);
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1 FUA_NV==1");
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
0, 1, 1, 1, 0, NULL);
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -41,9 +41,10 @@ test_read16_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not im lemented on this target and it does not claim SBC-3 support.");
CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");

View File

@@ -40,7 +40,8 @@ test_read16_simple(void)
}
ret = read16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL);
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support.");
CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");
@@ -57,8 +58,8 @@ test_read16_simple(void)
}
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL);
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -208,7 +208,8 @@ check_lun_is_wiped(unsigned char *buf, uint64_t lba)
unsigned char *rbuf = alloca(256 * block_size);
ret = read16(iscsic, tgt_lun, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf);
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 == NULL) {

View File

@@ -118,7 +118,8 @@ check_lun_is_wiped(unsigned char *buf, uint64_t lba)
unsigned char *rbuf = alloca(256 * block_size);
ret = read16(iscsic, tgt_lun, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf);
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (!memcmp(buf, rbuf, 256 * block_size)) {

View File

@@ -47,7 +47,8 @@ check_lun_is_wiped(uint64_t lba, char c)
unsigned char *zbuf = alloca(256 * block_size);
ret = read16(iscsic, tgt_lun, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf);
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
memset(zbuf, c, 256 * block_size);

View File

@@ -96,8 +96,9 @@ test_sanitize_reset(void)
logging(LOG_VERBOSE, "Verify that READ16 fails with "
"SANITIZE_IN_PROGRESS");
ret = read16_sanitize(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, NULL);
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that INQUIRY is still allowed while "

View File

@@ -69,7 +69,8 @@ test_unmap_simple(void)
logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 && rc16->lbprz) {
@@ -102,7 +103,8 @@ test_unmap_simple(void)
logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 && rc16->lbprz) {

View File

@@ -35,7 +35,8 @@ test_verify10_flags(void)
logging(LOG_VERBOSE, "Test VERIFY10 flags");
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -41,7 +41,8 @@ test_verify10_mismatch(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */
@@ -66,7 +67,8 @@ test_verify10_mismatch(void)
break;
}
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -41,7 +41,8 @@ test_verify10_mismatch_no_cmp(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */
@@ -67,7 +68,8 @@ test_verify10_mismatch_no_cmp(void)
break;
}
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -39,7 +39,8 @@ test_verify10_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify10(iscsic, tgt_lun, 0, i * block_size,
@@ -59,7 +60,8 @@ test_verify10_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify10(iscsic, tgt_lun, num_blocks - i,

View File

@@ -41,7 +41,8 @@ test_verify10_vrprotect(void)
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify10(iscsic, tgt_lun, 0, block_size,

View File

@@ -35,8 +35,9 @@ test_verify12_flags(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 flags");
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = read12(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,8 +40,9 @@ test_verify12_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = read12(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */
buf[offset] ^= 'X';
@@ -66,7 +67,8 @@ test_verify12_mismatch(void)
break;
}
ret = read12(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -40,8 +40,9 @@ test_verify12_mismatch_no_cmp(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = read12(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */
buf[offset] ^= 'X';
@@ -66,7 +67,8 @@ test_verify12_mismatch_no_cmp(void)
break;
}
ret = read12(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -39,7 +39,8 @@ test_verify12_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify12(iscsic, tgt_lun, 0, i * block_size,
@@ -59,7 +60,8 @@ test_verify12_simple(void)
break;
}
ret = read12(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify12(iscsic, tgt_lun, num_blocks - i,

View File

@@ -42,8 +42,8 @@ test_verify12_vrprotect(void)
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
ret = verify12(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -36,8 +36,8 @@ test_verify16_flags(void)
logging(LOG_VERBOSE, "Test VERIFY16 flags");
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Test VERIFY16 with DPO==1");
ret = verify16(iscsic, tgt_lun, 0, block_size,

View File

@@ -42,7 +42,8 @@ test_verify16_mismatch(void)
}
ret = read16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */
buf[offset] ^= 'X';
@@ -68,7 +69,8 @@ test_verify16_mismatch(void)
}
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -42,7 +42,8 @@ test_verify16_mismatch_no_cmp(void)
}
ret = read16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */
buf[offset] ^= 'X';
@@ -68,7 +69,8 @@ test_verify16_mismatch_no_cmp(void)
}
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */

View File

@@ -39,8 +39,8 @@ test_verify16_simple(void)
break;
}
ret = read10(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
ret = verify16(iscsic, tgt_lun, 0, i * block_size,
block_size, 0, 0, 1, buf,
EXPECT_STATUS_GOOD);
@@ -59,7 +59,8 @@ test_verify16_simple(void)
}
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
ret = verify16(iscsic, tgt_lun, num_blocks - i,

View File

@@ -42,8 +42,8 @@ test_verify16_vrprotect(void)
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
ret = verify16(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -290,7 +290,8 @@ test_write10_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -365,7 +366,8 @@ test_write10_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");

View File

@@ -290,7 +290,8 @@ test_write12_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -365,7 +366,8 @@ test_write12_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");

View File

@@ -285,7 +285,8 @@ test_write16_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -360,7 +361,8 @@ test_write16_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");

View File

@@ -63,8 +63,9 @@ test_writesame10_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
i * block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
@@ -101,8 +102,9 @@ test_writesame10_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
i * block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
@@ -176,8 +178,9 @@ test_writesame10_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read10(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
i * block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);

View File

@@ -66,7 +66,8 @@ test_writesame10_unmap_until_end(void)
"are now zero", i);
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}

View File

@@ -68,7 +68,8 @@ test_writesame16_unmap(void)
"are now zero", i);
ret = read16(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}
@@ -102,7 +103,8 @@ test_writesame16_unmap(void)
"are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}
@@ -173,8 +175,9 @@ test_writesame16_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
i * block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}
@@ -224,8 +227,9 @@ test_writesame16_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i);
ret = read16(iscsic, tgt_lun, 0,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
i * block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}

View File

@@ -69,7 +69,8 @@ test_writesame16_unmap_until_end(void)
"are now zero", i);
ret = read16(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}

View File

@@ -295,7 +295,8 @@ test_writeverify10_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -370,7 +371,8 @@ test_writeverify10_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");

View File

@@ -295,7 +295,8 @@ test_writeverify12_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -370,7 +371,8 @@ test_writeverify12_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");

View File

@@ -296,7 +296,8 @@ test_writeverify16_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
@@ -371,7 +372,8 @@ test_writeverify16_residuals(void)
logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(iscsic, tgt_lun, 0, 2* block_size,
block_size, 0, 0, 0, 0, 0, buf);
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");