TESTS: rework WRITEVERIFY* tests to the new API
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
8ffd78c117
commit
d3f98dfdd5
@@ -4165,60 +4165,17 @@ writesame16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_
|
||||
|
||||
int
|
||||
writeverify10(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group, unsigned char *data,
|
||||
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
struct iscsi_data d;
|
||||
int ret;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 LBA:%d blocks:%d "
|
||||
"wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify10_sync(iscsi, lun, lba,
|
||||
data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY10 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] WRITEVERIFY10 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 command: "
|
||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY10 returned SUCCESS.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 (Expecting INVALID_FIELD_IN_CDB) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 (Expecting %s) LBA:%d "
|
||||
"blocks:%d wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
scsi_status_str(status),
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
@@ -4227,263 +4184,34 @@ writeverify10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t l
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY10 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) {
|
||||
task = scsi_cdb_writeverify10(lba, datalen, blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
assert(task != NULL);
|
||||
|
||||
d.data = data;
|
||||
d.size = datalen;
|
||||
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||
|
||||
ret = check_result("WRITEVERIFY10", iscsi, task, status, key, ascq, num_ascq);
|
||||
if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY10 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 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] WRITEVERIFY10 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY10 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 (Expecting LBA_OUT_OF_RANGE) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY10 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] WRITEVERIFY10 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 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] WRITEVERIFY10 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY10 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 (Expecting WRITE_PROTECTED) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY10 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] WRITEVERIFY10 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 successful but should "
|
||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 failed with wrong sense. "
|
||||
"Should have failed with DATA_PRTOTECTION/"
|
||||
"WRITE_PROTECTED. Sense:%s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY10 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY10 (Expecting MEDIUM_NOT_PRESENT) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY10 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] WRITEVERIFY10 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY10 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] WRITEVERIFY10 Should have failed "
|
||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
||||
"with %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY10 returned MEDIUM_NOT_PRESENT.");
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify12(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group, unsigned char *data,
|
||||
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
struct iscsi_data d;
|
||||
int ret;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 LBA:%d blocks:%d "
|
||||
"wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify12_sync(iscsi, lun, lba,
|
||||
data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY12 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] WRITEVERIFY12 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 command: "
|
||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY12 returned SUCCESS.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 (Expecting INVALID_FIELD_IN_CDB) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 (Expecting %s) LBA:%d "
|
||||
"blocks:%d wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
scsi_status_str(status),
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
@@ -4492,263 +4220,34 @@ writeverify12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t l
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY12 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) {
|
||||
task = scsi_cdb_writeverify12(lba, datalen, blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
assert(task != NULL);
|
||||
|
||||
d.data = data;
|
||||
d.size = datalen;
|
||||
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||
|
||||
ret = check_result("WRITEVERIFY12", iscsi, task, status, key, ascq, num_ascq);
|
||||
if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY12 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 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] WRITEVERIFY12 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY12 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 (Expecting LBA_OUT_OF_RANGE) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY12 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] WRITEVERIFY12 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 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] WRITEVERIFY12 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY12 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify12_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 (Expecting WRITE_PROTECTED) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY12 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] WRITEVERIFY12 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 successful but should "
|
||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 failed with wrong sense. "
|
||||
"Should have failed with DATA_PRTOTECTION/"
|
||||
"WRITE_PROTECTED. Sense:%s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY12 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY12 (Expecting MEDIUM_NOT_PRESENT) "
|
||||
"LBA:%d blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY12 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] WRITEVERIFY12 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY12 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] WRITEVERIFY12 Should have failed "
|
||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
||||
"with %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY12 returned MEDIUM_NOT_PRESENT.");
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify16(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group, unsigned char *data,
|
||||
int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
struct iscsi_data d;
|
||||
int ret;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 LBA:%" PRIu64 " blocks:%d "
|
||||
"wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify16_sync(iscsi, lun, lba,
|
||||
data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY16 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] WRITEVERIFY16 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 command: "
|
||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY16 returned SUCCESS.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 (Expecting INVALID_FIELD_IN_CDB) "
|
||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 (Expecting %s) LBA:%" PRIu64
|
||||
" blocks:%d wrprotect:%d dpo:%d bytchk:%d group:%d",
|
||||
scsi_status_str(status),
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
@@ -4757,205 +4256,19 @@ writeverify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t l
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY16 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) {
|
||||
task = scsi_cdb_writeverify16(lba, datalen, blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
assert(task != NULL);
|
||||
|
||||
d.data = data;
|
||||
d.size = datalen;
|
||||
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||
|
||||
ret = check_result("WRITEVERIFY16", iscsi, task, status, key, ascq, num_ascq);
|
||||
if (task) {
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY16 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 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] WRITEVERIFY16 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY16 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 (Expecting LBA_OUT_OF_RANGE) "
|
||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY16 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] WRITEVERIFY16 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 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] WRITEVERIFY16 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;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY16 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 (Expecting WRITE_PROTECTED) "
|
||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY16 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] WRITEVERIFY16 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 successful but should "
|
||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 failed with wrong sense. "
|
||||
"Should have failed with DATA_PRTOTECTION/"
|
||||
"WRITE_PROTECTED. Sense:%s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY16 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
writeverify16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize, int wrprotect,
|
||||
int dpo, int bytchk, int group,
|
||||
unsigned char *data)
|
||||
{
|
||||
struct scsi_task *task;
|
||||
|
||||
logging(LOG_VERBOSE, "Send WRITEVERIFY16 (Expecting MEDIUM_NOT_PRESENT) "
|
||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
||||
"dpo:%d bytchk:%d group:%d",
|
||||
lba, datalen / blocksize, wrprotect,
|
||||
dpo, bytchk, group);
|
||||
|
||||
if (!data_loss) {
|
||||
printf("--dataloss flag is not set in. Skipping write\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
task = iscsi_writeverify16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
||||
wrprotect, dpo, bytchk, group);
|
||||
if (task == NULL) {
|
||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITEVERIFY16 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] WRITEVERIFY16 is not implemented.");
|
||||
return -2;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
logging(LOG_NORMAL, "[FAILED] WRITEVERIFY16 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] WRITEVERIFY16 Should have failed "
|
||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
||||
"with %s", iscsi_get_error(iscsi));
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
logging(LOG_VERBOSE, "[OK] WRITEVERIFY16 returned MEDIUM_NOT_PRESENT.");
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -324,21 +324,9 @@ int writesame16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba
|
||||
int writesame16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writesame16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||
int writeverify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data);
|
||||
int writeverify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int writeverify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
int writeverify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||
|
||||
int set_swp(struct iscsi_context *iscsi, int lun);
|
||||
int clear_swp(struct iscsi_context *iscsi, int lun);
|
||||
|
||||
@@ -184,8 +184,9 @@ test_nomedia_sbc(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 when medium is ejected.");
|
||||
ret = writeverify10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY10");
|
||||
@@ -194,8 +195,9 @@ test_nomedia_sbc(void)
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 when medium is ejected.");
|
||||
ret = writeverify12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY12");
|
||||
@@ -204,8 +206,9 @@ test_nomedia_sbc(void)
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 when medium is ejected.");
|
||||
ret = writeverify16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, 0, block_size, block_size,
|
||||
0, 0, 0, 0, buf,
|
||||
EXPECT_NO_MEDIUM);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] target does not support "
|
||||
"WRITEVERIFY16");
|
||||
|
||||
@@ -111,27 +111,27 @@ test_readonly_sbc(void)
|
||||
CU_ASSERT_NOT_EQUAL(ret, -1);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 fails with WRITE_PROTECTED");
|
||||
ret = writeverify10_writeprotected(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, 0,
|
||||
block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_WRITE_PROTECTED);
|
||||
if (ret == -2) {
|
||||
logging(LOG_VERBOSE, "WRITEVERIFY10 not supported on target. Skipped.");
|
||||
}
|
||||
CU_ASSERT_NOT_EQUAL(ret, -1);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 fails with WRITE_PROTECTED");
|
||||
ret = writeverify12_writeprotected(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, 0,
|
||||
block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_WRITE_PROTECTED);
|
||||
if (ret == -2) {
|
||||
logging(LOG_VERBOSE, "WRITEVERIFY12 not supported on target. Skipped.");
|
||||
}
|
||||
CU_ASSERT_NOT_EQUAL(ret, -1);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 fails with WRITE_PROTECTED");
|
||||
ret = writeverify16_writeprotected(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, 0,
|
||||
block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_WRITE_PROTECTED);
|
||||
if (ret == -2) {
|
||||
logging(LOG_VERBOSE, "WRITEVERIFY16 not supported on target. Skipped.");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ test_writeverify10_0blocks(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==0");
|
||||
ret = writeverify10(iscsic, tgt_lun, 0, 0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY10 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY10 is not implemented.");
|
||||
@@ -47,19 +48,22 @@ test_writeverify10_0blocks(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks one block past end-of-LUN");
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
ret = writeverify10(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==2^31");
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
ret = writeverify10(iscsic, tgt_lun, 0x80000000, 0,
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==-1");
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
ret = writeverify10(iscsic, tgt_lun, -1, 0, block_size,
|
||||
0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ test_writeverify10_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY10 is not implemented.");
|
||||
@@ -61,9 +61,9 @@ test_writeverify10_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, 0x80000000,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,9 @@ test_writeverify10_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, -1, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -84,9 +85,9 @@ test_writeverify10_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify10_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, num_blocks - 1,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ test_writeverify10_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 with DPO==1");
|
||||
ret = writeverify10(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 1, 0, 0, buf);
|
||||
block_size, block_size, 0, 1, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY10 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY10 is not implemented.");
|
||||
@@ -50,7 +50,7 @@ test_writeverify10_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 with BYTCHK==1");
|
||||
ret = writeverify10(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 1, 0, buf);
|
||||
block_size, block_size, 0, 0, 1, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ test_writeverify10_residuals(void)
|
||||
|
||||
/* check if writeverify10 is supported */
|
||||
ret = writeverify10(iscsic, tgt_lun, 0, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support WRITEVERIFY10. Skipping test");
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,8 @@ test_writeverify10_simple(void)
|
||||
break;
|
||||
}
|
||||
ret = writeverify10(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf);
|
||||
block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITEVERIFY10 is not implemented.");
|
||||
CU_PASS("[SKIPPED] Target does not support WRITEVERIFY10. Skipping test");
|
||||
@@ -57,7 +58,8 @@ test_writeverify10_simple(void)
|
||||
break;
|
||||
}
|
||||
ret = writeverify10(iscsic, tgt_lun, num_blocks - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf);
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,10 @@ test_writeverify10_wrprotect(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 = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf);
|
||||
ret = writeverify10(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY10 is not implemented.");
|
||||
|
||||
@@ -38,7 +38,8 @@ test_writeverify12_0blocks(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==0");
|
||||
ret = writeverify12(iscsic, tgt_lun, 0, 0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY12 is not implemented.");
|
||||
@@ -47,19 +48,22 @@ test_writeverify12_0blocks(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks one block past end-of-LUN");
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
ret = writeverify12(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==2^31");
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
ret = writeverify12(iscsic, tgt_lun, 0x80000000, 0,
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==-1");
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
ret = writeverify12(iscsic, tgt_lun, -1, 0, block_size,
|
||||
0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ test_writeverify12_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY12 is not implemented.");
|
||||
@@ -61,9 +61,9 @@ test_writeverify12_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, 0x80000000,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,9 @@ test_writeverify12_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, -1, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -84,9 +85,9 @@ test_writeverify12_beyond_eol(void)
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = writeverify12_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, num_blocks - 1,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ test_writeverify12_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 with DPO==1");
|
||||
ret = writeverify12(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 1, 0, 0, buf);
|
||||
block_size, block_size, 0, 1, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY12 is not implemented.");
|
||||
@@ -50,7 +50,7 @@ test_writeverify12_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY12 with BYTCHK==1");
|
||||
ret = writeverify12(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 1, 0, buf);
|
||||
block_size, block_size, 0, 0, 1, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ test_writeverify12_residuals(void)
|
||||
|
||||
/* check if writeverify12 is supported */
|
||||
ret = writeverify12(iscsic, tgt_lun, 0, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support WRITEVERIFY12. Skipping test");
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,8 @@ test_writeverify12_simple(void)
|
||||
break;
|
||||
}
|
||||
ret = writeverify12(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf);
|
||||
block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY12 is not implemented.");
|
||||
@@ -57,7 +58,8 @@ test_writeverify12_simple(void)
|
||||
break;
|
||||
}
|
||||
ret = writeverify12(iscsic, tgt_lun, num_blocks - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf);
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,10 @@ test_writeverify12_wrprotect(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 = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf);
|
||||
ret = writeverify12(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY12 is not implemented.");
|
||||
|
||||
@@ -34,8 +34,8 @@ test_writeverify16_0blocks(void)
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==0");
|
||||
ret = writeverify16(iscsic, tgt_lun, 0,
|
||||
0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY16 is not implemented.");
|
||||
@@ -44,22 +44,22 @@ test_writeverify16_0blocks(void)
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks one block past end-of-LUN");
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1,
|
||||
0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
ret = writeverify16(iscsic, tgt_lun, num_blocks + 1,
|
||||
0, block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==2^63");
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL,
|
||||
0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
ret = writeverify16(iscsic, tgt_lun, 0x8000000000000000ULL,
|
||||
0, block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==-1");
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun, -1,
|
||||
0, block_size,
|
||||
0, 0, 0, 0, NULL);
|
||||
ret = writeverify16(iscsic, tgt_lun, -1,
|
||||
0, block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,9 @@ test_writeverify16_beyond_eol(void)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun,
|
||||
num_blocks + 1 - i,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY16 is not implemented.");
|
||||
@@ -60,10 +59,9 @@ test_writeverify16_beyond_eol(void)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun,
|
||||
0x8000000000000000ULL,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, 0x8000000000000000ULL,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -74,10 +72,9 @@ test_writeverify16_beyond_eol(void)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun,
|
||||
-1,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, -1,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -88,10 +85,9 @@ test_writeverify16_beyond_eol(void)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = writeverify16_lbaoutofrange(iscsic, tgt_lun,
|
||||
num_blocks - 1,
|
||||
i * block_size, block_size,
|
||||
0, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, num_blocks - 1,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_LBA_OOB);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ test_writeverify16_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 with DPO==1");
|
||||
ret = writeverify16(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 1, 0, 0, buf);
|
||||
block_size, block_size, 0, 1, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY16 is not implemented.");
|
||||
@@ -50,7 +50,7 @@ test_writeverify16_flags(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITEVERIFY16 with BYTCHK==1");
|
||||
ret = writeverify16(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
0, 0, 1, 0, buf);
|
||||
block_size, block_size, 0, 0, 1, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ test_writeverify16_residuals(void)
|
||||
|
||||
/* check if writeverify16 is supported */
|
||||
ret = writeverify16(iscsic, tgt_lun, 0, 0,
|
||||
block_size, 0, 0, 0, 0, NULL);
|
||||
block_size, 0, 0, 0, 0, NULL,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("[SKIPPED] Target does not support WRITEVERIFY16. Skipping test");
|
||||
|
||||
@@ -44,7 +44,8 @@ test_writeverify16_simple(void)
|
||||
}
|
||||
|
||||
ret = writeverify16(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, buf);
|
||||
block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY16 is not implemented.");
|
||||
@@ -60,7 +61,8 @@ test_writeverify16_simple(void)
|
||||
}
|
||||
|
||||
ret = writeverify16(iscsic, tgt_lun, num_blocks - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf);
|
||||
i * block_size, block_size, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,10 @@ test_writeverify16_wrprotect(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 = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf);
|
||||
ret = writeverify16(iscsic, tgt_lun, 0,
|
||||
block_size, block_size,
|
||||
i, 0, 0, 0, buf,
|
||||
EXPECT_INVALID_FIELD_IN_CDB);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
|
||||
CU_PASS("WRITEVERIFY16 is not implemented.");
|
||||
|
||||
Reference in New Issue
Block a user