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,6 +41,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0, ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -52,4 +56,5 @@ test_orwrite_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,10 +40,15 @@ test_read10_rdprotect(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
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++) { for (i = 1; i < 8; i++) {
ret = read10_invalidfieldincdb(iscsic, tgt_lun, 0, 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);
} }
}
} }

View File

@@ -39,6 +39,10 @@ test_read12_rdprotect(void)
CHECK_FOR_SBC; CHECK_FOR_SBC;
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++) { for (i = 1; i < 8; i++) {
ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0, ret = read12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -50,4 +54,5 @@ test_read12_rdprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

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");
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++) { for (i = 1; i < 8; i++) {
ret = read16_invalidfieldincdb(iscsic, tgt_lun, 0, ret = read16_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] READ16 is not implemented on this target and it does not claim SBC-3 support."); 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."); CU_PASS("READ16 is not implemented and no SBC-3 support claimed.");
return; return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -35,7 +35,10 @@ 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) {
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++) { for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size, ret = read10(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf); block_size, 0, 0, 0, 0, 0, buf);
@@ -50,4 +53,5 @@ test_verify10_vrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -34,7 +34,10 @@ 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) {
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++) { for (i = 1; i < 8; i++) {
ret = read10(iscsic, tgt_lun, 0, block_size, ret = read10(iscsic, tgt_lun, 0, block_size,
@@ -49,4 +52,5 @@ test_verify12_vrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -35,7 +35,10 @@ 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) {
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++) { for (i = 1; i < 8; i++) {
ret = read16(iscsic, tgt_lun, 0, block_size, ret = read16(iscsic, tgt_lun, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf); block_size, 0, 0, 0, 0, 0, buf);
@@ -49,4 +52,5 @@ test_verify16_vrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,6 +40,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0, ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -51,4 +55,5 @@ test_write10_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,6 +40,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0, ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -51,4 +55,5 @@ test_write12_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -41,6 +41,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0, ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -52,4 +56,5 @@ test_write16_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,6 +40,10 @@ 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");
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); buf = malloc(block_size);
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0, ret = writesame10_invalidfieldincdb(iscsic, tgt_lun, 0,
@@ -53,4 +57,5 @@ test_writesame10_wrprotect(void)
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
free(buf); free(buf);
}
} }

View File

@@ -41,7 +41,10 @@ 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) {
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++) { for (i = 1; i < 8; i++) {
ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0, ret = writesame16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, 1, block_size, 1,
@@ -53,4 +56,5 @@ test_writesame16_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,6 +40,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0, ret = writeverify10_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -51,4 +55,5 @@ test_writeverify10_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -40,6 +40,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0, ret = writeverify12_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -51,4 +55,5 @@ test_writeverify12_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }

View File

@@ -43,6 +43,10 @@ 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");
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++) { for (i = 1; i < 8; i++) {
ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0, ret = writeverify16_invalidfieldincdb(iscsic, tgt_lun, 0,
block_size, block_size, block_size, block_size,
@@ -54,4 +58,5 @@ test_writeverify16_wrprotect(void)
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
} }
}
} }