Converted first PGR test to new CUnit format

Here's the patch that really adds the new test ... plz let me know if I did this incorrectly.
---------------------------------------------------------------
parent 93fd84ab52bc56f889dbd7970345d205ce03f958 (1.7.0-238-g93fd84a)
commit c5aa45226d054389280b763ce5754c5fa647b05c
Author: Lee Duncan <lduncan@suse.de>
Date:   Wed Feb 6 13:43:08 2013 -0800

Converted first PGR test to new CUnit format
This commit is contained in:
Lee Duncan
2013-02-07 11:15:32 -08:00
committed by Ronnie Sahlberg
parent 49d1f87d17
commit 3f4bb80fd4
6 changed files with 122 additions and 2 deletions

View File

@@ -183,6 +183,57 @@ iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
return real_iscsi_queue_pdu(iscsi, pdu);
}
int
prin_read_keys(struct iscsi_context *iscsi, int lun, struct scsi_task **tp,
struct scsi_persistent_reserve_in_read_keys **rkp)
{
const int buf_sz = 16384;
struct scsi_persistent_reserve_in_read_keys *rk = NULL;
struct scsi_task *task;
logging(LOG_VERBOSE, "Send PRIN/READ_KEYS");
task = iscsi_persistent_reserve_in_sync(iscsi, lun,
SCSI_PERSISTENT_RESERVE_READ_KEYS, buf_sz);
if (task == NULL) {
logging(LOG_NORMAL,
"[FAILED] Failed to send PRIN command: %s",
iscsi_get_error(iscsi));
return -1;
}
if (tp != NULL)
*tp = task;
if (task->status != SCSI_STATUS_GOOD) {
logging(LOG_NORMAL,
"[FAILED] PRIN command: failed with sense. %s",
iscsi_get_error(iscsi));
if (tp == NULL)
scsi_free_scsi_task(task);
return -1;
}
rk = scsi_datain_unmarshall(task);
if (rk == NULL) {
logging(LOG_NORMAL,
"[FAIL] failed to unmarshall PRIN/READ_KEYS data. %s",
iscsi_get_error(iscsi));
if (tp == NULL)
scsi_free_scsi_task(task);
return -1;
}
if (rkp != NULL)
*rkp = rk;
/* clean up if we are managing our own task */
if (tp == NULL)
scsi_free_scsi_task(task);
return 0;
}
int
register_and_ignore(struct iscsi_context *iscsi, int lun,
unsigned long long sark)