From c48283fe75efaf752f0de59423e1a444ad0c5b62 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 21 Feb 2016 11:07:54 -0800 Subject: [PATCH] Tests: add helpers for read* Signed-off-by: Ronnie Sahlberg --- test-tool/iscsi-support.h | 42 ++++++++++++++ test-tool/test_compareandwrite_miscompare.c | 8 +-- test-tool/test_compareandwrite_simple.c | 16 +++-- test-tool/test_extendedcopy_simple.c | 2 +- test-tool/test_modesense6_control_d_sense.c | 8 +-- test-tool/test_modesense6_control_swp.c | 13 ++--- test-tool/test_multipathio_simple.c | 19 ++---- test-tool/test_orwrite_verify.c | 23 ++++---- test-tool/test_read10_0blocks.c | 29 +++------- test-tool/test_read10_beyond_eol.c | 32 +++++----- test-tool/test_read10_dpofua.c | 42 ++++++-------- test-tool/test_read10_rdprotect.c | 11 ++-- test-tool/test_read10_simple.c | 17 +++--- test-tool/test_read12_0blocks.c | 33 +++-------- test-tool/test_read12_beyond_eol.c | 38 +++++------- test-tool/test_read12_dpofua.c | 42 ++++++-------- test-tool/test_read12_rdprotect.c | 15 ++--- test-tool/test_read12_simple.c | 22 +++---- test-tool/test_read16_0blocks.c | 34 +++-------- test-tool/test_read16_beyond_eol.c | 61 ++++++-------------- test-tool/test_read16_dpofua.c | 37 ++++-------- test-tool/test_read16_rdprotect.c | 15 ++--- test-tool/test_read16_simple.c | 23 +++----- test-tool/test_sanitize_block_erase.c | 11 +--- test-tool/test_sanitize_crypto_erase.c | 11 +--- test-tool/test_sanitize_overwrite.c | 8 +-- test-tool/test_sanitize_reset.c | 7 +-- test-tool/test_unmap_simple.c | 14 ++--- test-tool/test_verify10_dpo.c | 6 +- test-tool/test_verify10_flags.c | 7 +-- test-tool/test_verify10_mismatch.c | 16 +++-- test-tool/test_verify10_mismatch_no_cmp.c | 16 +++-- test-tool/test_verify10_simple.c | 18 +++--- test-tool/test_verify10_vrprotect.c | 10 ++-- test-tool/test_verify12_dpo.c | 6 +- test-tool/test_verify12_flags.c | 9 +-- test-tool/test_verify12_mismatch.c | 15 +++-- test-tool/test_verify12_mismatch_no_cmp.c | 15 +++-- test-tool/test_verify12_simple.c | 18 +++--- test-tool/test_verify12_vrprotect.c | 11 ++-- test-tool/test_verify16_dpo.c | 6 +- test-tool/test_verify16_flags.c | 8 +-- test-tool/test_verify16_mismatch.c | 17 +++--- test-tool/test_verify16_mismatch_no_cmp.c | 17 +++--- test-tool/test_verify16_simple.c | 17 +++--- test-tool/test_verify16_vrprotect.c | 10 ++-- test-tool/test_write10_residuals.c | 14 ++--- test-tool/test_write12_residuals.c | 14 ++--- test-tool/test_write16_residuals.c | 14 ++--- test-tool/test_writesame10_unmap.c | 8 +-- test-tool/test_writesame10_unmap_until_end.c | 2 +- test-tool/test_writesame16_unmap.c | 11 ++-- test-tool/test_writesame16_unmap_until_end.c | 2 +- test-tool/test_writeverify10_dpo.c | 6 +- test-tool/test_writeverify10_residuals.c | 14 ++--- test-tool/test_writeverify12_dpo.c | 6 +- test-tool/test_writeverify12_residuals.c | 14 ++--- test-tool/test_writeverify16_dpo.c | 6 +- test-tool/test_writeverify16_residuals.c | 14 ++--- 59 files changed, 377 insertions(+), 603 deletions(-) diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index eecc840..80a156b 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -223,6 +223,48 @@ do { \ CU_ASSERT_EQUAL(_r, 0); \ } while (0); +#define READ10(...) \ + do { \ + int _r; \ + _r = read10(__VA_ARGS__); \ + if (_r == -2) { \ + logging(LOG_NORMAL, "[SKIPPED] READ10 " \ + "is not implemented."); \ + CU_PASS("[SKIPPED] Target does not support " \ + "READ10. Skipping test"); \ + return; \ + } \ + CU_ASSERT_EQUAL(_r, 0); \ + } while (0); + +#define READ12(...) \ + do { \ + int _r; \ + _r = read12(__VA_ARGS__); \ + if (_r == -2) { \ + logging(LOG_NORMAL, "[SKIPPED] READ12 " \ + "is not implemented."); \ + CU_PASS("[SKIPPED] Target does not support " \ + "READ12. Skipping test"); \ + return; \ + } \ + CU_ASSERT_EQUAL(_r, 0); \ + } while (0); + +#define READ16(...) \ + do { \ + int _r; \ + _r = read16(__VA_ARGS__); \ + if (_r == -2) { \ + logging(LOG_NORMAL, "[SKIPPED] READ16 " \ + "is not implemented."); \ + CU_PASS("[SKIPPED] Target does not support " \ + "READ16. Skipping test"); \ + return; \ + } \ + CU_ASSERT_EQUAL(_r, 0); \ + } while (0); + #define RECEIVE_COPY_RESULTS(...) \ do { \ int _r; \ diff --git a/test-tool/test_compareandwrite_miscompare.c b/test-tool/test_compareandwrite_miscompare.c index c56c305..deee4ca 100644 --- a/test-tool/test_compareandwrite_miscompare.c +++ b/test-tool/test_compareandwrite_miscompare.c @@ -83,7 +83,7 @@ test_compareandwrite_miscompare(void) logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify " "they are still unchanged as 'A'", i); - read16(sd, NULL, 0, i * block_size, + READ16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); @@ -139,9 +139,9 @@ test_compareandwrite_miscompare(void) logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64 "they are still unchanged as 'A'", i, num_blocks - i); - read16(sd, NULL, num_blocks - i, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ16(sd, NULL, num_blocks - i, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); for (j = 0; j < i * block_size; j++) { if (scratch[j] != 'A') { diff --git a/test-tool/test_compareandwrite_simple.c b/test-tool/test_compareandwrite_simple.c index dffa249..97ab9e0 100644 --- a/test-tool/test_compareandwrite_simple.c +++ b/test-tool/test_compareandwrite_simple.c @@ -31,7 +31,7 @@ void test_compareandwrite_simple(void) { - int i, ret; + int i; unsigned j; int maxbl; @@ -81,10 +81,9 @@ test_compareandwrite_simple(void) logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify " "they are all 'B'", i); - ret = read16(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); for (j = 0; j < i * block_size; j++) { if (scratch[j] != 'B') { @@ -135,10 +134,9 @@ test_compareandwrite_simple(void) logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64 " and verify they are all 'B'", i, num_blocks - i); - ret = read16(sd, NULL, num_blocks - i, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); for (j = 0; j < i * block_size; j++) { if (scratch[j] != 'B') { diff --git a/test-tool/test_extendedcopy_simple.c b/test-tool/test_extendedcopy_simple.c index 222216b..d341030 100644 --- a/test-tool/test_extendedcopy_simple.c +++ b/test-tool/test_extendedcopy_simple.c @@ -71,7 +71,7 @@ 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, + READ16(sd, NULL, num_blocks - 2048, 2048*block_size, block_size, 0, 0, 0, 0, 0, buf2, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_modesense6_control_d_sense.c b/test-tool/test_modesense6_control_d_sense.c index 8ce0b8b..cdcd7b4 100644 --- a/test-tool/test_modesense6_control_d_sense.c +++ b/test-tool/test_modesense6_control_d_sense.c @@ -71,11 +71,9 @@ test_modesense6_control_d_sense(void) } logging(LOG_VERBOSE, "Send a READ16 that will fail so we can check " "the type of sense data returned"); - ret = read16(sd, &r16_task, 0xffffffffffffffffLL, - block_size, block_size, 0, - 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, &r16_task, 0xffffffffffffffffLL, block_size, block_size, 0, + 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); if (page->control.d_sense) { logging(LOG_VERBOSE, "D_SENSE is set, verify that sense format " diff --git a/test-tool/test_modesense6_control_swp.c b/test-tool/test_modesense6_control_swp.c index b902083..abb4113 100644 --- a/test-tool/test_modesense6_control_swp.c +++ b/test-tool/test_modesense6_control_swp.c @@ -88,17 +88,12 @@ test_modesense6_control_swp(void) logging(LOG_VERBOSE, "Read a block from the now Read-Only device"); - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Try to write a block to the Read-Only device"); - ret = write10(sd, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_WRITE_PROTECTED); - CU_ASSERT_EQUAL(ret, 0); - + WRITE10(sd, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_WRITE_PROTECTED); finished: if (ms_task != NULL) { diff --git a/test-tool/test_multipathio_simple.c b/test-tool/test_multipathio_simple.c index 8f93fd5..ab3f797 100644 --- a/test-tool/test_multipathio_simple.c +++ b/test-tool/test_multipathio_simple.c @@ -43,7 +43,7 @@ test_multipathio_simple(void) memset(write_buf, 0xa6, 256 * block_size); for (write_path = 0; write_path < mp_num_sds; write_path++) { - int i, ret; + int i; int read_path; /* read back written data using a different path */ @@ -58,21 +58,12 @@ test_multipathio_simple(void) && maximum_transfer_length < i) { break; } - ret = write10(mp_sds[write_path], 0, i * block_size, + WRITE10(mp_sds[write_path], 0, i * block_size, block_size, 0, 0, 0, 0, 0, write_buf, EXPECT_STATUS_GOOD); - if (ret == -2) { - logging(LOG_NORMAL, - "[SKIPPED] WRITE16 not implemented."); - CU_PASS("WRITE16 is not implemented."); - return; - } - CU_ASSERT_EQUAL(ret, 0); - - ret = read10(mp_sds[read_path], NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, read_buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(mp_sds[read_path], NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, read_buf, + EXPECT_STATUS_GOOD); /* compare written and read data */ CU_ASSERT_EQUAL(0, diff --git a/test-tool/test_orwrite_verify.c b/test-tool/test_orwrite_verify.c index 434be38..5ca824f 100644 --- a/test-tool/test_orwrite_verify.c +++ b/test-tool/test_orwrite_verify.c @@ -60,10 +60,9 @@ test_orwrite_verify(void) EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read %d blocks back", i); - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, readbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, readbuf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5"); ret = memcmp(buf, readbuf, block_size * i); @@ -76,7 +75,7 @@ test_orwrite_verify(void) EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read %d blocks back", i); - read10(sd, NULL, 0, i * block_size, + READ10(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, readbuf, EXPECT_STATUS_GOOD); @@ -105,10 +104,9 @@ test_orwrite_verify(void) EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read %d blocks back", i); - ret = read16(sd, NULL, num_blocks - i, i * block_size, - block_size, 0, 0, 0, 0, 0, readbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, i * block_size, + block_size, 0, 0, 0, 0, 0, readbuf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5"); ret = memcmp(buf, readbuf, block_size * i); @@ -121,10 +119,9 @@ test_orwrite_verify(void) EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read %d blocks back", i); - ret = read16(sd, NULL, num_blocks - i, i * block_size, - block_size, 0, 0, 0, 0, 0, readbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, i * block_size, + block_size, 0, 0, 0, 0, 0, readbuf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the blocks are all 0xff"); memset(buf, 0xff, block_size * i); diff --git a/test-tool/test_read10_0blocks.c b/test-tool/test_read10_0blocks.c index a0ce815..02f3390 100644 --- a/test-tool/test_read10_0blocks.c +++ b/test-tool/test_read10_0blocks.c @@ -27,14 +27,11 @@ void test_read10_0blocks(void) { - int ret; - logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0"); - ret = read10(sd, NULL, 0, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + + READ10(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); if (num_blocks > 0x80000000) { CU_PASS("[SKIPPED] LUN is too big"); @@ -42,22 +39,14 @@ test_read10_0blocks(void) } logging(LOG_VERBOSE, "Test READ10 0-blocks one block past end-of-LUN"); - ret = read10(sd, NULL, num_blocks + 1, 0, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31"); - ret = read10(sd, NULL, 0x80000000, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1"); - ret = read10(sd, NULL, -1, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } diff --git a/test-tool/test_read10_beyond_eol.c b/test-tool/test_read10_beyond_eol.c index 224f063..9fc5542 100644 --- a/test-tool/test_read10_beyond_eol.c +++ b/test-tool/test_read10_beyond_eol.c @@ -28,7 +28,7 @@ void test_read10_beyond_eol(void) { - int i, ret; + int i; if (num_blocks >= 0x80000000) { CU_PASS("LUN is too big for read-beyond-eol tests with READ10. Skipping test.\n"); @@ -41,10 +41,9 @@ test_read10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks + 1 - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, num_blocks + 1 - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } logging(LOG_VERBOSE, "Test READ10 1-256 blocks at LBA==2^31"); @@ -52,33 +51,28 @@ test_read10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0x80000000, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0x80000000, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ10 1-256 blocks at LBA==-1"); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, -1, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, -1, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ10 2-256 blocks all but one block beyond the end"); for (i = 2; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks - 1, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, num_blocks - 1, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } } diff --git a/test-tool/test_read10_dpofua.c b/test-tool/test_read10_dpofua.c index 5bbb605..d4781d9 100644 --- a/test-tool/test_read10_dpofua.c +++ b/test-tool/test_read10_dpofua.c @@ -60,41 +60,35 @@ test_read10_dpofua(void) logging(LOG_VERBOSE, "Test READ10 with DPO==1"); if (dpofua) { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ10 with FUA==1"); if (dpofua) { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ10 with DPO==1 FUA==1"); if (dpofua) { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read10(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, + block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } diff --git a/test-tool/test_read10_rdprotect.c b/test-tool/test_read10_rdprotect.c index 9b88012..2e70fa8 100644 --- a/test-tool/test_read10_rdprotect.c +++ b/test-tool/test_read10_rdprotect.c @@ -29,8 +29,7 @@ void test_read10_rdprotect(void) { - int i, ret; - + int i; /* * Try out different non-zero values for RDPROTECT. @@ -43,11 +42,9 @@ test_read10_rdprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read10(sd, NULL, 0, - block_size, block_size, - i, 0, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, + i, 0, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } return; } diff --git a/test-tool/test_read10_simple.c b/test-tool/test_read10_simple.c index 20650e7..a5c4ef1 100644 --- a/test-tool/test_read10_simple.c +++ b/test-tool/test_read10_simple.c @@ -29,8 +29,7 @@ void test_read10_simple(void) { - int i, ret; - + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ10 of 1-256 blocks at the start of the LUN"); @@ -38,10 +37,9 @@ test_read10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } logging(LOG_VERBOSE, "Test READ10 of 1-256 blocks at the end of the LUN"); @@ -49,9 +47,8 @@ test_read10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } } diff --git a/test-tool/test_read12_0blocks.c b/test-tool/test_read12_0blocks.c index d9a02aa..e2e2983 100644 --- a/test-tool/test_read12_0blocks.c +++ b/test-tool/test_read12_0blocks.c @@ -27,19 +27,10 @@ void test_read12_0blocks(void) { - int ret; - logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0"); - ret = read12(sd, NULL, 0, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); - CU_PASS("READ12 is not implemented."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); if (num_blocks > 0x80000000) { CU_PASS("[SKIPPED] LUN is too big"); @@ -47,22 +38,14 @@ test_read12_0blocks(void) } logging(LOG_VERBOSE, "Test READ12 0-blocks one block past end-of-LUN"); - ret = read12(sd, NULL, num_blocks + 1, 0, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ12(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==2^31"); - ret = read12(sd, NULL, 0x80000000, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ12(sd, NULL, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==-1"); - ret = read12(sd, NULL, -1, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } diff --git a/test-tool/test_read12_beyond_eol.c b/test-tool/test_read12_beyond_eol.c index 367822a..5ac469c 100644 --- a/test-tool/test_read12_beyond_eol.c +++ b/test-tool/test_read12_beyond_eol.c @@ -28,7 +28,7 @@ void test_read12_beyond_eol(void) { - int i, ret; + int i; if (num_blocks >= 0x80000000) { CU_PASS("LUN is too big for read-beyond-eol tests with READ12. Skipping test.\n"); @@ -41,50 +41,38 @@ test_read12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks + 1 - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); - CU_PASS("READ12 is not implemented."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, num_blocks + 1 - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==2^31"); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, 0x80000000, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0x80000000, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==-1"); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, -1, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, -1, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ12 2-256 blocks all but one block beyond the end"); for (i = 2; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks - 1, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, num_blocks - 1, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } } diff --git a/test-tool/test_read12_dpofua.c b/test-tool/test_read12_dpofua.c index adde535..9150536 100644 --- a/test-tool/test_read12_dpofua.c +++ b/test-tool/test_read12_dpofua.c @@ -60,41 +60,35 @@ test_read12_dpofua(void) logging(LOG_VERBOSE, "Test READ12 with DPO==1"); if (dpofua) { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ12 with FUA==1"); if (dpofua) { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ12 with DPO==1 FUA==1"); if (dpofua) { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read12(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, + block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " diff --git a/test-tool/test_read12_rdprotect.c b/test-tool/test_read12_rdprotect.c index 8d608da..7650872 100644 --- a/test-tool/test_read12_rdprotect.c +++ b/test-tool/test_read12_rdprotect.c @@ -29,7 +29,7 @@ void test_read12_rdprotect(void) { - int i, ret; + int i; /* * Try out different non-zero values for RDPROTECT. @@ -42,16 +42,9 @@ test_read12_rdprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read12(sd, NULL, 0, - block_size, block_size, - i, 0, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); - CU_PASS("READ12 is not implemented."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, block_size, block_size, + i, 0, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } return; } diff --git a/test-tool/test_read12_simple.c b/test-tool/test_read12_simple.c index f055f7e..233f365 100644 --- a/test-tool/test_read12_simple.c +++ b/test-tool/test_read12_simple.c @@ -29,8 +29,7 @@ void test_read12_simple(void) { - int i, ret; - + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ12 of 1-256 blocks at the start of the LUN"); @@ -38,15 +37,9 @@ test_read12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); - CU_PASS("READ12 is not implemented."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } @@ -55,9 +48,8 @@ test_read12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } } diff --git a/test-tool/test_read16_0blocks.c b/test-tool/test_read16_0blocks.c index 4eacd8c..a58321f 100644 --- a/test-tool/test_read16_0blocks.c +++ b/test-tool/test_read16_0blocks.c @@ -27,39 +27,23 @@ void test_read16_0blocks(void) { - int ret; - CHECK_FOR_SBC; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0"); - ret = read16(sd, NULL, 0, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READ16 is not implemented and no SBC-3 support claimed."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN"); - ret = read16(sd, NULL, num_blocks + 1, 0, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==2^63"); - ret = read16(sd, NULL, 0x8000000000000000ULL, 0, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, 0x8000000000000000ULL, 0, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==-1"); - ret = read16(sd, NULL, -1, 0, block_size, - 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } diff --git a/test-tool/test_read16_beyond_eol.c b/test-tool/test_read16_beyond_eol.c index b647c45..16a2fd6 100644 --- a/test-tool/test_read16_beyond_eol.c +++ b/test-tool/test_read16_beyond_eol.c @@ -39,7 +39,7 @@ static int ilog2(size_t i) void test_read16_beyond_eol(void) { - int i, ret; + int i; CHECK_FOR_SBC; @@ -49,16 +49,9 @@ test_read16_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks + 1 - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READ16 is not implemented and no SBC-3 support claimed."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks + 1 - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^63"); @@ -66,66 +59,50 @@ test_read16_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, 0x8000000000000000ULL, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0x8000000000000000ULL, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d", 64 - ilog2(block_size)); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, - 1ULL << (64 - ilog2(block_size)), - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 1ULL << (64 - ilog2(block_size)), + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d", 63 - ilog2(block_size)); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, - 1ULL << (63 - ilog2(block_size)), - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 1ULL << (63 - ilog2(block_size)), + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==-1"); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, -1, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, -1, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } - logging(LOG_VERBOSE, "Test READ16 2-256 blocks all but one block beyond the end"); for (i = 2; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks - 1, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_LBA_OOB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - 1, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_LBA_OOB); } } diff --git a/test-tool/test_read16_dpofua.c b/test-tool/test_read16_dpofua.c index 25353bb..f9f5b54 100644 --- a/test-tool/test_read16_dpofua.c +++ b/test-tool/test_read16_dpofua.c @@ -60,44 +60,31 @@ test_read16_dpofua(void) logging(LOG_VERBOSE, "Test READ16 with DPO==1"); if (dpofua) { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 1, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 1, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ16 with FUA==1"); if (dpofua) { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 0, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 0, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1"); if (dpofua) { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_STATUS_GOOD); } else { - ret = read16(sd, NULL, 0, - block_size, block_size, 0, 1, 1, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 1, 1, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } - logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " "for READ16"); REPORT_SUPPORTED_OPCODES(sd, &rso_task, diff --git a/test-tool/test_read16_rdprotect.c b/test-tool/test_read16_rdprotect.c index 47d84b6..f6f06e9 100644 --- a/test-tool/test_read16_rdprotect.c +++ b/test-tool/test_read16_rdprotect.c @@ -29,7 +29,7 @@ void test_read16_rdprotect(void) { - int i, ret; + int i; /* * Try out different non-zero values for RDPROTECT. @@ -42,16 +42,9 @@ test_read16_rdprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read16(sd, NULL, 0, - block_size, block_size, - i, 0, 0, 0, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ16 is not im lemented on this target and it does not claim SBC-3 support."); - CU_PASS("READ16 is not implemented and no SBC-3 support claimed."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, + i, 0, 0, 0, 0, NULL, + EXPECT_INVALID_FIELD_IN_CDB); } return; } diff --git a/test-tool/test_read16_simple.c b/test-tool/test_read16_simple.c index 0cb39fd..7a57aaa 100644 --- a/test-tool/test_read16_simple.c +++ b/test-tool/test_read16_simple.c @@ -29,7 +29,7 @@ void test_read16_simple(void) { - int i, ret; + int i; CHECK_FOR_SBC; @@ -39,16 +39,9 @@ test_read16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READ16 is not implemented and no SBC-3 support claimed."); - return; - } - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } @@ -57,10 +50,8 @@ test_read16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_STATUS_GOOD); } } diff --git a/test-tool/test_sanitize_block_erase.c b/test-tool/test_sanitize_block_erase.c index b5cd743..2f43dcd 100644 --- a/test-tool/test_sanitize_block_erase.c +++ b/test-tool/test_sanitize_block_erase.c @@ -34,8 +34,7 @@ check_wabereq(void) struct scsi_task *task_ret = NULL; logging(LOG_VERBOSE, "Read one block from LBA 0"); - read10(sd, &task_ret, 0, block_size, block_size, - 0, 0, 0, 0, 0, NULL, + READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret); CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED); @@ -195,14 +194,10 @@ check_unmap(void) static void check_lun_is_wiped(unsigned char *buf, uint64_t lba) { - int ret; unsigned char *rbuf = alloca(256 * block_size); - ret = read16(sd, NULL, lba, 256 * block_size, - block_size, 0, 0, 0, 0, 0, rbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, lba, 256 * block_size, block_size, 0, 0, 0, 0, 0, rbuf, + EXPECT_STATUS_GOOD); if (rc16 == NULL) { return; } diff --git a/test-tool/test_sanitize_crypto_erase.c b/test-tool/test_sanitize_crypto_erase.c index cf95ed0..de0de98 100644 --- a/test-tool/test_sanitize_crypto_erase.c +++ b/test-tool/test_sanitize_crypto_erase.c @@ -34,8 +34,7 @@ check_wacereq(void) struct scsi_task *task_ret = NULL; logging(LOG_VERBOSE, "Read one block from LBA 0"); - read10(sd, &task_ret, 0, block_size, block_size, - 0, 0, 0, 0, 0, NULL, + READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret); CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED); @@ -104,14 +103,10 @@ check_wacereq(void) static void check_lun_is_wiped(unsigned char *buf, uint64_t lba) { - int ret; unsigned char *rbuf = alloca(256 * block_size); - ret = read16(sd, NULL, lba, 256 * block_size, - block_size, 0, 0, 0, 0, 0, rbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, lba, 256 * block_size, block_size, 0, 0, 0, 0, 0, rbuf, + EXPECT_STATUS_GOOD); if (!memcmp(buf, rbuf, 256 * block_size)) { logging(LOG_NORMAL, "[FAILED] Blocks were not wiped"); CU_FAIL("[FAILED] Blocks were not wiped"); diff --git a/test-tool/test_sanitize_overwrite.c b/test-tool/test_sanitize_overwrite.c index 138a888..aa9cf52 100644 --- a/test-tool/test_sanitize_overwrite.c +++ b/test-tool/test_sanitize_overwrite.c @@ -30,14 +30,12 @@ static void check_lun_is_wiped(uint64_t lba, unsigned char c) { - int ret; unsigned char *rbuf = alloca(256 * block_size); unsigned char *zbuf = alloca(256 * block_size); - ret = read16(sd, NULL, lba, 256 * block_size, - block_size, 0, 0, 0, 0, 0, rbuf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, lba, 256 * block_size, + block_size, 0, 0, 0, 0, 0, rbuf, + EXPECT_STATUS_GOOD); memset(zbuf, c, 256 * block_size); diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index e288fd8..c3fd238 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -107,10 +107,9 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Verify that READ16 fails with " "SANITIZE_IN_PROGRESS"); - ret = read16(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, NULL, - EXPECT_SANITIZE); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, + block_size, 0, 0, 0, 0, 0, NULL, + EXPECT_SANITIZE); logging(LOG_VERBOSE, "Verify that INQUIRY is still allowed while " "SANITIZE is in progress"); diff --git a/test-tool/test_unmap_simple.c b/test-tool/test_unmap_simple.c index 49c3c75..6f0d85b 100644 --- a/test-tool/test_unmap_simple.c +++ b/test-tool/test_unmap_simple.c @@ -58,10 +58,9 @@ test_unmap_simple(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Read blocks 0-%d", i); - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); if (rc16 && rc16->lbprz) { logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks " @@ -96,10 +95,9 @@ test_unmap_simple(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Read blocks 0-%d", i); - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); if (rc16 && rc16->lbprz) { logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks " diff --git a/test-tool/test_verify10_dpo.c b/test-tool/test_verify10_dpo.c index 730de83..d1f874a 100644 --- a/test-tool/test_verify10_dpo.c +++ b/test-tool/test_verify10_dpo.c @@ -40,10 +40,8 @@ test_verify10_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_verify10_flags.c b/test-tool/test_verify10_flags.c index b1865d5..dd17521 100644 --- a/test-tool/test_verify10_flags.c +++ b/test-tool/test_verify10_flags.c @@ -29,17 +29,12 @@ void test_verify10_flags(void) { - int ret; - logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 flags"); - ret = read10(sd, NULL, 0, block_size, + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - - logging(LOG_VERBOSE, "Test VERIFY10 with BYTCHK==1"); VERIFY10(sd, 0, block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_verify10_mismatch.c b/test-tool/test_verify10_mismatch.c index a6be763..ccecc20 100644 --- a/test-tool/test_verify10_mismatch.c +++ b/test-tool/test_verify10_mismatch.c @@ -30,7 +30,7 @@ void test_verify10_mismatch(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 for blocks 1-255"); @@ -40,10 +40,9 @@ test_verify10_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -60,10 +59,9 @@ test_verify10_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify10_mismatch_no_cmp.c b/test-tool/test_verify10_mismatch_no_cmp.c index d9517f8..5f2a77f 100644 --- a/test-tool/test_verify10_mismatch_no_cmp.c +++ b/test-tool/test_verify10_mismatch_no_cmp.c @@ -30,7 +30,7 @@ void test_verify10_mismatch_no_cmp(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 without BYTCHK for blocks 1-255"); @@ -40,10 +40,9 @@ test_verify10_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -60,10 +59,9 @@ test_verify10_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify10_simple.c b/test-tool/test_verify10_simple.c index a3d22ee..5b1a4dc 100644 --- a/test-tool/test_verify10_simple.c +++ b/test-tool/test_verify10_simple.c @@ -30,7 +30,7 @@ void test_verify10_simple(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 of 1-256 blocks at the start of the LUN"); @@ -38,11 +38,9 @@ test_verify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY10(sd, 0, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); } @@ -52,11 +50,9 @@ test_verify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY10(sd, num_blocks - i, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_verify10_vrprotect.c b/test-tool/test_verify10_vrprotect.c index 086a4ae..f5294b0 100644 --- a/test-tool/test_verify10_vrprotect.c +++ b/test-tool/test_verify10_vrprotect.c @@ -30,7 +30,7 @@ void test_verify10_vrprotect(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 with non-zero VRPROTECT"); @@ -40,11 +40,9 @@ test_verify10_vrprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, 0, block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY10(sd, 0, block_size, block_size, i, 0, 1, scratch, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_verify12_dpo.c b/test-tool/test_verify12_dpo.c index 55e2666..381e3be 100644 --- a/test-tool/test_verify12_dpo.c +++ b/test-tool/test_verify12_dpo.c @@ -40,10 +40,8 @@ test_verify12_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_verify12_flags.c b/test-tool/test_verify12_flags.c index d19f193..170bb89 100644 --- a/test-tool/test_verify12_flags.c +++ b/test-tool/test_verify12_flags.c @@ -30,16 +30,11 @@ void test_verify12_flags(void) { - int ret; - logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 flags"); - ret = read12(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ12(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test VERIFY12 with BYTCHK==1"); VERIFY12(sd, 0, block_size, block_size, 0, 0, 1, scratch, diff --git a/test-tool/test_verify12_mismatch.c b/test-tool/test_verify12_mismatch.c index 6672249..2b92bf9 100644 --- a/test-tool/test_verify12_mismatch.c +++ b/test-tool/test_verify12_mismatch.c @@ -30,7 +30,7 @@ void test_verify12_mismatch(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 for blocks 1-255"); @@ -40,9 +40,9 @@ test_verify12_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ12(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -59,10 +59,9 @@ test_verify12_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify12_mismatch_no_cmp.c b/test-tool/test_verify12_mismatch_no_cmp.c index c4e6bf1..d0b9935 100644 --- a/test-tool/test_verify12_mismatch_no_cmp.c +++ b/test-tool/test_verify12_mismatch_no_cmp.c @@ -30,7 +30,7 @@ void test_verify12_mismatch_no_cmp(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 without BYTCHK for blocks 1-255"); @@ -40,9 +40,9 @@ test_verify12_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ12(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -59,10 +59,9 @@ test_verify12_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify12_simple.c b/test-tool/test_verify12_simple.c index 921d4a9..3aae55f 100644 --- a/test-tool/test_verify12_simple.c +++ b/test-tool/test_verify12_simple.c @@ -30,7 +30,7 @@ void test_verify12_simple(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 of 1-256 blocks at the start of the LUN"); @@ -38,11 +38,9 @@ test_verify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ12(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY12(sd, 0, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); } @@ -52,11 +50,9 @@ test_verify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ12(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY12(sd, num_blocks - i, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_verify12_vrprotect.c b/test-tool/test_verify12_vrprotect.c index 900d781..eedcbab 100644 --- a/test-tool/test_verify12_vrprotect.c +++ b/test-tool/test_verify12_vrprotect.c @@ -30,7 +30,7 @@ void test_verify12_vrprotect(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 with non-zero VRPROTECT"); @@ -40,12 +40,9 @@ test_verify12_vrprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ10(sd, NULL, 0, block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY12(sd, 0, block_size, block_size, i, 0, 1, scratch, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_verify16_dpo.c b/test-tool/test_verify16_dpo.c index 6fa5052..d3eecdc 100644 --- a/test-tool/test_verify16_dpo.c +++ b/test-tool/test_verify16_dpo.c @@ -40,10 +40,8 @@ test_verify16_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_verify16_flags.c b/test-tool/test_verify16_flags.c index 99ea1cf..851e2bb 100644 --- a/test-tool/test_verify16_flags.c +++ b/test-tool/test_verify16_flags.c @@ -30,15 +30,11 @@ void test_verify16_flags(void) { - int ret; - logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 flags"); - ret = read16(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test VERIFY16 with BYTCHK==1"); VERIFY16(sd, 0, block_size, block_size, 0, 0, 1, scratch, diff --git a/test-tool/test_verify16_mismatch.c b/test-tool/test_verify16_mismatch.c index 9177e1b..4f092ec 100644 --- a/test-tool/test_verify16_mismatch.c +++ b/test-tool/test_verify16_mismatch.c @@ -30,7 +30,7 @@ void test_verify16_mismatch(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 for blocks 1-255"); @@ -40,10 +40,9 @@ test_verify16_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ16(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -60,11 +59,9 @@ test_verify16_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify16_mismatch_no_cmp.c b/test-tool/test_verify16_mismatch_no_cmp.c index 50e7957..1ddcc76 100644 --- a/test-tool/test_verify16_mismatch_no_cmp.c +++ b/test-tool/test_verify16_mismatch_no_cmp.c @@ -30,7 +30,7 @@ void test_verify16_mismatch_no_cmp(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 without BYTCHK for blocks 1-255"); @@ -40,10 +40,9 @@ test_verify16_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ16(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; @@ -60,11 +59,9 @@ test_verify16_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); /* flip a random byte in the data */ scratch[offset] ^= 'X'; diff --git a/test-tool/test_verify16_simple.c b/test-tool/test_verify16_simple.c index 4e786df..ed1ce4c 100644 --- a/test-tool/test_verify16_simple.c +++ b/test-tool/test_verify16_simple.c @@ -30,7 +30,7 @@ void test_verify16_simple(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 of 1-256 blocks at the start of the LUN"); @@ -38,9 +38,9 @@ test_verify16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(sd, NULL, 0, i * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); + READ16(sd, NULL, 0, i * block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY16(sd, 0, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); @@ -51,12 +51,9 @@ test_verify16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - - ret = read16(sd, NULL, num_blocks - i, - i * block_size, block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, num_blocks - i, + i * block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY16(sd, num_blocks - i, i * block_size, block_size, 0, 0, 1, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_verify16_vrprotect.c b/test-tool/test_verify16_vrprotect.c index 73fad58..1739ec4 100644 --- a/test-tool/test_verify16_vrprotect.c +++ b/test-tool/test_verify16_vrprotect.c @@ -30,7 +30,7 @@ void test_verify16_vrprotect(void) { - int i, ret; + int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT"); @@ -40,11 +40,9 @@ test_verify16_vrprotect(void) if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read16(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); - + READ16(sd, NULL, 0, block_size, + block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); VERIFY16(sd, 0, block_size, block_size, i, 0, 1, scratch, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_write10_residuals.c b/test-tool/test_write10_residuals.c index c2afbbc..fd6371a 100644 --- a/test-tool/test_write10_residuals.c +++ b/test-tool/test_write10_residuals.c @@ -34,7 +34,7 @@ test_write10_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -297,10 +297,8 @@ test_write10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -371,10 +369,8 @@ test_write10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { diff --git a/test-tool/test_write12_residuals.c b/test-tool/test_write12_residuals.c index 16beffe..f052402 100644 --- a/test-tool/test_write12_residuals.c +++ b/test-tool/test_write12_residuals.c @@ -34,7 +34,7 @@ test_write12_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -296,10 +296,8 @@ test_write12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -370,10 +368,8 @@ test_write12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { diff --git a/test-tool/test_write16_residuals.c b/test-tool/test_write16_residuals.c index cd2f2f5..ee02864 100644 --- a/test-tool/test_write16_residuals.c +++ b/test-tool/test_write16_residuals.c @@ -34,7 +34,7 @@ test_write16_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -296,10 +296,8 @@ test_write16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -370,10 +368,8 @@ test_write16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { diff --git a/test-tool/test_writesame10_unmap.c b/test-tool/test_writesame10_unmap.c index e98b9d8..5234b6e 100644 --- a/test-tool/test_writesame10_unmap.c +++ b/test-tool/test_writesame10_unmap.c @@ -59,8 +59,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read10(sd, NULL, 0, - i * block_size, block_size, + READ10(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); CU_ASSERT(all_zeroes(scratch, i * block_size)); @@ -92,7 +91,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read10(sd, NULL, num_blocks - i, + READ10(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); @@ -153,8 +152,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read10(sd, NULL, 0, - i * block_size, block_size, + READ10(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); CU_ASSERT(all_zeroes(scratch, i * block_size)); diff --git a/test-tool/test_writesame10_unmap_until_end.c b/test-tool/test_writesame10_unmap_until_end.c index 51f3637..dc21646 100644 --- a/test-tool/test_writesame10_unmap_until_end.c +++ b/test-tool/test_writesame10_unmap_until_end.c @@ -62,7 +62,7 @@ test_writesame10_unmap_until_end(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read10(sd, NULL, num_blocks - i, + READ10(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index e510ea3..dd5082e 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -55,8 +55,7 @@ test_writesame16_unmap(void) "blocks back and verify they are all zero"); logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read16(sd, NULL, 0, - i * block_size, block_size, + READ16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); CU_ASSERT(all_zeroes(scratch, i * block_size)); @@ -86,7 +85,7 @@ test_writesame16_unmap(void) "blocks back and verify they are all zero"); logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read16(sd, NULL, num_blocks - i, + READ16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); @@ -145,8 +144,7 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read16(sd, NULL, 0, - i * block_size, block_size, + READ16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); CU_ASSERT(all_zeroes(scratch, i * block_size)); @@ -190,8 +188,7 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read16(sd, NULL, 0, - i * block_size, block_size, + READ16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); CU_ASSERT(all_zeroes(scratch, i * block_size)); diff --git a/test-tool/test_writesame16_unmap_until_end.c b/test-tool/test_writesame16_unmap_until_end.c index c598361..e033077 100644 --- a/test-tool/test_writesame16_unmap_until_end.c +++ b/test-tool/test_writesame16_unmap_until_end.c @@ -65,7 +65,7 @@ test_writesame16_unmap_until_end(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - read16(sd, NULL, num_blocks - i, + READ16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writeverify10_dpo.c b/test-tool/test_writeverify10_dpo.c index 2ba5b26..000a5ca 100644 --- a/test-tool/test_writeverify10_dpo.c +++ b/test-tool/test_writeverify10_dpo.c @@ -40,10 +40,8 @@ test_writeverify10_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_writeverify10_residuals.c b/test-tool/test_writeverify10_residuals.c index e0b08c1..eda0aa7 100644 --- a/test-tool/test_writeverify10_residuals.c +++ b/test-tool/test_writeverify10_residuals.c @@ -34,7 +34,7 @@ test_writeverify10_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -301,10 +301,8 @@ test_writeverify10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -375,10 +373,8 @@ test_writeverify10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { diff --git a/test-tool/test_writeverify12_dpo.c b/test-tool/test_writeverify12_dpo.c index 2d4e1ee..91290f8 100644 --- a/test-tool/test_writeverify12_dpo.c +++ b/test-tool/test_writeverify12_dpo.c @@ -40,10 +40,8 @@ test_writeverify12_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_writeverify12_residuals.c b/test-tool/test_writeverify12_residuals.c index 93ae2e8..b7555a5 100644 --- a/test-tool/test_writeverify12_residuals.c +++ b/test-tool/test_writeverify12_residuals.c @@ -34,7 +34,7 @@ test_writeverify12_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -301,10 +301,8 @@ test_writeverify12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -375,10 +373,8 @@ test_writeverify12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { diff --git a/test-tool/test_writeverify16_dpo.c b/test-tool/test_writeverify16_dpo.c index 2f9ec39..7d57d95 100644 --- a/test-tool/test_writeverify16_dpo.c +++ b/test-tool/test_writeverify16_dpo.c @@ -40,10 +40,8 @@ test_writeverify16_dpo(void) CHECK_FOR_SBC; - ret = read10(sd, NULL, 0, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, diff --git a/test-tool/test_writeverify16_residuals.c b/test-tool/test_writeverify16_residuals.c index 668787c..ad55c90 100644 --- a/test-tool/test_writeverify16_residuals.c +++ b/test-tool/test_writeverify16_residuals.c @@ -34,7 +34,7 @@ test_writeverify16_residuals(void) struct scsi_task *task_ret; unsigned char buf[10000]; struct iscsi_data data; - int ret, ok; + int ok; unsigned int i; logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -307,10 +307,8 @@ test_writeverify16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) { @@ -381,10 +379,8 @@ test_writeverify16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(sd, NULL, 0, 2* block_size, - block_size, 0, 0, 0, 0, 0, buf, - EXPECT_STATUS_GOOD); - CU_ASSERT_EQUAL(ret, 0); + READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, + EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); for (i = 0; i < block_size; i++) {