Merge pull request #249 from bvanassche/master

Five bug fixes for the iSCSI conformance test tool
This commit is contained in:
Ronnie Sahlberg
2017-06-14 07:47:06 -07:00
committed by GitHub
6 changed files with 50 additions and 21 deletions

View File

@@ -320,7 +320,7 @@ do { \
} while (0);
#define READ10(...) \
do { \
({ \
int _r; \
_r = read10(__VA_ARGS__); \
if (_r == -2) { \
@@ -331,7 +331,8 @@ do { \
return; \
} \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
_r; \
})
#define READ12(...) \
do { \
@@ -602,7 +603,7 @@ do { \
} while (0);
#define WRITE10(...) \
do { \
({ \
int _r; \
_r = write10(__VA_ARGS__); \
if (_r == -2) { \
@@ -613,7 +614,8 @@ do { \
return; \
} \
CU_ASSERT_EQUAL(_r, 0); \
} while (0);
_r; \
})
#define WRITE12(...) \
do { \

View File

@@ -203,4 +203,9 @@ test_async_abort_simple(void)
}
scsi_free_scsi_task(state.wtask);
/* Avoid that callbacks get invoked after this test finished */
iscsi_logout_sync(sd->iscsi_ctx);
iscsi_destroy_context(sd->iscsi_ctx);
sd->iscsi_ctx = NULL;
}

View File

@@ -192,4 +192,9 @@ test_async_lu_reset_simple(void)
}
scsi_free_scsi_task(state.wtask);
/* Avoid that callbacks get invoked after this test finished */
iscsi_logout_sync(sd->iscsi_ctx);
iscsi_destroy_context(sd->iscsi_ctx);
sd->iscsi_ctx = NULL;
}

View File

@@ -33,18 +33,27 @@ test_extendedcopy_simple(void)
int tgt_desc_len = 0, seg_desc_len = 0, offset = XCOPY_DESC_OFFSET;
struct iscsi_data data;
unsigned char *xcopybuf;
unsigned char *buf1 = malloc(2048*block_size);
unsigned char *buf2 = malloc(2048*block_size);
unsigned int copied_blocks;
unsigned char *buf1;
unsigned char *buf2;
copied_blocks = num_blocks / 2;
if (copied_blocks > 2048)
copied_blocks = 2048;
buf1 = malloc(copied_blocks * block_size);
buf2 = malloc(copied_blocks * block_size);
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE,
"Test EXTENDED COPY of 2048 blocks from start of LUN to end of LUN");
"Test EXTENDED COPY of %u blocks from start of LUN to end of LUN",
copied_blocks);
CHECK_FOR_DATALOSS;
logging(LOG_VERBOSE, "Write 2048 blocks of 'A' at LBA:0");
memset(buf1, 'A', 2048*block_size);
WRITE16(sd, 0, 2048*block_size, block_size, 0, 0, 0, 0, 0,
logging(LOG_VERBOSE, "Write %u blocks of 'A' at LBA:0", copied_blocks);
memset(buf1, 'A', copied_blocks * block_size);
WRITE16(sd, 0, copied_blocks * block_size, block_size, 0, 0, 0, 0, 0,
buf1, EXPECT_STATUS_GOOD);
data.size = XCOPY_DESC_OFFSET +
@@ -61,7 +70,7 @@ test_extendedcopy_simple(void)
/* Iniitialize segment descriptor list with one segment descriptor */
offset += populate_seg_desc_b2b(xcopybuf+offset, 0, 0, 0, 0,
2048, 0, num_blocks - 2048);
copied_blocks, 0, num_blocks - copied_blocks);
seg_desc_len = offset - XCOPY_DESC_OFFSET - tgt_desc_len;
/* Initialize the parameter list header */
@@ -70,12 +79,13 @@ test_extendedcopy_simple(void)
EXTENDEDCOPY(sd, &data, EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read 2048 blocks from end of the LUN");
READ16(sd, NULL, num_blocks - 2048, 2048*block_size,
logging(LOG_VERBOSE, "Read %u blocks from end of the LUN",
copied_blocks);
READ16(sd, NULL, num_blocks - copied_blocks, copied_blocks * block_size,
block_size, 0, 0, 0, 0, 0, buf2,
EXPECT_STATUS_GOOD);
if (memcmp(buf1, buf2, 2048)) {
if (memcmp(buf1, buf2, copied_blocks * block_size)) {
CU_FAIL("Blocks were not copied correctly");
}

View File

@@ -34,6 +34,7 @@ test_multipathio_simple(void)
int write_path;
unsigned char *write_buf = alloca(256 * block_size);
unsigned char *read_buf = alloca(256 * block_size);
int ret;
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
@@ -58,16 +59,19 @@ test_multipathio_simple(void)
&& maximum_transfer_length < i) {
break;
}
WRITE10(mp_sds[write_path], 0, i * block_size,
ret = WRITE10(mp_sds[write_path], 0, i * block_size,
block_size, 0, 0, 0, 0, 0, write_buf,
EXPECT_STATUS_GOOD);
READ10(mp_sds[read_path], NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, read_buf,
EXPECT_STATUS_GOOD);
if (ret < 0)
continue;
ret = READ10(mp_sds[read_path], NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, read_buf,
EXPECT_STATUS_GOOD);
if (ret < 0)
continue;
/* compare written and read data */
CU_ASSERT_EQUAL(0,
memcmp(write_buf, read_buf, i * block_size));
ret = memcmp(write_buf, read_buf, i * block_size);
CU_ASSERT_EQUAL(0, ret);
}
}

View File

@@ -70,6 +70,8 @@ test_report_supported_opcodes_rctd(void)
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task);
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
if (!rsoc)
goto free_task;
logging(LOG_VERBOSE, "Verify that all returned command descriptors "
"have a timeout description");
@@ -94,5 +96,6 @@ test_report_supported_opcodes_rctd(void)
}
}
free_task:
scsi_free_scsi_task(rso_task);
}