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
+13 -8
View File
@@ -41,15 +41,20 @@ test_orwrite_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test ORWRITE with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test ORWRITE with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0, 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, block_size, block_size,
i, 0, 0, 0, 0, buf); i, 0, 0, 0, 0, buf);
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented."); logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented.");
CU_PASS("ORWRITE is not implemented."); CU_PASS("ORWRITE is not implemented.");
return; return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+8 -3
View File
@@ -40,10 +40,15 @@ test_read10_rdprotect(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0, 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, block_size, block_size,
i, 0, 0, 0, 0, NULL); i, 0, 0, 0, 0, NULL);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+13 -8
View File
@@ -39,15 +39,20 @@ test_read12_rdprotect(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0, 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, block_size, block_size,
i, 0, 0, 0, 0, NULL); i, 0, 0, 0, 0, NULL);
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
CU_PASS("READ12 is not implemented."); CU_PASS("READ12 is not implemented.");
return; return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+15 -10
View File
@@ -38,15 +38,20 @@ test_read16_rdprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 with non-zero RDPROTECT"); logging(LOG_VERBOSE, "Test READ16 with non-zero RDPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, 0, NULL); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented on this target and it does not claim SBC-3 support."); ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("READ16 is not implemented and no SBC-3 support claimed."); block_size, block_size,
return; i, 0, 0, 0, 0, NULL);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); 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);
}
} }
} }
+17 -13
View File
@@ -35,19 +35,23 @@ test_verify10_vrprotect(void)
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");
if (inq->protect) {
for (i = 1; i < 8; i++) { logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
ret = read10(iscsic, tgt_lun, 0, block_size, } else {
block_size, 0, 0, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
CU_ASSERT_EQUAL(ret, 0); for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size,
ret = verify10_invalidfieldincdb(iscsic, tgt_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf);
block_size, i, 0, 1, buf); CU_ASSERT_EQUAL(ret, 0);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY10 is not implemented."); ret = verify10_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
CU_PASS("[SKIPPED] Target does not support VERIFY10. Skipping test"); block_size, i, 0, 1, buf);
return; 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);
} }
} }
+17 -13
View File
@@ -34,19 +34,23 @@ test_verify12_vrprotect(void)
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");
if (inq->protect) {
for (i = 1; i < 8; i++) { logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
} else {
ret = read10(iscsic, tgt_lun, 0, block_size, logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
block_size, 0, 0, 0, 0, 0, buf); for (i = 1; i < 8; i++) {
ret = verify12_invalidfieldincdb(iscsic, tgt_lun, 0, block_size, ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf); block_size, 0, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY12 is not implemented."); ret = verify12_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
CU_PASS("[SKIPPED] Target does not support VERIFY12. Skipping test"); block_size, i, 0, 1, buf);
return; 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);
} }
} }
+16 -12
View File
@@ -35,18 +35,22 @@ test_verify16_vrprotect(void)
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");
if (inq->protect) {
for (i = 1; i < 8; i++) { logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
ret = read16(iscsic, tgt_lun, 0, block_size, } else {
block_size, 0, 0, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size, ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, i, 0, 1, buf); block_size, 0, 0, 0, 0, 0, buf);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented."); ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test"); block_size, i, 0, 1, buf);
return; 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);
} }
} }
+15 -10
View File
@@ -40,15 +40,20 @@ test_write10_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE10 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITE10 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITE10 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
CU_PASS("WRITE10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+15 -10
View File
@@ -40,15 +40,20 @@ test_write12_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE12 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITE12 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented."); ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITE12 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
CU_PASS("WRITE12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+15 -10
View File
@@ -41,15 +41,20 @@ test_write16_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITE16 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITE16 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented."); ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITE16 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
CU_PASS("WRITE16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+17 -12
View File
@@ -40,17 +40,22 @@ test_writesame10_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITESAME10 with non-zero WRPROTECT");
buf = malloc(block_size); if (inq->protect) {
for (i = 1; i < 8; i++) { logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0, } else {
block_size, 1, logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
0, 0, i, 0, buf); buf = malloc(block_size);
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented."); ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITESAME10 is not implemented."); block_size, 1,
return; 0, 0, i, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITESAME10 is not implemented.");
CU_PASS("WRITESAME10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
free(buf);
} }
free(buf);
} }
+14 -10
View File
@@ -41,16 +41,20 @@ test_writesame16_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME16 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITESAME16 with non-zero WRPROTECT");
if (inq->protect) {
for (i = 1; i < 8; i++) { logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0, } else {
block_size, 1, logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
0, 0, i, 0, buf); for (i = 1; i < 8; i++) {
if (ret == -2) { ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0,
logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented."); block_size, 1,
CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test"); 0, 0, i, 0, buf);
return; 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);
} }
} }
+15 -10
View File
@@ -40,15 +40,20 @@ test_writeverify10_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY10 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITEVERIFY10 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented."); ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITEVERIFY10 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY10 is not implemented.");
CU_PASS("WRITEVERIFY10 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+15 -10
View File
@@ -40,15 +40,20 @@ test_writeverify12_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY12 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITEVERIFY12 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented."); ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITEVERIFY12 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY12 is not implemented.");
CU_PASS("WRITEVERIFY12 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }
+15 -10
View File
@@ -43,15 +43,20 @@ test_writeverify16_wrprotect(void)
*/ */
logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITEVERIFY16 with non-zero WRPROTECT"); logging(LOG_VERBOSE, "Test WRITEVERIFY16 with non-zero WRPROTECT");
for (i = 1; i < 8; i++) { if (inq->protect) {
ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0, logging(LOG_VERBOSE, "No tests for devices that support protection information yet.");
block_size, block_size, } else {
i, 0, 0, 0, buf); logging(LOG_VERBOSE, "Device does not support protection information. All commands should fail.");
if (ret == -2) { for (i = 1; i < 8; i++) {
logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented."); ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
CU_PASS("WRITEVERIFY16 is not implemented."); block_size, block_size,
return; i, 0, 0, 0, buf);
} if (ret == -2) {
CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "[SKIPPED] WRITE1VERIFY16 is not implemented.");
CU_PASS("WRITEVERIFY16 is not implemented.");
return;
}
CU_ASSERT_EQUAL(ret, 0);
}
} }
} }