TESTS: Read standard inq page before we spawn the tests

We dont need to call inq so often from the tests if we read the standard page once before the tests begin
This commit is contained in:
Ronnie Sahlberg
2012-12-27 11:47:34 -08:00
parent 3a4605d3e5
commit 91155c42e4
22 changed files with 106 additions and 525 deletions

View File

@@ -24,7 +24,6 @@ int T0232_write12_flags(const char *initiator, const char *url)
{
struct iscsi_context *iscsi;
struct scsi_task *task;
struct scsi_inquiry_standard *inq;
int ret = 0, lun;
unsigned char data[4096];
@@ -47,20 +46,8 @@ int T0232_write12_flags(const char *initiator, const char *url)
}
/* This test is only valid for SBC devices */
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
return -1;
}
inq = scsi_datain_unmarshall(task);
if (inq == NULL) {
printf("failed to unmarshall inquiry datain blob\n");
scsi_free_scsi_task(task);
return -1;
}
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
printf("LUN is not SBC device. Skipping test\n");
scsi_free_scsi_task(task);
return -2;
}