Merge pull request #237 from bvanassche/master

Three libiscsi fixes
This commit is contained in:
Ronnie Sahlberg
2017-02-05 07:41:12 -08:00
committed by GitHub
8 changed files with 27 additions and 20 deletions

View File

@@ -418,7 +418,7 @@ do { \
} while (0);
#define RECEIVE_COPY_RESULTS(...) \
do { \
({ \
int _r; \
_r = receive_copy_results(__VA_ARGS__); \
if (_r == -2) { \
@@ -429,7 +429,8 @@ do { \
return; \
} \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
_r; \
})
#define RELEASE6(...) \
do { \

View File

@@ -60,27 +60,29 @@ test_async_read(void)
{
int i, ret;
struct tests_async_read_state state = { 0, 0, 0 };
int blocksize = 512;
int blocks_per_io = 8;
int num_ios = 1000;
const int blocksize = 512;
const int blocks_per_io = 8;
const int num_ios = 1000;
/* IOs in flight concurrently, so need a buffer large enough for all */
unsigned char buf[blocksize * blocks_per_io * num_ios];
unsigned char *buf = calloc(blocksize * blocks_per_io, num_ios);
CU_ASSERT_NOT_EQUAL(buf, NULL);
if (!buf)
goto out;
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
if (sd->iscsi_ctx == NULL) {
CU_PASS("[SKIPPED] Non-iSCSI");
return;
goto out;
}
if (maximum_transfer_length
&& (maximum_transfer_length < (blocks_per_io * num_ios))) {
CU_PASS("[SKIPPED] device too small for async_read test");
return;
goto out;
}
memset(buf, 0, blocksize * blocks_per_io * num_ios);
for (i = 0; i < num_ios; i++) {
uint32_t lba = i * blocks_per_io;
struct scsi_task *atask;
@@ -116,4 +118,7 @@ test_async_read(void)
ret = iscsi_service(sd->iscsi_ctx, pfd.revents);
CU_ASSERT_EQUAL(ret, 0);
}
out:
free(buf);
}

View File

@@ -32,14 +32,16 @@ test_receive_copy_results_op_params(void)
{
struct scsi_task *op_task = NULL;
struct scsi_copy_results_op_params *opp;
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test RECEIVE COPY RESULTS, OPERATING PARAMS");
RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
(void **)&opp, EXPECT_STATUS_GOOD);
ret = RECEIVE_COPY_RESULTS(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
(void **)&opp, EXPECT_STATUS_GOOD);
logging(LOG_NORMAL,
if (ret == 0)
logging(LOG_NORMAL,
"max_target_desc=%d, max_seg_desc=%d",
opp->max_target_desc_count,
opp->max_segment_desc_count);

View File

@@ -59,7 +59,7 @@ test_reserve6_itnexus_loss(void)
logging(LOG_VERBOSE, "Disconnect from the target.");
iscsi_destroy_context(sd->iscsi_ctx);
logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset");
logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset");
sleep(3);
logging(LOG_VERBOSE, "Reconnect to target");

View File

@@ -53,7 +53,7 @@ test_reserve6_lun_reset(void)
}
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset");
logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset");
sleep(3);

View File

@@ -56,7 +56,7 @@ test_reserve6_target_cold_reset(void)
return;
}
logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset");
logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset");
sleep(3);
logging(LOG_VERBOSE, "Create a second connection to the target");

View File

@@ -56,10 +56,9 @@ test_reserve6_target_warm_reset(void)
return;
}
logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset");
logging(LOG_VERBOSE, "Sleep for three seconds in case the target is slow to reset");
sleep(3);
logging(LOG_VERBOSE, "Create a second connection to the target");
ret = mpath_sd2_get_or_clone(sd, &sd2);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -89,7 +89,7 @@ test_sanitize_reset(void)
}
logging(LOG_VERBOSE, "Sleep for three seconds incase the target is "
logging(LOG_VERBOSE, "Sleep for three seconds in case the target is "
"slow to start the SANITIZE");
sleep(3);
@@ -151,7 +151,7 @@ test_sanitize_reset(void)
logging(LOG_VERBOSE, "Disconnect from the target.");
iscsi_destroy_context(sd->iscsi_ctx);
logging(LOG_VERBOSE, "Sleep for one seconds incase the target is "
logging(LOG_VERBOSE, "Sleep for one seconds in case the target is "
"slow to reset");
sleep(1);