diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index e40ee97..ccc6ac8 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -2226,6 +2226,18 @@ read16(struct iscsi_context *iscsi, int lun, uint64_t lba, iscsi_get_error(iscsi)); return -1; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + scsi_free_scsi_task(task); + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed."); + return -2; + } + } if (task->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ16 command: " "failed with sense. %s", iscsi_get_error(iscsi)); @@ -2263,6 +2275,18 @@ read16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, iscsi_get_error(iscsi)); return -1; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + scsi_free_scsi_task(task); + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed."); + return -2; + } + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ16 successful but should " "have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB"); @@ -2310,6 +2334,18 @@ read16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, iscsi_get_error(iscsi)); return -1; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + scsi_free_scsi_task(task); + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed."); + return -2; + } + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ16 successful but should " "have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE"); @@ -2356,6 +2392,18 @@ read16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, iscsi_get_error(iscsi)); return -1; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + scsi_free_scsi_task(task); + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READ16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READ16 is not implemented and SBC-3 is not claimed."); + return -2; + } + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ16 successful but should " "have failed with NOT_READY/MEDIUM_NOT_PRESENT*"); @@ -2469,9 +2517,14 @@ readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len) if (task->status == SCSI_STATUS_CHECK_CONDITION && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { - logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on target"); scsi_free_scsi_task(task); - return -2; + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented and SBC-3 is not claimed."); + return -2; + } } if (task->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READCAPACITY16 command: " @@ -2508,9 +2561,14 @@ readcapacity16_nomedium(struct iscsi_context *iscsi, int lun, int alloc_len) if (task->status == SCSI_STATUS_CHECK_CONDITION && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { - logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on target"); scsi_free_scsi_task(task); - return -2; + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); + return -1; + } else { + logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented and SBC-3 is not claimed."); + return -2; + } } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READCAPACITY16 command successful. But should have failed with NOT_READY/MEDIUM_NOT_PRESENT*"); diff --git a/test-tool/test_read16_0blocks.c b/test-tool/test_read16_0blocks.c index 335b812..6f257e1 100644 --- a/test-tool/test_read16_0blocks.c +++ b/test-tool/test_read16_0blocks.c @@ -34,6 +34,11 @@ test_read16_0blocks(void) logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0"); ret = read16(iscsic, tgt_lun, 0, 0, block_size, 0, 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); logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN"); diff --git a/test-tool/test_read16_beyond_eol.c b/test-tool/test_read16_beyond_eol.c index f8d0811..571ef52 100644 --- a/test-tool/test_read16_beyond_eol.c +++ b/test-tool/test_read16_beyond_eol.c @@ -37,6 +37,11 @@ test_read16_beyond_eol(void) ret = read16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 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); } diff --git a/test-tool/test_read16_flags.c b/test-tool/test_read16_flags.c index 6694835..101c79b 100644 --- a/test-tool/test_read16_flags.c +++ b/test-tool/test_read16_flags.c @@ -39,6 +39,11 @@ test_read16_flags(void) ret = read16(iscsic, tgt_lun, 0, block_size, block_size, 0, 1, 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); diff --git a/test-tool/test_read16_rdprotect.c b/test-tool/test_read16_rdprotect.c index ff349f4..e6ea310 100644 --- a/test-tool/test_read16_rdprotect.c +++ b/test-tool/test_read16_rdprotect.c @@ -42,6 +42,11 @@ test_read16_rdprotect(void) 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); } } diff --git a/test-tool/test_read16_residuals.c b/test-tool/test_read16_residuals.c index 1a7b9fc..127f524 100644 --- a/test-tool/test_read16_residuals.c +++ b/test-tool/test_read16_residuals.c @@ -59,6 +59,13 @@ test_read16_residuals(void) CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + 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; + } logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", diff --git a/test-tool/test_read16_simple.c b/test-tool/test_read16_simple.c index 505de49..2ffdb4c 100644 --- a/test-tool/test_read16_simple.c +++ b/test-tool/test_read16_simple.c @@ -38,6 +38,12 @@ test_read16_simple(void) for (i = 1; i <= 256; i++) { ret = read16(iscsic, tgt_lun, 0, i * block_size, block_size, 0, 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); } @@ -46,6 +52,7 @@ test_read16_simple(void) for (i = 1; i <= 256; i++) { ret = read16(iscsic, tgt_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL); + CU_ASSERT_EQUAL(ret, 0); } } diff --git a/test-tool/test_readcapacity16_alloclen.c b/test-tool/test_readcapacity16_alloclen.c index fee1f4f..fa8a065 100644 --- a/test-tool/test_readcapacity16_alloclen.c +++ b/test-tool/test_readcapacity16_alloclen.c @@ -37,15 +37,10 @@ test_readcapacity16_alloclen(void) for (i = 0; i < 16; i++) { ret = readcapacity16(iscsic, tgt_lun, i); if (ret == -2) { - if (sbc3_support) { - logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); - CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); - } else { - logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed."); - } + 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); } } diff --git a/test-tool/test_readcapacity16_simple.c b/test-tool/test_readcapacity16_simple.c index a7c187d..ce478fa 100644 --- a/test-tool/test_readcapacity16_simple.c +++ b/test-tool/test_readcapacity16_simple.c @@ -37,14 +37,9 @@ test_readcapacity16_simple(void) ret = readcapacity16(iscsic, tgt_lun, 16); if (ret == -2) { - if (sbc3_support) { - logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); - CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); - } else { - logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed."); - } + 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); }