TESTS: move the default url, lun and iscsi context into a structure
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -58,11 +58,11 @@ test_write12_residuals(void)
|
||||
* we don't want autoreconnect since some targets will drop the session
|
||||
* on this condition.
|
||||
*/
|
||||
iscsi_set_noautoreconnect(iscsic, 1);
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
|
||||
|
||||
logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0");
|
||||
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */
|
||||
|
||||
@@ -76,7 +76,7 @@ test_write12_residuals(void)
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
}
|
||||
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
|
||||
|
||||
@@ -99,7 +99,7 @@ test_write12_residuals(void)
|
||||
task = NULL;
|
||||
|
||||
/* in case the previous test failed the session */
|
||||
iscsi_set_noautoreconnect(iscsic, 0);
|
||||
iscsi_set_noautoreconnect(sd->iscsi_ctx, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000");
|
||||
@@ -115,13 +115,13 @@ test_write12_residuals(void)
|
||||
|
||||
data.size = task->expxferlen;
|
||||
data.data = &buf[0];
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
}
|
||||
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
|
||||
|
||||
@@ -157,7 +157,7 @@ test_write12_residuals(void)
|
||||
|
||||
data.size = task->expxferlen;
|
||||
data.data = &buf[0];
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
@@ -168,7 +168,7 @@ test_write12_residuals(void)
|
||||
SCSI_SENSE_ASCQ_INVALID_FIELD_IN_INFORMATION_UNIT))
|
||||
{
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
CU_ASSERT(0);
|
||||
}
|
||||
|
||||
@@ -207,13 +207,13 @@ test_write12_residuals(void)
|
||||
|
||||
data.size = task->expxferlen;
|
||||
data.data = &buf[0];
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
}
|
||||
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
|
||||
|
||||
@@ -241,7 +241,7 @@ test_write12_residuals(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||
memset(buf, 'a', 10000);
|
||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||
ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
@@ -261,13 +261,13 @@ test_write12_residuals(void)
|
||||
|
||||
data.size = task->expxferlen;
|
||||
data.data = &buf[0];
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
}
|
||||
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
|
||||
|
||||
@@ -289,7 +289,7 @@ test_write12_residuals(void)
|
||||
task = NULL;
|
||||
|
||||
logging(LOG_VERBOSE, "Read the two blocks");
|
||||
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
|
||||
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
@@ -317,7 +317,7 @@ test_write12_residuals(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||
memset(buf, 'a', 10000);
|
||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||
ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
@@ -337,13 +337,13 @@ test_write12_residuals(void)
|
||||
|
||||
data.size = task->expxferlen;
|
||||
data.data = &buf[0];
|
||||
task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data);
|
||||
task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data);
|
||||
CU_ASSERT_PTR_NOT_NULL(task_ret);
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that the target returned SUCCESS");
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
logging(LOG_VERBOSE, "[FAILED] Target returned error %s",
|
||||
iscsi_get_error(iscsic));
|
||||
iscsi_get_error(sd->iscsi_ctx));
|
||||
}
|
||||
CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);
|
||||
|
||||
@@ -365,7 +365,7 @@ test_write12_residuals(void)
|
||||
task = NULL;
|
||||
|
||||
logging(LOG_VERBOSE, "Read the two blocks");
|
||||
ret = read12(iscsic, tgt_lun, 0, 2* block_size,
|
||||
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf,
|
||||
EXPECT_STATUS_GOOD);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
Reference in New Issue
Block a user