- test_unmap_simple: was assuming that zero buffer was already cleared, which is not guaranteed and resulted in spurious failures

- writesame10_unmap_until_end, writesame16_unmap, writesame16_unmap_until_end were doing an CU_ASSERT *PER-BYTE* in the verification phase,
which was very CPU-intensive. This change uses memcmp on a whole block which finishes much quicker.
This commit is contained in:
jpocas
2014-04-30 16:22:27 -04:00
parent 14b5faf11e
commit b0c57802bc
4 changed files with 33 additions and 30 deletions

View File

@@ -28,14 +28,18 @@
void
test_writesame10_unmap_until_end(void)
{
int i, ret;
unsigned int j;
int ret;
unsigned int i, j;
unsigned char *zeroBlock;
CHECK_FOR_DATALOSS;
CHECK_FOR_THIN_PROVISIONING;
CHECK_FOR_LBPWS10;
CHECK_FOR_SBC;
zeroBlock = malloc(block_size);
memset(zeroBlock, 0, block_size);
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 of 1-256 blocks at the end of the LUN by setting number-of-blocks==0");
for (i = 1; i <= 256; i++) {
@@ -63,10 +67,8 @@ test_writesame10_unmap_until_end(void)
ret = read10(iscsic, tgt_lun, num_blocks - i,
i * block_size, block_size,
0, 0, 0, 0, 0, buf);
for (j = 0; j < block_size * i; j++) {
if (buf[j] != 0) {
CU_ASSERT_EQUAL(buf[j], 0);
}
for (j = 0; j < i; j++) {
CU_ASSERT_EQUAL(memcmp(buf + j*block_size, zeroBlock, block_size), 0);
}
} else {
logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read "
@@ -74,4 +76,5 @@ test_writesame10_unmap_until_end(void)
}
free(buf);
}
free(zeroBlock);
}