diff --git a/test-tool/test_orwrite_wrprotect.c b/test-tool/test_orwrite_wrprotect.c index 5ca5a1f..ed41ea4 100644 --- a/test-tool/test_orwrite_wrprotect.c +++ b/test-tool/test_orwrite_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_read10_rdprotect.c b/test-tool/test_read10_rdprotect.c index a359c0c..d503d75 100644 --- a/test-tool/test_read10_rdprotect.c +++ b/test-tool/test_read10_rdprotect.c @@ -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); + } } } diff --git a/test-tool/test_read12_rdprotect.c b/test-tool/test_read12_rdprotect.c index 8e88f94..2b49532 100644 --- a/test-tool/test_read12_rdprotect.c +++ b/test-tool/test_read12_rdprotect.c @@ -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); + } } } diff --git a/test-tool/test_read16_rdprotect.c b/test-tool/test_read16_rdprotect.c index e6ea310..1ab4d80 100644 --- a/test-tool/test_read16_rdprotect.c +++ b/test-tool/test_read16_rdprotect.c @@ -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); + } } } diff --git a/test-tool/test_verify10_vrprotect.c b/test-tool/test_verify10_vrprotect.c index c502134..ba3021b 100644 --- a/test-tool/test_verify10_vrprotect.c +++ b/test-tool/test_verify10_vrprotect.c @@ -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); } } diff --git a/test-tool/test_verify12_vrprotect.c b/test-tool/test_verify12_vrprotect.c index f6e38d3..c3f3ca1 100644 --- a/test-tool/test_verify12_vrprotect.c +++ b/test-tool/test_verify12_vrprotect.c @@ -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); } } diff --git a/test-tool/test_verify16_vrprotect.c b/test-tool/test_verify16_vrprotect.c index 332cc7f..ad4d9fb 100644 --- a/test-tool/test_verify16_vrprotect.c +++ b/test-tool/test_verify16_vrprotect.c @@ -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); } } diff --git a/test-tool/test_write10_wrprotect.c b/test-tool/test_write10_wrprotect.c index 678b9fe..a87b29d 100644 --- a/test-tool/test_write10_wrprotect.c +++ b/test-tool/test_write10_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_write12_wrprotect.c b/test-tool/test_write12_wrprotect.c index d02dc73..3e61ae0 100644 --- a/test-tool/test_write12_wrprotect.c +++ b/test-tool/test_write12_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_write16_wrprotect.c b/test-tool/test_write16_wrprotect.c index 5c83646..a75a787 100644 --- a/test-tool/test_write16_wrprotect.c +++ b/test-tool/test_write16_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_writesame10_wrprotect.c b/test-tool/test_writesame10_wrprotect.c index 61d95a5..dbe2acd 100644 --- a/test-tool/test_writesame10_wrprotect.c +++ b/test-tool/test_writesame10_wrprotect.c @@ -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); } diff --git a/test-tool/test_writesame16_wrprotect.c b/test-tool/test_writesame16_wrprotect.c index ed256be..01fd7f0 100644 --- a/test-tool/test_writesame16_wrprotect.c +++ b/test-tool/test_writesame16_wrprotect.c @@ -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); } } diff --git a/test-tool/test_writeverify10_wrprotect.c b/test-tool/test_writeverify10_wrprotect.c index 4a89a0e..92f5923 100644 --- a/test-tool/test_writeverify10_wrprotect.c +++ b/test-tool/test_writeverify10_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_writeverify12_wrprotect.c b/test-tool/test_writeverify12_wrprotect.c index 8d6de1d..bceabac 100644 --- a/test-tool/test_writeverify12_wrprotect.c +++ b/test-tool/test_writeverify12_wrprotect.c @@ -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); + } } } diff --git a/test-tool/test_writeverify16_wrprotect.c b/test-tool/test_writeverify16_wrprotect.c index f627f96..0b2bbb2 100644 --- a/test-tool/test_writeverify16_wrprotect.c +++ b/test-tool/test_writeverify16_wrprotect.c @@ -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); + } } }