ported 3 more group reservation tests to CUnit

Ported 3 more group reservation tests to new the CUnit format.
This commit is contained in:
Lee Duncan
2013-02-16 13:56:21 -08:00
committed by Ronnie Sahlberg
parent 99ef5c6495
commit 9b436eee2f
8 changed files with 266 additions and 2 deletions

View File

@@ -187,6 +187,49 @@ iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
return real_iscsi_queue_pdu(iscsi, pdu);
}
int
prin_task(struct iscsi_context *iscsi, int lun, int service_action,
int success_expected)
{
const int buf_sz = 16384;
struct scsi_task *task;
int ret = 0;
logging(LOG_VERBOSE, "Send PRIN/SA=0x%02x, expect %s", service_action,
success_expected ? "success" : "failure");
task = iscsi_persistent_reserve_in_sync(iscsi, lun,
service_action, buf_sz);
if (task == NULL) {
logging(LOG_NORMAL,
"[FAILED] Failed to send PRIN command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (success_expected) {
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL,
"[FAILED] PRIN/SA=0x%x failed: %s",
service_action, iscsi_get_error(iscsi));
ret = -1;
}
} else {
if (task->status == SCSI_STATUS_GOOD) {
logging(LOG_NORMAL,
"[FAILED] PRIN/SA=0x%x succeeded with invalid serviceaction",
service_action);
ret = -1;
}
}
scsi_free_scsi_task(task);
task = NULL;
return ret;
}
int
prin_read_keys(struct iscsi_context *iscsi, int lun, struct scsi_task **tp,
struct scsi_persistent_reserve_in_read_keys **rkp)