From f8e317c355d72554029f286dfe0c91ac20ee8ff2 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 27 Apr 2013 16:22:58 -0700 Subject: [PATCH] TESTS: READ6 is optional(==obsolete) --- test-tool/iscsi-support.c | 14 ++++++++++++++ test-tool/test_read6_0blocks.c | 5 +++++ test-tool/test_read6_beyond_eol.c | 5 +++++ test-tool/test_read6_simple.c | 5 +++++ test-tool/test_writesame10_wrprotect.c | 5 +++++ 5 files changed, 34 insertions(+) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 4c44f14..7b587b6 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -1884,6 +1884,13 @@ read6(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] READ6 is not implemented."); + return -2; + } if (task->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ6 command: " "failed with sense. %s", iscsi_get_error(iscsi)); @@ -1917,6 +1924,13 @@ read6_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] READ6 is not implemented."); + return -2; + } if (task->status == SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ6 successful but should " "have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE"); diff --git a/test-tool/test_read6_0blocks.c b/test-tool/test_read6_0blocks.c index 44e3f5b..45999f5 100644 --- a/test-tool/test_read6_0blocks.c +++ b/test-tool/test_read6_0blocks.c @@ -31,6 +31,11 @@ test_read6_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test READ6 0-blocks at LBA==0"); ret = read6(iscsic, tgt_lun, 0, 0, block_size, NULL); + if (ret == -2) { + logging(LOG_NORMAL, "[SKIPPED] READ6 is not implemented."); + CU_PASS("READ6 is not implemented."); + return; + } CU_ASSERT_EQUAL(ret, 0); if (num_blocks > 0x1fffff) { diff --git a/test-tool/test_read6_beyond_eol.c b/test-tool/test_read6_beyond_eol.c index d1354aa..1bd6e64 100644 --- a/test-tool/test_read6_beyond_eol.c +++ b/test-tool/test_read6_beyond_eol.c @@ -41,6 +41,11 @@ test_read6_beyond_eol(void) ret = read6_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i, i * block_size, block_size, NULL); + if (ret == -2) { + logging(LOG_NORMAL, "[SKIPPED] READ6 is not implemented."); + CU_PASS("READ6 is not implemented."); + return; + } CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_read6_simple.c b/test-tool/test_read6_simple.c index 008176f..cb4a126 100644 --- a/test-tool/test_read6_simple.c +++ b/test-tool/test_read6_simple.c @@ -36,6 +36,11 @@ test_read6_simple(void) for (i = 1; i <= 255; i++) { ret = read6(iscsic, tgt_lun, 0, i * block_size, block_size, NULL); + if (ret == -2) { + logging(LOG_NORMAL, "[SKIPPED] READ6 is not implemented."); + CU_PASS("READ6 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 674387b..61d95a5 100644 --- a/test-tool/test_writesame10_wrprotect.c +++ b/test-tool/test_writesame10_wrprotect.c @@ -45,6 +45,11 @@ test_writesame10_wrprotect(void) 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);