TESTS: *protect field set to non-zero are only guaranteed to fail if the device does not support protection information

This commit is contained in:
Ronnie Sahlberg
2013-05-11 17:27:35 -07:00
parent 5135836ee5
commit 67676d4756
15 changed files with 220 additions and 149 deletions

View File

@@ -41,15 +41,20 @@ test_orwrite_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test ORWRITE with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented.");
CU_PASS("ORWRITE is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented.");
CU_PASS("ORWRITE is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -40,10 +40,15 @@ test_read10_rdprotect(void)
CHECK_FOR_SBC;
for (i = 1; i < 8; i++) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0,
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -39,15 +39,20 @@ test_read12_rdprotect(void)
CHECK_FOR_SBC;
for (i = 1; i < 8; i++) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -38,15 +38,20 @@ test_read16_rdprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 with non-zero RDPROTECT");
for (i = 1; i < 8; i++) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
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);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL);
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);
}
}
}

View File

@@ -35,19 +35,23 @@ test_verify10_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 with non-zero VRPROTECT");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
CU_ASSERT_EQUAL(ret, 0);
ret = verify10_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY10 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY10. Skipping test");
return;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
CU_ASSERT_EQUAL(ret, 0);
ret = verify10_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY10 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY10. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -34,19 +34,23 @@ test_verify12_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY12 with non-zero VRPROTECT");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = verify12_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY12 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY12. Skipping test");
return;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = verify12_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY12 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY12. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -35,18 +35,22 @@ test_verify16_vrprotect(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT");
for (i = 1; i < 8; i++) {
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
return;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf);
ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented.");
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -40,15 +40,20 @@ test_write10_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE10 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
CU_PASS("WRITE10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
CU_PASS("WRITE10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -40,15 +40,20 @@ test_write12_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE12 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
CU_PASS("WRITE12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
CU_PASS("WRITE12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -41,15 +41,20 @@ test_write16_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE16 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
CU_PASS("WRITE16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
CU_PASS("WRITE16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -40,17 +40,22 @@ test_writesame10_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT");
buf = malloc(block_size);
for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented.");
CU_PASS("WRITESAME10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
buf = malloc(block_size);
for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented.");
CU_PASS("WRITESAME10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
free(buf);
}
free(buf);
}

View File

@@ -41,16 +41,20 @@ test_writesame16_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME16 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented.");
CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test");
return;
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1,
0, 0, i, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented.");
CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -40,15 +40,20 @@ test_writeverify10_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY10 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented.");
CU_PASS("WRITEVERIFY10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented.");
CU_PASS("WRITEVERIFY10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -40,15 +40,20 @@ test_writeverify12_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY12 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
CU_PASS("WRITEVERIFY12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
CU_PASS("WRITEVERIFY12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}

View File

@@ -43,15 +43,20 @@ test_writeverify16_wrprotect(void)
*/
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY16 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) {
ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
CU_PASS("WRITEVERIFY16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
if (inq->protect) {
logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size,
i, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
CU_PASS("WRITEVERIFY16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
}
}