diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 331b6e4..35ff78f 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -2076,6 +2076,13 @@ read12(struct iscsi_context *iscsi, int lun, uint32_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); + logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); + return -2; + } if (task->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ12 command: " "failed with sense. %s", iscsi_get_error(iscsi)); @@ -2113,6 +2120,13 @@ read12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_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); + logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); + return -2; + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ12 successful but should " "have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB"); @@ -2160,6 +2174,13 @@ read12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_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); + logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); + return -2; + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ12 successful but should " "have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE"); @@ -2206,6 +2227,13 @@ read12_nomedium(struct iscsi_context *iscsi, int lun, uint32_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); + logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented."); + return -2; + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ12 successful but should " "have failed with NOT_READY/MEDIUM_NOT_PRESENT*"); diff --git a/test-tool/test_read12_0blocks.c b/test-tool/test_read12_0blocks.c index 84c0199..be18734 100644 --- a/test-tool/test_read12_0blocks.c +++ b/test-tool/test_read12_0blocks.c @@ -32,6 +32,11 @@ test_read12_0blocks(void) logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0"); ret = read12(iscsic, tgt_lun, 0, 0, block_size, 0, 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 (num_blocks > 0x80000000) { diff --git a/test-tool/test_read12_beyond_eol.c b/test-tool/test_read12_beyond_eol.c index 6444957..4efa32b 100644 --- a/test-tool/test_read12_beyond_eol.c +++ b/test-tool/test_read12_beyond_eol.c @@ -40,6 +40,11 @@ test_read12_beyond_eol(void) ret = read12_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] READ12 is not implemented."); + CU_PASS("READ12 is not implemented."); + return; + } CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_read12_flags.c b/test-tool/test_read12_flags.c index b46ecfb..cfe5b16 100644 --- a/test-tool/test_read12_flags.c +++ b/test-tool/test_read12_flags.c @@ -44,6 +44,11 @@ test_read12_flags(void) ret = read12(iscsic, tgt_lun, 0, block_size, block_size, 0, 1, 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); diff --git a/test-tool/test_read12_rdprotect.c b/test-tool/test_read12_rdprotect.c index ec65ffd..5ff6db8 100644 --- a/test-tool/test_read12_rdprotect.c +++ b/test-tool/test_read12_rdprotect.c @@ -46,6 +46,11 @@ test_read12_rdprotect(void) 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); } } diff --git a/test-tool/test_read12_residuals.c b/test-tool/test_read12_residuals.c index e729dac..33f346f 100644 --- a/test-tool/test_read12_residuals.c +++ b/test-tool/test_read12_residuals.c @@ -59,6 +59,13 @@ test_read12_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] READ12 is not implemented on this target."); + CU_PASS("READ12 is not implemented."); + 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_read12_simple.c b/test-tool/test_read12_simple.c index da6d84c..65e999f 100644 --- a/test-tool/test_read12_simple.c +++ b/test-tool/test_read12_simple.c @@ -1,4 +1,3 @@ - /* Copyright (C) 2013 Ronnie Sahlberg @@ -37,6 +36,11 @@ test_read12_simple(void) for (i = 1; i <= 256; i++) { ret = read12(iscsic, tgt_lun, 0, i * block_size, block_size, 0, 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); } diff --git a/test-tool/test_writeverify10_simple.c b/test-tool/test_writeverify10_simple.c index 81be57f..ff8080b 100644 --- a/test-tool/test_writeverify10_simple.c +++ b/test-tool/test_writeverify10_simple.c @@ -48,7 +48,7 @@ test_writeverify10_simple(void) CU_ASSERT_EQUAL(ret, 0); } - logging(LOG_VERBOSE, "Test WRITE10 of 1-256 blocks at the end of the LUN"); + logging(LOG_VERBOSE, "Test WRITEVERIFY10 of 1-256 blocks at the end of the LUN"); for (i = 1; i <= 256; i++) { unsigned char *buf = malloc(block_size * i);