diff --git a/test-tool/test_unmap_simple.c b/test-tool/test_unmap_simple.c index c96d0f0..6f9b139 100644 --- a/test-tool/test_unmap_simple.c +++ b/test-tool/test_unmap_simple.c @@ -1,4 +1,3 @@ - /* Copyright (C) 2013 Ronnie Sahlberg diff --git a/test-tool/test_writesame10_unmap.c b/test-tool/test_writesame10_unmap.c index 7d99cd1..c173222 100644 --- a/test-tool/test_writesame10_unmap.c +++ b/test-tool/test_writesame10_unmap.c @@ -54,14 +54,23 @@ test_writesame10_unmap(void) 0, 1, 0, 0, NULL); CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - ret = read10(iscsic, tgt_lun, 0, - 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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + ret = read10(iscsic, tgt_lun, 0, + 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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } free(buf); } @@ -84,14 +93,23 @@ test_writesame10_unmap(void) 0, 1, 0, 0, buf); CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - 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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + 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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } free(buf); } diff --git a/test-tool/test_writesame10_unmap_unaligned.c b/test-tool/test_writesame10_unmap_unaligned.c index d59b8b9..cd370d9 100644 --- a/test-tool/test_writesame10_unmap_unaligned.c +++ b/test-tool/test_writesame10_unmap_unaligned.c @@ -1,4 +1,3 @@ - /* Copyright (C) 2013 Ronnie Sahlberg diff --git a/test-tool/test_writesame10_unmap_until_end.c b/test-tool/test_writesame10_unmap_until_end.c index 3d3051f..60e3b57 100644 --- a/test-tool/test_writesame10_unmap_until_end.c +++ b/test-tool/test_writesame10_unmap_until_end.c @@ -54,14 +54,23 @@ test_writesame10_unmap_until_end(void) 0, 1, 0, 0, NULL); CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - 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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + 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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } free(buf); } diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 1cf86b7..f232ac7 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -59,14 +59,22 @@ test_writesame16_unmap(void) } CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - ret = read16(iscsic, tgt_lun, 0, - 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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + ret = read16(iscsic, tgt_lun, 0, + 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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } } @@ -86,14 +94,22 @@ test_writesame16_unmap(void) 0, 1, 0, 0, buf); CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - ret = read16(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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + ret = read16(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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } } diff --git a/test-tool/test_writesame16_unmap_until_end.c b/test-tool/test_writesame16_unmap_until_end.c index e2f1176..ed66df9 100644 --- a/test-tool/test_writesame16_unmap_until_end.c +++ b/test-tool/test_writesame16_unmap_until_end.c @@ -58,14 +58,23 @@ test_writesame16_unmap_until_end(void) } CU_ASSERT_EQUAL(ret, 0); - logging(LOG_VERBOSE, "Read %d blocks and verify they are now zero", i); - ret = read16(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); + if (rc16->lbprz) { + logging(LOG_VERBOSE, "LBPRZ is set. Read the unmapped " + "blocks back and verify they are all zero"); + + logging(LOG_VERBOSE, "Read %d blocks and verify they " + "are now zero", i); + ret = read16(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); + } } + } else { + logging(LOG_VERBOSE, "LBPRZ is clear. Skip the read " + "and verify zero test"); } } }