Tests: add helpers for read*

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 11:07:54 -08:00
parent 0a814db48f
commit c48283fe75
59 changed files with 377 additions and 603 deletions

View File

@@ -223,6 +223,48 @@ do { \
CU_ASSERT_EQUAL(_r, 0); \ CU_ASSERT_EQUAL(_r, 0); \
} while (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(...) \ #define RECEIVE_COPY_RESULTS(...) \
do { \ do { \
int _r; \ int _r; \

View File

@@ -83,7 +83,7 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify " logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are still unchanged as 'A'", i); "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, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
@@ -139,9 +139,9 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64 logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64
"they are still unchanged as 'A'", "they are still unchanged as 'A'",
i, num_blocks - i); i, num_blocks - i);
read16(sd, NULL, num_blocks - i, i * block_size, READ16(sd, NULL, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
for (j = 0; j < i * block_size; j++) { for (j = 0; j < i * block_size; j++) {
if (scratch[j] != 'A') { if (scratch[j] != 'A') {

View File

@@ -31,7 +31,7 @@
void void
test_compareandwrite_simple(void) test_compareandwrite_simple(void)
{ {
int i, ret; int i;
unsigned j; unsigned j;
int maxbl; int maxbl;
@@ -81,10 +81,9 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify " logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are all 'B'", i); "they are all 'B'", i);
ret = read16(sd, NULL, 0, i * block_size, READ16(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) { for (j = 0; j < i * block_size; j++) {
if (scratch[j] != 'B') { if (scratch[j] != 'B') {
@@ -135,10 +134,9 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64 logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64
" and verify they are all 'B'", " and verify they are all 'B'",
i, num_blocks - i); i, num_blocks - i);
ret = read16(sd, NULL, num_blocks - i, i * block_size, READ16(sd, NULL, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
for (j = 0; j < i * block_size; j++) { for (j = 0; j < i * block_size; j++) {
if (scratch[j] != 'B') { if (scratch[j] != 'B') {

View File

@@ -71,7 +71,7 @@ test_extendedcopy_simple(void)
EXTENDEDCOPY(sd, &data, EXPECT_STATUS_GOOD); EXTENDEDCOPY(sd, &data, EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read 2048 blocks from end of the LUN"); 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, block_size, 0, 0, 0, 0, 0, buf2,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -71,11 +71,9 @@ test_modesense6_control_d_sense(void)
} }
logging(LOG_VERBOSE, "Send a READ16 that will fail so we can check " logging(LOG_VERBOSE, "Send a READ16 that will fail so we can check "
"the type of sense data returned"); "the type of sense data returned");
ret = read16(sd, &r16_task, 0xffffffffffffffffLL, READ16(sd, &r16_task, 0xffffffffffffffffLL, block_size, block_size, 0,
block_size, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
if (page->control.d_sense) { if (page->control.d_sense) {
logging(LOG_VERBOSE, "D_SENSE is set, verify that sense format " logging(LOG_VERBOSE, "D_SENSE is set, verify that sense format "

View File

@@ -88,17 +88,12 @@ test_modesense6_control_swp(void)
logging(LOG_VERBOSE, "Read a block from the now Read-Only device"); logging(LOG_VERBOSE, "Read a block from the now Read-Only device");
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to write a block to the Read-Only device"); logging(LOG_VERBOSE, "Try to write a block to the Read-Only device");
ret = write10(sd, 0, block_size, WRITE10(sd, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_WRITE_PROTECTED);
EXPECT_WRITE_PROTECTED);
CU_ASSERT_EQUAL(ret, 0);
finished: finished:
if (ms_task != NULL) { if (ms_task != NULL) {

View File

@@ -43,7 +43,7 @@ test_multipathio_simple(void)
memset(write_buf, 0xa6, 256 * block_size); memset(write_buf, 0xa6, 256 * block_size);
for (write_path = 0; write_path < mp_num_sds; write_path++) { for (write_path = 0; write_path < mp_num_sds; write_path++) {
int i, ret; int i;
int read_path; int read_path;
/* read back written data using a different path */ /* read back written data using a different path */
@@ -58,21 +58,12 @@ test_multipathio_simple(void)
&& maximum_transfer_length < i) { && maximum_transfer_length < i) {
break; 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, block_size, 0, 0, 0, 0, 0, write_buf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
if (ret == -2) { READ10(mp_sds[read_path], NULL, 0, i * block_size,
logging(LOG_NORMAL, block_size, 0, 0, 0, 0, 0, read_buf,
"[SKIPPED] WRITE16 not implemented."); EXPECT_STATUS_GOOD);
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);
/* compare written and read data */ /* compare written and read data */
CU_ASSERT_EQUAL(0, CU_ASSERT_EQUAL(0,

View File

@@ -60,10 +60,9 @@ test_orwrite_verify(void)
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read %d blocks back", i); logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf, block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5"); logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5");
ret = memcmp(buf, readbuf, block_size * i); ret = memcmp(buf, readbuf, block_size * i);
@@ -76,7 +75,7 @@ test_orwrite_verify(void)
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read %d blocks back", i); 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, block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
@@ -105,10 +104,9 @@ test_orwrite_verify(void)
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read %d blocks back", i); logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(sd, NULL, num_blocks - i, i * block_size, READ16(sd, NULL, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf, block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5"); logging(LOG_VERBOSE, "Verify that the blocks are all 0xa5");
ret = memcmp(buf, readbuf, block_size * i); ret = memcmp(buf, readbuf, block_size * i);
@@ -121,10 +119,9 @@ test_orwrite_verify(void)
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read %d blocks back", i); logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(sd, NULL, num_blocks - i, i * block_size, READ16(sd, NULL, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf, block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the blocks are all 0xff"); logging(LOG_VERBOSE, "Verify that the blocks are all 0xff");
memset(buf, 0xff, block_size * i); memset(buf, 0xff, block_size * i);

View File

@@ -27,14 +27,11 @@
void void
test_read10_0blocks(void) test_read10_0blocks(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0"); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0");
ret = read10(sd, NULL, 0, 0, block_size,
0, 0, 0, 0, 0, NULL, READ10(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (num_blocks > 0x80000000) { if (num_blocks > 0x80000000) {
CU_PASS("[SKIPPED] LUN is too big"); 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"); logging(LOG_VERBOSE, "Test READ10 0-blocks one block past end-of-LUN");
ret = read10(sd, NULL, num_blocks + 1, 0, READ10(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL,
block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31"); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31");
ret = read10(sd, NULL, 0x80000000, 0, block_size, READ10(sd, NULL, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1");
ret = read10(sd, NULL, -1, 0, block_size, READ10(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }

View File

@@ -28,7 +28,7 @@
void void
test_read10_beyond_eol(void) test_read10_beyond_eol(void)
{ {
int i, ret; int i;
if (num_blocks >= 0x80000000) { if (num_blocks >= 0x80000000) {
CU_PASS("LUN is too big for read-beyond-eol tests with READ10. Skipping test.\n"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks + 1 - i, READ10(sd, NULL, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 1-256 blocks at LBA==2^31"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0x80000000, READ10(sd, NULL, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 1-256 blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ10 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, -1, i * block_size, READ10(sd, NULL, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 2-256 blocks all but one block beyond the end"); logging(LOG_VERBOSE, "Test READ10 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) { for (i = 2; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks - 1, READ10(sd, NULL, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -60,41 +60,35 @@ test_read10_dpofua(void)
logging(LOG_VERBOSE, "Test READ10 with DPO==1"); logging(LOG_VERBOSE, "Test READ10 with DPO==1");
if (dpofua) { if (dpofua) {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL, block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL, block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 with FUA==1"); logging(LOG_VERBOSE, "Test READ10 with FUA==1");
if (dpofua) { if (dpofua) {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL, block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL, block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 with DPO==1 FUA==1"); logging(LOG_VERBOSE, "Test READ10 with DPO==1 FUA==1");
if (dpofua) { if (dpofua) {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 1, 1, 0, 0, NULL, block_size, block_size, 0, 1, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0,
block_size, block_size, 0, 1, 1, 0, 0, NULL, block_size, block_size, 0, 1, 1, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }

View File

@@ -29,8 +29,7 @@
void void
test_read10_rdprotect(void) test_read10_rdprotect(void)
{ {
int i, ret; int i;
/* /*
* Try out different non-zero values for RDPROTECT. * Try out different non-zero values for RDPROTECT.
@@ -43,11 +42,9 @@ test_read10_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = read10(sd, NULL, 0, READ10(sd, NULL, 0, block_size, block_size,
block_size, block_size, i, 0, 0, 0, 0, NULL,
i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
return; return;
} }

View File

@@ -29,8 +29,7 @@
void void
test_read10_simple(void) test_read10_simple(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ10 of 1-256 blocks at the start of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ10 of 1-256 blocks at the end of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -27,19 +27,10 @@
void void
test_read12_0blocks(void) test_read12_0blocks(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0"); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0");
ret = read12(sd, NULL, 0, 0, block_size, READ12(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD);
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);
if (num_blocks > 0x80000000) { if (num_blocks > 0x80000000) {
CU_PASS("[SKIPPED] LUN is too big"); 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"); logging(LOG_VERBOSE, "Test READ12 0-blocks one block past end-of-LUN");
ret = read12(sd, NULL, num_blocks + 1, 0, READ12(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL,
block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==2^31"); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==2^31");
ret = read12(sd, NULL, 0x80000000, 0, block_size, READ12(sd, NULL, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==-1");
ret = read12(sd, NULL, -1, 0, block_size, READ12(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }

View File

@@ -28,7 +28,7 @@
void void
test_read12_beyond_eol(void) test_read12_beyond_eol(void)
{ {
int i, ret; int i;
if (num_blocks >= 0x80000000) { if (num_blocks >= 0x80000000) {
CU_PASS("LUN is too big for read-beyond-eol tests with READ12. Skipping test.\n"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks + 1 - i, READ12(sd, NULL, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); 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);
} }
logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==2^31"); logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==2^31");
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, 0x80000000, READ12(sd, NULL, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ12 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, -1, i * block_size, READ12(sd, NULL, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ12 2-256 blocks all but one block beyond the end"); logging(LOG_VERBOSE, "Test READ12 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) { for (i = 2; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks - 1, READ12(sd, NULL, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -60,41 +60,35 @@ test_read12_dpofua(void)
logging(LOG_VERBOSE, "Test READ12 with DPO==1"); logging(LOG_VERBOSE, "Test READ12 with DPO==1");
if (dpofua) { if (dpofua) {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL, block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL, block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ12 with FUA==1"); logging(LOG_VERBOSE, "Test READ12 with FUA==1");
if (dpofua) { if (dpofua) {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL, block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL, block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ12 with DPO==1 FUA==1"); logging(LOG_VERBOSE, "Test READ12 with DPO==1 FUA==1");
if (dpofua) { if (dpofua) {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 1, 1, 0, 0, NULL, block_size, block_size, 0, 1, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0,
block_size, block_size, 0, 1, 1, 0, 0, NULL, block_size, block_size, 0, 1, 1, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "

View File

@@ -29,7 +29,7 @@
void void
test_read12_rdprotect(void) test_read12_rdprotect(void)
{ {
int i, ret; int i;
/* /*
* Try out different non-zero values for RDPROTECT. * Try out different non-zero values for RDPROTECT.
@@ -42,16 +42,9 @@ test_read12_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = read12(sd, NULL, 0, READ12(sd, NULL, 0, block_size, block_size,
block_size, block_size, i, 0, 0, 0, 0, NULL,
i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
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);
} }
return; return;
} }

View File

@@ -29,8 +29,7 @@
void void
test_read12_simple(void) test_read12_simple(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ12 of 1-256 blocks at the start of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, 0, i * block_size, READ12(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); 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);
} }
@@ -55,9 +48,8 @@ test_read12_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks - i, READ12(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -27,39 +27,23 @@
void void
test_read16_0blocks(void) test_read16_0blocks(void)
{ {
int ret;
CHECK_FOR_SBC; CHECK_FOR_SBC;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0"); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0");
ret = read16(sd, NULL, 0, 0, block_size, READ16(sd, NULL, 0, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD);
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);
logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN"); logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN");
ret = read16(sd, NULL, num_blocks + 1, 0, READ16(sd, NULL, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL,
block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==2^63"); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==2^63");
ret = read16(sd, NULL, 0x8000000000000000ULL, 0, READ16(sd, NULL, 0x8000000000000000ULL, 0,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB); EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==-1");
ret = read16(sd, NULL, -1, 0, block_size, READ16(sd, NULL, -1, 0, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }

View File

@@ -39,7 +39,7 @@ static int ilog2(size_t i)
void void
test_read16_beyond_eol(void) test_read16_beyond_eol(void)
{ {
int i, ret; int i;
CHECK_FOR_SBC; CHECK_FOR_SBC;
@@ -49,16 +49,9 @@ test_read16_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks + 1 - i,
ret = read16(sd, NULL, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
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);
} }
logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^63"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 0x8000000000000000ULL,
ret = read16(sd, NULL, 0x8000000000000000ULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d", logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d",
64 - ilog2(block_size)); 64 - ilog2(block_size));
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 1ULL << (64 - ilog2(block_size)),
ret = read16(sd, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
1ULL << (64 - ilog2(block_size)), EXPECT_LBA_OOB);
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d", logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==2^%d",
63 - ilog2(block_size)); 63 - ilog2(block_size));
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 1ULL << (63 - ilog2(block_size)),
ret = read16(sd, NULL, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
1ULL << (63 - ilog2(block_size)), EXPECT_LBA_OOB);
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==-1"); logging(LOG_VERBOSE, "Test READ16 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) { for (i = 1; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, -1, i * block_size,
ret = read16(sd, NULL, -1, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 2-256 blocks all but one block beyond the end"); logging(LOG_VERBOSE, "Test READ16 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) { for (i = 2; i <= 256; i++) {
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks - 1,
ret = read16(sd, NULL, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB);
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -60,44 +60,31 @@ test_read16_dpofua(void)
logging(LOG_VERBOSE, "Test READ16 with DPO==1"); logging(LOG_VERBOSE, "Test READ16 with DPO==1");
if (dpofua) { if (dpofua) {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 1, 0, 0, 0, NULL,
block_size, block_size, 0, 1, 0, 0, 0, NULL, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 1, 0, 0, 0, NULL,
block_size, block_size, 0, 1, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 with FUA==1"); logging(LOG_VERBOSE, "Test READ16 with FUA==1");
if (dpofua) { if (dpofua) {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 0, 1, 0, 0, NULL,
block_size, block_size, 0, 0, 1, 0, 0, NULL, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 0, 1, 0, 0, NULL,
block_size, block_size, 0, 0, 1, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1"); logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1");
if (dpofua) { if (dpofua) {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 1, 1, 0, 0, NULL,
block_size, block_size, 0, 1, 1, 0, 0, NULL, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} else { } else {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size, 0, 1, 1, 0, 0, NULL,
block_size, block_size, 0, 1, 1, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
} }
logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES " logging(LOG_VERBOSE, "Try fetching REPORT_SUPPORTED_OPCODES "
"for READ16"); "for READ16");
REPORT_SUPPORTED_OPCODES(sd, &rso_task, REPORT_SUPPORTED_OPCODES(sd, &rso_task,

View File

@@ -29,7 +29,7 @@
void void
test_read16_rdprotect(void) test_read16_rdprotect(void)
{ {
int i, ret; int i;
/* /*
* Try out different non-zero values for RDPROTECT. * Try out different non-zero values for RDPROTECT.
@@ -42,16 +42,9 @@ test_read16_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = read16(sd, NULL, 0, READ16(sd, NULL, 0, block_size, block_size,
block_size, block_size, i, 0, 0, 0, 0, NULL,
i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB);
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);
} }
return; return;
} }

View File

@@ -29,7 +29,7 @@
void void
test_read16_simple(void) test_read16_simple(void)
{ {
int i, ret; int i;
CHECK_FOR_SBC; CHECK_FOR_SBC;
@@ -39,16 +39,9 @@ test_read16_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 0, i * block_size,
ret = read16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD);
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);
} }
@@ -57,10 +50,8 @@ test_read16_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks - i,
ret = read16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
} }
} }

View File

@@ -34,8 +34,7 @@ check_wabereq(void)
struct scsi_task *task_ret = NULL; struct scsi_task *task_ret = NULL;
logging(LOG_VERBOSE, "Read one block from LBA 0"); logging(LOG_VERBOSE, "Read one block from LBA 0");
read10(sd, &task_ret, 0, block_size, block_size, READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret); CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret);
CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED); CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED);
@@ -195,14 +194,10 @@ check_unmap(void)
static void static void
check_lun_is_wiped(unsigned char *buf, uint64_t lba) check_lun_is_wiped(unsigned char *buf, uint64_t lba)
{ {
int ret;
unsigned char *rbuf = alloca(256 * block_size); unsigned char *rbuf = alloca(256 * block_size);
ret = read16(sd, NULL, lba, 256 * block_size, READ16(sd, NULL, lba, 256 * block_size, block_size, 0, 0, 0, 0, 0, rbuf,
block_size, 0, 0, 0, 0, 0, rbuf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 == NULL) { if (rc16 == NULL) {
return; return;
} }

View File

@@ -34,8 +34,7 @@ check_wacereq(void)
struct scsi_task *task_ret = NULL; struct scsi_task *task_ret = NULL;
logging(LOG_VERBOSE, "Read one block from LBA 0"); logging(LOG_VERBOSE, "Read one block from LBA 0");
read10(sd, &task_ret, 0, block_size, block_size, READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret); CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret);
CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED); CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED);
@@ -104,14 +103,10 @@ check_wacereq(void)
static void static void
check_lun_is_wiped(unsigned char *buf, uint64_t lba) check_lun_is_wiped(unsigned char *buf, uint64_t lba)
{ {
int ret;
unsigned char *rbuf = alloca(256 * block_size); unsigned char *rbuf = alloca(256 * block_size);
ret = read16(sd, NULL, lba, 256 * block_size, READ16(sd, NULL, lba, 256 * block_size, block_size, 0, 0, 0, 0, 0, rbuf,
block_size, 0, 0, 0, 0, 0, rbuf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (!memcmp(buf, rbuf, 256 * block_size)) { if (!memcmp(buf, rbuf, 256 * block_size)) {
logging(LOG_NORMAL, "[FAILED] Blocks were not wiped"); logging(LOG_NORMAL, "[FAILED] Blocks were not wiped");
CU_FAIL("[FAILED] Blocks were not wiped"); CU_FAIL("[FAILED] Blocks were not wiped");

View File

@@ -30,14 +30,12 @@
static void static void
check_lun_is_wiped(uint64_t lba, unsigned char c) check_lun_is_wiped(uint64_t lba, unsigned char c)
{ {
int ret;
unsigned char *rbuf = alloca(256 * block_size); unsigned char *rbuf = alloca(256 * block_size);
unsigned char *zbuf = alloca(256 * block_size); unsigned char *zbuf = alloca(256 * block_size);
ret = read16(sd, NULL, lba, 256 * block_size, READ16(sd, NULL, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf, block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
memset(zbuf, c, 256 * block_size); memset(zbuf, c, 256 * block_size);

View File

@@ -107,10 +107,9 @@ test_sanitize_reset(void)
logging(LOG_VERBOSE, "Verify that READ16 fails with " logging(LOG_VERBOSE, "Verify that READ16 fails with "
"SANITIZE_IN_PROGRESS"); "SANITIZE_IN_PROGRESS");
ret = read16(sd, NULL, 0, block_size, READ16(sd, NULL, 0, block_size,
block_size, 0, 0, 0, 0, 0, NULL, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_SANITIZE); EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that INQUIRY is still allowed while " logging(LOG_VERBOSE, "Verify that INQUIRY is still allowed while "
"SANITIZE is in progress"); "SANITIZE is in progress");

View File

@@ -58,10 +58,9 @@ test_unmap_simple(void)
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read blocks 0-%d", i); logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 && rc16->lbprz) { if (rc16 && rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks " logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks "
@@ -96,10 +95,9 @@ test_unmap_simple(void)
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read blocks 0-%d", i); logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (rc16 && rc16->lbprz) { if (rc16 && rc16->lbprz) {
logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks " logging(LOG_VERBOSE, "LBPRZ==1 All UNMAPPED blocks "

View File

@@ -40,10 +40,8 @@ test_verify10_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -29,17 +29,12 @@
void void
test_verify10_flags(void) test_verify10_flags(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 flags"); 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, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY10 with BYTCHK==1"); logging(LOG_VERBOSE, "Test VERIFY10 with BYTCHK==1");
VERIFY10(sd, 0, block_size, block_size, 0, 0, 1, scratch, VERIFY10(sd, 0, block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -30,7 +30,7 @@
void void
test_verify10_mismatch(void) test_verify10_mismatch(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -60,10 +59,9 @@ test_verify10_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify10_mismatch_no_cmp(void) test_verify10_mismatch_no_cmp(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 without BYTCHK for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -60,10 +59,9 @@ test_verify10_mismatch_no_cmp(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify10_simple(void) test_verify10_simple(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 of 1-256 blocks at the start of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY10(sd, 0, i * block_size, block_size, 0, 0, 1, scratch, VERIFY10(sd, 0, i * block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
} }
@@ -52,11 +50,9 @@ test_verify10_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY10(sd, num_blocks - i, VERIFY10(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 1, scratch, i * block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -30,7 +30,7 @@
void void
test_verify10_vrprotect(void) test_verify10_vrprotect(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 with non-zero VRPROTECT"); 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)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY10(sd, 0, block_size, VERIFY10(sd, 0, block_size,
block_size, i, 0, 1, scratch, block_size, i, 0, 1, scratch,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -40,10 +40,8 @@ test_verify12_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -30,16 +30,11 @@
void void
test_verify12_flags(void) test_verify12_flags(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 flags"); logging(LOG_VERBOSE, "Test VERIFY12 flags");
ret = read12(sd, NULL, 0, block_size, READ12(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY12 with BYTCHK==1"); logging(LOG_VERBOSE, "Test VERIFY12 with BYTCHK==1");
VERIFY12(sd, 0, block_size, block_size, 0, 0, 1, scratch, VERIFY12(sd, 0, block_size, block_size, 0, 0, 1, scratch,

View File

@@ -30,7 +30,7 @@
void void
test_verify12_mismatch(void) test_verify12_mismatch(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, 0, i * block_size, READ12(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -59,10 +59,9 @@ test_verify12_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks - i, READ12(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify12_mismatch_no_cmp(void) test_verify12_mismatch_no_cmp(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 without BYTCHK for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, 0, i * block_size, READ12(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -59,10 +59,9 @@ test_verify12_mismatch_no_cmp(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks - i, READ12(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify12_simple(void) test_verify12_simple(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 of 1-256 blocks at the start of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ12(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY12(sd, 0, i * block_size, block_size, 0, 0, 1, scratch, VERIFY12(sd, 0, i * block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
} }
@@ -52,11 +50,9 @@ test_verify12_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read12(sd, NULL, num_blocks - i, READ12(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY12(sd, num_blocks - i, VERIFY12(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 1, scratch, i * block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -30,7 +30,7 @@
void void
test_verify12_vrprotect(void) test_verify12_vrprotect(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 with non-zero VRPROTECT"); 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)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
READ10(sd, NULL, 0, block_size,
ret = read10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY12(sd, 0, block_size, VERIFY12(sd, 0, block_size,
block_size, i, 0, 1, scratch, block_size, i, 0, 1, scratch,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -40,10 +40,8 @@ test_verify16_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -30,15 +30,11 @@
void void
test_verify16_flags(void) test_verify16_flags(void)
{ {
int ret;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 flags"); logging(LOG_VERBOSE, "Test VERIFY16 flags");
ret = read16(sd, NULL, 0, block_size, READ16(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY16 with BYTCHK==1"); logging(LOG_VERBOSE, "Test VERIFY16 with BYTCHK==1");
VERIFY16(sd, 0, block_size, block_size, 0, 0, 1, scratch, VERIFY16(sd, 0, block_size, block_size, 0, 0, 1, scratch,

View File

@@ -30,7 +30,7 @@
void void
test_verify16_mismatch(void) test_verify16_mismatch(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 0, i * block_size,
ret = read16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -60,11 +59,9 @@ test_verify16_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks - i,
ret = read16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify16_mismatch_no_cmp(void) test_verify16_mismatch_no_cmp(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 without BYTCHK for blocks 1-255"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, 0, i * block_size,
ret = read16(sd, NULL, 0, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';
@@ -60,11 +59,9 @@ test_verify16_mismatch_no_cmp(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks - i,
ret = read16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
/* flip a random byte in the data */ /* flip a random byte in the data */
scratch[offset] ^= 'X'; scratch[offset] ^= 'X';

View File

@@ -30,7 +30,7 @@
void void
test_verify16_simple(void) test_verify16_simple(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 of 1-256 blocks at the start of the LUN"); 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) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
ret = read10(sd, NULL, 0, i * block_size, READ16(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
VERIFY16(sd, 0, i * block_size, VERIFY16(sd, 0, i * block_size,
block_size, 0, 0, 1, scratch, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
@@ -51,12 +51,9 @@ test_verify16_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) { if (maximum_transfer_length && maximum_transfer_length < i) {
break; break;
} }
READ16(sd, NULL, num_blocks - i,
ret = read16(sd, NULL, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, scratch,
i * block_size, block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY16(sd, num_blocks - i, VERIFY16(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 1, scratch, i * block_size, block_size, 0, 0, 1, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -30,7 +30,7 @@
void void
test_verify16_vrprotect(void) test_verify16_vrprotect(void)
{ {
int i, ret; int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT"); 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)) { if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = read16(sd, NULL, 0, block_size, READ16(sd, NULL, 0, block_size,
block_size, 0, 0, 0, 0, 0, scratch, block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
VERIFY16(sd, 0, block_size, VERIFY16(sd, 0, block_size,
block_size, i, 0, 1, scratch, block_size, i, 0, 1, scratch,
EXPECT_INVALID_FIELD_IN_CDB); EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -34,7 +34,7 @@ test_write10_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -297,10 +297,8 @@ test_write10_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(sd, NULL, 0, 2* block_size, READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -371,10 +369,8 @@ test_write10_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(sd, NULL, 0, 2* block_size, READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {

View File

@@ -34,7 +34,7 @@ test_write12_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -296,10 +296,8 @@ test_write12_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(sd, NULL, 0, 2* block_size, READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -370,10 +368,8 @@ test_write12_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(sd, NULL, 0, 2* block_size, READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {

View File

@@ -34,7 +34,7 @@ test_write16_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -296,10 +296,8 @@ test_write16_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(sd, NULL, 0, 2* block_size, READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -370,10 +368,8 @@ test_write16_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(sd, NULL, 0, 2* block_size, READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {

View File

@@ -59,8 +59,7 @@ test_writesame10_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read10(sd, NULL, 0, READ10(sd, NULL, 0, i * block_size, block_size,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size)); 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 " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
@@ -153,8 +152,7 @@ test_writesame10_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read10(sd, NULL, 0, READ10(sd, NULL, 0, i * block_size, block_size,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size)); CU_ASSERT(all_zeroes(scratch, i * block_size));

View File

@@ -62,7 +62,7 @@ test_writesame10_unmap_until_end(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read10(sd, NULL, num_blocks - i, READ10(sd, NULL, num_blocks - i,
i * block_size, block_size, i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -55,8 +55,7 @@ test_writesame16_unmap(void)
"blocks back and verify they are all zero"); "blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read16(sd, NULL, 0, READ16(sd, NULL, 0, i * block_size, block_size,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size)); CU_ASSERT(all_zeroes(scratch, i * block_size));
@@ -86,7 +85,7 @@ test_writesame16_unmap(void)
"blocks back and verify they are all zero"); "blocks back and verify they are all zero");
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read16(sd, NULL, num_blocks - i, READ16(sd, NULL, num_blocks - i,
i * block_size, block_size, i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
@@ -145,8 +144,7 @@ test_writesame16_unmap(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read16(sd, NULL, 0, READ16(sd, NULL, 0, i * block_size, block_size,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size)); 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 " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read16(sd, NULL, 0, READ16(sd, NULL, 0, i * block_size, block_size,
i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT(all_zeroes(scratch, i * block_size)); CU_ASSERT(all_zeroes(scratch, i * block_size));

View File

@@ -65,7 +65,7 @@ test_writesame16_unmap_until_end(void)
logging(LOG_VERBOSE, "Read %d blocks and verify they " logging(LOG_VERBOSE, "Read %d blocks and verify they "
"are now zero", i); "are now zero", i);
read16(sd, NULL, num_blocks - i, READ16(sd, NULL, num_blocks - i,
i * block_size, block_size, i * block_size, block_size,
0, 0, 0, 0, 0, scratch, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);

View File

@@ -40,10 +40,8 @@ test_writeverify10_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -34,7 +34,7 @@ test_writeverify10_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -301,10 +301,8 @@ test_writeverify10_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(sd, NULL, 0, 2* block_size, READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -375,10 +373,8 @@ test_writeverify10_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read10(sd, NULL, 0, 2* block_size, READ10(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {

View File

@@ -40,10 +40,8 @@ test_writeverify12_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -34,7 +34,7 @@ test_writeverify12_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -301,10 +301,8 @@ test_writeverify12_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(sd, NULL, 0, 2* block_size, READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -375,10 +373,8 @@ test_writeverify12_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read12(sd, NULL, 0, 2* block_size, READ12(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {

View File

@@ -40,10 +40,8 @@ test_writeverify16_dpo(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
ret = read10(sd, NULL, 0, block_size, READ10(sd, NULL, 0, block_size, block_size, 0, 0, 0, 0, 0, scratch,
block_size, 0, 0, 0, 0, 0, scratch, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data"); logging(LOG_VERBOSE, "Read the DPOFUA flag from mode sense data");
ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT, ret = modesense6(sd, &ms_task, 0, SCSI_MODESENSE_PC_CURRENT,

View File

@@ -34,7 +34,7 @@ test_writeverify16_residuals(void)
struct scsi_task *task_ret; struct scsi_task *task_ret;
unsigned char buf[10000]; unsigned char buf[10000];
struct iscsi_data data; struct iscsi_data data;
int ret, ok; int ok;
unsigned int i; unsigned int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -307,10 +307,8 @@ test_writeverify16_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(sd, NULL, 0, 2* block_size, READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {
@@ -381,10 +379,8 @@ test_writeverify16_residuals(void)
task = NULL; task = NULL;
logging(LOG_VERBOSE, "Read the two blocks"); logging(LOG_VERBOSE, "Read the two blocks");
ret = read16(sd, NULL, 0, 2* block_size, READ16(sd, NULL, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf,
block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD);
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'"); logging(LOG_VERBOSE, "Verify that the first block was changed to 'b'");
for (i = 0; i < block_size; i++) { for (i = 0; i < block_size; i++) {