From ca3ac9cafdedc11218ffd066c0446b3788c7e99a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 10 Sep 2012 08:38:21 -0700 Subject: [PATCH] TESTS: Improve error reporting for *beyondeol* tests Beyondeol tests: Add missing checks for optional opcodes to SKIP tests where the target does not implement the opcode. Improve the error reporting and make sure we always show the Sense we received from the target when we get an unexpected error. Check the size of the LUN and skip the test for luns that are too big. For example skip testing READ10 on LUNs > 2^31 blocks etc. --- test-tool/0101_read10_beyond_eol.c | 37 +++++++------ test-tool/0121_read6_beyond_eol.c | 54 ++++++++++--------- test-tool/0133_verify10_beyondeol.c | 12 ++++- test-tool/0182_writesame10_beyondeol.c | 25 +++++---- test-tool/0192_writesame16_beyondeol.c | 8 +-- test-tool/0204_read16_beyondeol.c | 8 +-- test-tool/0214_read12_beyondeol.c | 20 ++++--- test-tool/0224_write16_beyondeol.c | 2 +- test-tool/0234_write12_beyondeol.c | 10 +++- test-tool/0242_prefetch10_beyondeol.c | 17 ++++-- test-tool/0252_prefetch16_beyondeol.c | 8 +-- test-tool/0264_get_lba_status_beyondeol.c | 8 +-- test-tool/0273_verify16_beyondeol.c | 20 +++---- test-tool/0283_verify12_beyondeol.c | 12 ++++- test-tool/0294_write10_beyondeol.c | 16 ++++-- test-tool/0314_writeverify10_beyondeol.c | 62 ++++++++++++++++++---- test-tool/0324_writeverify12_beyondeol.c | 60 ++++++++++++++++++--- test-tool/0334_writeverify16_beyondeol.c | 50 ++++++++++++++--- test-tool/0343_compareandwrite_beyondeol.c | 39 +++++++++++--- test-tool/0354_orwrite_beyondeol.c | 48 ++++++++++++++--- 20 files changed, 375 insertions(+), 141 deletions(-) diff --git a/test-tool/0101_read10_beyond_eol.c b/test-tool/0101_read10_beyond_eol.c index a753010..bfbb33b 100644 --- a/test-tool/0101_read10_beyond_eol.c +++ b/test-tool/0101_read10_beyond_eol.c @@ -31,10 +31,11 @@ int T0101_read10_beyond_eol(const char *initiator, const char *url, int data_los printf("0101_read10_beyond_eol:\n"); printf("=======================\n"); if (show_info) { - printf("Test that READ10 fails if reading beyond end-of-lun.\n"); + printf("Test that READ10 fails when reading beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Read 1-256 blocks one block beyond end-of-lun.\n"); - printf("2, Read 1-256 blocks at LBA 2^31 (only on LUNs < 1TB)\n"); - printf("3, Read 1-256 blocks at LBA -1 (only on LUN < 2TB)\n"); + printf("2, Read 1-256 blocks at LBA 2^31\n"); + printf("3, Read 1-256 blocks at LBA -1\n"); printf("4, Read 2-256 blocks all but one beyond end-of-lun.\n"); printf("\n"); return 0; @@ -49,19 +50,19 @@ int T0101_read10_beyond_eol(const char *initiator, const char *url, int data_los /* find the size of the LUN */ task = iscsi_readcapacity10_sync(iscsi, lun, 0, 0); if (task == NULL) { - printf("Failed to send readcapacity10 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READCAPACITY10 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status != SCSI_STATUS_GOOD) { - printf("Readcapacity command: failed with sense. %s\n", iscsi_get_error(iscsi)); + printf("READCAPACITY10 command: failed with sense. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; } rc10 = scsi_datain_unmarshall(task); if (rc10 == NULL) { - printf("failed to unmarshall readcapacity10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -71,9 +72,15 @@ int T0101_read10_beyond_eol(const char *initiator, const char *url, int data_los scsi_free_scsi_task(task); - ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with READ10. Skipping test.\n"); + ret = -2; + goto finished; + } + /* read 1-256 blocks, one block beyond the end-of-lun */ printf("Reading last 1-256 blocks one block beyond eol ... "); for (i=1; i<=256; i++) { @@ -95,7 +102,7 @@ int T0101_read10_beyond_eol(const char *initiator, const char *url, int data_los || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -107,10 +114,6 @@ int T0101_read10_beyond_eol(const char *initiator, const char *url, int data_los test2: /* Reading 1 - 256 blocks at LBA 2^31 */ printf("Reaing 1-256 blocks at LBA 2^31 ... "); - if (num_blocks > 0x80000000) { - printf("LUN is too big, skipping test\n"); - goto test3; - } for (i = 1; i <= 256; i++) { task = iscsi_read10_sync(iscsi, lun, 0x80000000, i * block_size, block_size, 0, 0, 0, 0, 0); if (task == NULL) { @@ -130,7 +133,7 @@ test2: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test3; @@ -143,10 +146,6 @@ test2: test3: /* read 1 - 256 blocks at LBA -1 */ printf("Read 1-256 blocks at LBA -1 ... "); - if (num_blocks > 0x80000000) { - printf("LUN is too big, skipping test\n"); - goto test4; - } for (i = 1; i <= 256; i++) { task = iscsi_read10_sync(iscsi, lun, -1, i * block_size, block_size, 0, 0, 0, 0, 0); if (task == NULL) { @@ -166,7 +165,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test4; @@ -198,7 +197,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0121_read6_beyond_eol.c b/test-tool/0121_read6_beyond_eol.c index f5cee95..bba83cb 100644 --- a/test-tool/0121_read6_beyond_eol.c +++ b/test-tool/0121_read6_beyond_eol.c @@ -32,6 +32,7 @@ int T0121_read6_beyond_eol(const char *initiator, const char *url, int data_loss printf("======================\n"); if (show_info) { printf("Test that READ6 fails if reading beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^20 blocks\n"); printf("1, Read 1-256 blocks one block beyond end-of-lun.\n"); printf("2, Read 2-256 blocks all but one beyond end-of-lun.\n"); printf("3, Read 0(==256) blocks 128 blocks beyond end-of-lun.\n"); @@ -48,19 +49,19 @@ int T0121_read6_beyond_eol(const char *initiator, const char *url, int data_loss /* find the size of the LUN */ task = iscsi_readcapacity10_sync(iscsi, lun, 0, 0); if (task == NULL) { - printf("Failed to send readcapacity10 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READCAPACITY10 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status != SCSI_STATUS_GOOD) { - printf("Readcapacity command: failed with sense. %s\n", iscsi_get_error(iscsi)); + printf("READCAPACITY10 command: failed with sense. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; } rc10 = scsi_datain_unmarshall(task); if (rc10 == NULL) { - printf("failed to unmarshall readcapacity10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -73,7 +74,8 @@ int T0121_read6_beyond_eol(const char *initiator, const char *url, int data_loss if (num_blocks > 0x1fffff) { printf("[SKIPPED]\n"); - printf("Lun is too big for read-beyond-eol tests with read6\n"); + printf("LUN is too big for read-beyond-eol tests with READ6. Skipping test.\n"); + ret = -2; goto finished; } @@ -84,100 +86,100 @@ int T0121_read6_beyond_eol(const char *initiator, const char *url, int data_loss task = iscsi_read6_sync(iscsi, lun, num_blocks + 2 - i, i * block_size, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send read6 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READ6 command: %s\n", iscsi_get_error(iscsi)); ret = -1; - goto test_2; + goto test2; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not fail with sense.\n"); + printf("READ6 beyond end-of-lun did not fail with sense.\n"); ret = -1; scsi_free_scsi_task(task); - goto test_2; + goto test2; } if (task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST.\n"); + printf("READ6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); - goto test_2; + goto test2; } if (task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE.\n"); + printf("READ6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); - goto test_2; + goto test2; } scsi_free_scsi_task(task); } printf("[OK]\n"); -test_2: +test2: /* read 2-256 blocks, all but one block beyond the eol */ printf("Reading 1-255 blocks beyond eol starting at last block ... "); for (i=2; i<=256; i++) { task = iscsi_read6_sync(iscsi, lun, num_blocks, i * block_size, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send read6 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READ6 command: %s\n", iscsi_get_error(iscsi)); ret = -1; - goto test_3; + goto test3; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense.\n"); + printf("READ6 beyond end-of-lun did not return sense.\n"); ret = -1; scsi_free_scsi_task(task); - goto test_3; + goto test3; } if (task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST.\n"); + printf("READ6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); - goto test_3; + goto test3; } if (task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE.\n"); + printf("READ6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); - goto test_3; + goto test3; } scsi_free_scsi_task(task); } printf("[OK]\n"); -test_3: +test3: /* read 0 (==256) blocks 128 blocks from eol */ printf("Reading 0(==256) blocks beyond eol starting at 128 blocks before eol ... "); task = iscsi_read6_sync(iscsi, lun, num_blocks-128, i * block_size, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send read6 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READ6 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense.\n"); + printf("READ6 beyond end-of-lun did not return sense.\n"); ret = -1; scsi_free_scsi_task(task); goto finished; } if (task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST.\n"); + printf("READ6 beyond end-of-lun did not return sense key ILLEGAL_REQUEST. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; } if (task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("Read6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE.\n"); + printf("READ6 beyond end-of-lun did not return sense ascq LBA OUT OF RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; diff --git a/test-tool/0133_verify10_beyondeol.c b/test-tool/0133_verify10_beyondeol.c index 2d327a8..14f44d9 100644 --- a/test-tool/0133_verify10_beyondeol.c +++ b/test-tool/0133_verify10_beyondeol.c @@ -34,6 +34,7 @@ int T0133_verify10_beyondeol(const char *initiator, const char *url, int data_lo printf("========================\n"); if (show_info) { printf("Test that VERIFY10 fails if reading beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Verify 2-256 blocks one block beyond end-of-lun.\n"); printf("\n"); return 0; @@ -73,19 +74,26 @@ int T0133_verify10_beyondeol(const char *initiator, const char *url, int data_lo ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with VERIFY10. Skipping test.\n"); + ret = -2; + goto finished; + } + /* verify 2 - 256 blocks beyond the end of the device */ printf("Verifying 2-256 blocks beyond end-of-device ... "); for (i = 2; i <= 256; i++) { task = iscsi_verify10_sync(iscsi, lun, buf, i * block_size, num_blocks, 0, 1, 1, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send verify10 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send VERIFY10 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto test2; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Verify10 command should fail when reading beyond end of device\n"); + printf("VERIFY10 command should fail when reading beyond end of device\n"); ret = -1; scsi_free_scsi_task(task); goto test2; diff --git a/test-tool/0182_writesame10_beyondeol.c b/test-tool/0182_writesame10_beyondeol.c index c91e6fd..281eeae 100644 --- a/test-tool/0182_writesame10_beyondeol.c +++ b/test-tool/0182_writesame10_beyondeol.c @@ -34,9 +34,10 @@ int T0182_writesame10_beyondeol(const char *initiator, const char *url, int data printf("=======================\n"); if (show_info) { printf("Test that WRITESAME10 fails if writing beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Write 1-256 blocks one block beyond end-of-lun.\n"); - printf("2, Write 1-256 blocks at LBA 2^31 (only on LUNs < 2TB)\n"); - printf("3, Write 1-256 blocks at LBA -1 (only on LUN < 2TB)\n"); + printf("2, Write 1-256 blocks at LBA 2^31\n"); + printf("3, Write 1-256 blocks at LBA -1\n"); printf("\n"); return 0; } @@ -80,6 +81,12 @@ int T0182_writesame10_beyondeol(const char *initiator, const char *url, int data ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with WRITESAME10. Skipping test.\n"); + ret = -2; + goto finished; + } /* write 1 - 256 blocks beyond the end of the device */ printf("Writing 1-256 blocks beyond end-of-device ... "); @@ -112,7 +119,7 @@ int T0182_writesame10_beyondeol(const char *initiator, const char *url, int data || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -125,10 +132,6 @@ int T0182_writesame10_beyondeol(const char *initiator, const char *url, int data test2: /* writing 1 - 256 blocks at LBA 2^31 */ printf("Writing 1-256 blocks at LBA 2^31 ... "); - if (num_blocks > 0x80000000) { - printf("LUN is too big, skipping test\n"); - goto test3; - } for (i = 1; i <= 256; i++) { task = iscsi_writesame10_sync(iscsi, lun, buf, block_size, 0x80000000, i, 0, 0, 0, 0, 0, 0); @@ -149,7 +152,7 @@ test2: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test3; @@ -162,10 +165,6 @@ test2: test3: /* write 1 - 256 blocks at LBA -1 */ printf("Writing 1-256 blocks at LBA -1 ... "); - if (num_blocks > 0x80000000) { - printf("LUN is too big, skipping test\n"); - goto test4; - } for (i = 1; i <= 256; i++) { task = iscsi_writesame10_sync(iscsi, lun, buf, block_size, -1, i, 0, 0, 0, 0, 0, 0); @@ -186,7 +185,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test4; diff --git a/test-tool/0192_writesame16_beyondeol.c b/test-tool/0192_writesame16_beyondeol.c index 0bf5af6..91476ce 100644 --- a/test-tool/0192_writesame16_beyondeol.c +++ b/test-tool/0192_writesame16_beyondeol.c @@ -62,7 +62,7 @@ int T0192_writesame16_beyondeol(const char *initiator, const char *url, int data } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -111,7 +111,7 @@ int T0192_writesame16_beyondeol(const char *initiator, const char *url, int data || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -144,7 +144,7 @@ test2: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test3; @@ -177,7 +177,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITESAME16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test4; diff --git a/test-tool/0204_read16_beyondeol.c b/test-tool/0204_read16_beyondeol.c index 7baaf8e..b81ddec 100644 --- a/test-tool/0204_read16_beyondeol.c +++ b/test-tool/0204_read16_beyondeol.c @@ -61,7 +61,7 @@ int T0204_read16_beyondeol(const char *initiator, const char *url, int data_loss } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -95,7 +95,7 @@ int T0204_read16_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -125,7 +125,7 @@ int T0204_read16_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -155,7 +155,7 @@ int T0204_read16_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; diff --git a/test-tool/0214_read12_beyondeol.c b/test-tool/0214_read12_beyondeol.c index 0e00740..aee94f1 100644 --- a/test-tool/0214_read12_beyondeol.c +++ b/test-tool/0214_read12_beyondeol.c @@ -33,9 +33,10 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss printf("=======================\n"); if (show_info) { printf("Test that READ12 fails if reading beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Read 1-256 blocks one block beyond end-of-lun.\n"); - printf("2, Read 1-256 blocks at LBA 2^31 (Only on LUN < 1TB)\n"); - printf("2, Read 1-256 blocks at LBA -1 (Only on LUN < 2TB)\n"); + printf("2, Read 1-256 blocks at LBA 2^31\n"); + printf("2, Read 1-256 blocks at LBA -1\n"); printf("\n"); return 0; } @@ -61,7 +62,7 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -74,6 +75,13 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with READ12. Skipping test.\n"); + ret = -2; + goto finished; + } + /* read 1 - 256 blocks beyond the end of the device */ printf("Reading 1-256 blocks beyond end-of-device ... "); for (i = 2; i <= 257; i++) { @@ -95,7 +103,7 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret++; scsi_free_scsi_task(task); goto test2; @@ -131,7 +139,7 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret++; scsi_free_scsi_task(task); goto test3; @@ -166,7 +174,7 @@ int T0214_read12_beyondeol(const char *initiator, const char *url, int data_loss || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("READ12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret++; scsi_free_scsi_task(task); goto test4; diff --git a/test-tool/0224_write16_beyondeol.c b/test-tool/0224_write16_beyondeol.c index 8443baa..c588190 100644 --- a/test-tool/0224_write16_beyondeol.c +++ b/test-tool/0224_write16_beyondeol.c @@ -60,7 +60,7 @@ int T0224_write16_beyondeol(const char *initiator, const char *url, int data_los } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; diff --git a/test-tool/0234_write12_beyondeol.c b/test-tool/0234_write12_beyondeol.c index 18cb522..eb6503a 100644 --- a/test-tool/0234_write12_beyondeol.c +++ b/test-tool/0234_write12_beyondeol.c @@ -34,6 +34,7 @@ int T0234_write12_beyondeol(const char *initiator, const char *url, int data_los printf("=======================\n"); if (show_info) { printf("Test that WRITE12 fails if writing beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Writing 1-256 blocks beyond end-of-lun should fail.\n"); printf("\n"); return 0; @@ -60,7 +61,7 @@ int T0234_write12_beyondeol(const char *initiator, const char *url, int data_los } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -78,6 +79,13 @@ int T0234_write12_beyondeol(const char *initiator, const char *url, int data_los ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with WRITE12. Skipping test.\n"); + ret = -2; + goto finished; + } + /* read 1 - 256 blocks beyond the end of the device */ printf("Writing 1-256 blocks beyond end-of-device ... "); for (i = 2; i <= 257; i++) { diff --git a/test-tool/0242_prefetch10_beyondeol.c b/test-tool/0242_prefetch10_beyondeol.c index 362f18c..ffccdc7 100644 --- a/test-tool/0242_prefetch10_beyondeol.c +++ b/test-tool/0242_prefetch10_beyondeol.c @@ -32,6 +32,7 @@ int T0242_prefetch10_beyondeol(const char *initiator, const char *url, int data_ printf("===================\n"); if (show_info) { printf("Test PREFETCH10 for blocks beyond the EOL.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Prefetch 1-256 blocks one block beyond end-of-lun.\n"); printf("2, Prefetch 1-256 blocks at LBA 2^31 (only on LUNs < 1TB)\n"); printf("3, Prefetch 1-256 blocks at LBA -1 (only on LUN < 2TB)\n"); @@ -72,6 +73,12 @@ int T0242_prefetch10_beyondeol(const char *initiator, const char *url, int data_ ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with PREFETCH10. Skipping test.\n"); + ret = -2; + goto finished; + } /* prefetch 1-256 blocks, one block beyond the end-of-lun */ printf("Prefetch last 1-256 blocks one block beyond eol ... "); @@ -79,7 +86,7 @@ int T0242_prefetch10_beyondeol(const char *initiator, const char *url, int data_ task = iscsi_prefetch10_sync(iscsi, lun, num_blocks + 2 - i, i, 0, 0); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send prefetch10 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send PREFETCH10 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto test2; } @@ -96,7 +103,7 @@ int T0242_prefetch10_beyondeol(const char *initiator, const char *url, int data_ || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -131,7 +138,7 @@ test2: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test3; @@ -167,7 +174,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH10 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test4; @@ -199,7 +206,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0252_prefetch16_beyondeol.c b/test-tool/0252_prefetch16_beyondeol.c index cffe9e4..27767d1 100644 --- a/test-tool/0252_prefetch16_beyondeol.c +++ b/test-tool/0252_prefetch16_beyondeol.c @@ -96,7 +96,7 @@ int T0252_prefetch16_beyondeol(const char *initiator, const char *url, int data_ || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -127,7 +127,7 @@ test2: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test3; @@ -158,7 +158,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test4; @@ -190,7 +190,7 @@ test3: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("PREFETCH16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("PREFETCH16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0264_get_lba_status_beyondeol.c b/test-tool/0264_get_lba_status_beyondeol.c index ed6723d..3fa39e0 100644 --- a/test-tool/0264_get_lba_status_beyondeol.c +++ b/test-tool/0264_get_lba_status_beyondeol.c @@ -46,19 +46,19 @@ int T0264_get_lba_status_beyondeol(const char *initiator, const char *url, int d /* find the size of the LUN */ task = iscsi_readcapacity16_sync(iscsi, lun); if (task == NULL) { - printf("Failed to send readcapacity16 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send READCAPACITY16 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status != SCSI_STATUS_GOOD) { - printf("Readcapacity command: failed with sense. %s\n", iscsi_get_error(iscsi)); + printf("READCAPACITY16 command: failed with sense. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall readcapacity16 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -97,7 +97,7 @@ int T0264_get_lba_status_beyondeol(const char *initiator, const char *url, int d || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("GET_LBA_STATUS failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("GET_LBA_STATUS failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; diff --git a/test-tool/0273_verify16_beyondeol.c b/test-tool/0273_verify16_beyondeol.c index 4d9de99..083aff9 100644 --- a/test-tool/0273_verify16_beyondeol.c +++ b/test-tool/0273_verify16_beyondeol.c @@ -62,7 +62,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -81,7 +81,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo task = iscsi_verify16_sync(iscsi, lun, buf, i * block_size, num_blocks, 0, 1, 1, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send verify16 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } @@ -96,7 +96,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Verify16 command should fail when reading beyond end of device\n"); + printf("VERIFY16 command should fail when reading beyond end of device\n"); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -105,7 +105,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -120,13 +120,13 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo task = iscsi_verify16_sync(iscsi, lun, buf, i * block_size, 0x8000000000000000ULL, 0, 1, 1, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send verify16 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Verify16 command should fail when reading at LBA 2^63\n"); + printf("VERIFY16 command should fail when reading at LBA 2^63\n"); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -135,7 +135,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -150,13 +150,13 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo task = iscsi_verify16_sync(iscsi, lun, buf, i * block_size, -1LL, 0, 1, 1, block_size); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send verify16 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send VERIFY16 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto test2; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("verify16 command should fail when reading at LBA -1\n"); + printf("VERIFY16 command should fail when reading at LBA -1\n"); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -165,7 +165,7 @@ int T0273_verify16_beyondeol(const char *initiator, const char *url, int data_lo || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("VERIFY16 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; diff --git a/test-tool/0283_verify12_beyondeol.c b/test-tool/0283_verify12_beyondeol.c index 525b7b2..480e672 100644 --- a/test-tool/0283_verify12_beyondeol.c +++ b/test-tool/0283_verify12_beyondeol.c @@ -34,6 +34,7 @@ int T0283_verify12_beyondeol(const char *initiator, const char *url, int data_lo printf("========================\n"); if (show_info) { printf("Test that VERIFY12 fails if reading beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Verify 2-256 blocks one block beyond end-of-lun.\n"); printf("\n"); return 0; @@ -73,6 +74,13 @@ int T0283_verify12_beyondeol(const char *initiator, const char *url, int data_lo ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with VERIFY12. Skipping test.\n"); + ret = -2; + goto finished; + } + /* verify 2 - 256 blocks beyond the end of the device */ printf("Verifying 2-256 blocks beyond end-of-device ... "); for (i = 2; i <= 256; i++) { @@ -94,7 +102,7 @@ int T0283_verify12_beyondeol(const char *initiator, const char *url, int data_lo } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Verify12 command should fail when reading beyond end of device\n"); + printf("VERIFY12 command should fail when reading beyond end of device\n"); ret = -1; scsi_free_scsi_task(task); goto test2; @@ -103,7 +111,7 @@ int T0283_verify12_beyondeol(const char *initiator, const char *url, int data_lo || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("VERIFY12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("VERIFY12 failed but with the wrong sense code. It should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test2; diff --git a/test-tool/0294_write10_beyondeol.c b/test-tool/0294_write10_beyondeol.c index 7cae7b9..e736382 100644 --- a/test-tool/0294_write10_beyondeol.c +++ b/test-tool/0294_write10_beyondeol.c @@ -34,6 +34,7 @@ int T0294_write10_beyondeol(const char *initiator, const char *url, int data_los printf("=======================\n"); if (show_info) { printf("Test that WRITE10 fails if writing beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Writing 1-256 blocks beyond end-of-lun should fail.\n"); printf("\n"); return 0; @@ -60,7 +61,7 @@ int T0294_write10_beyondeol(const char *initiator, const char *url, int data_los } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -78,19 +79,26 @@ int T0294_write10_beyondeol(const char *initiator, const char *url, int data_los ret = 0; - /* read 1 - 256 blocks beyond the end of the device */ + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with WRITE10. Skipping test.\n"); + ret = -2; + goto finished; + } + + /* write 1 - 256 blocks beyond the end of the device */ printf("Writing 1-256 blocks beyond end-of-device ... "); for (i = 2; i <= 257; i++) { task = iscsi_write10_sync(iscsi, lun, num_blocks, data, i * block_size, block_size, 0, 0, 0, 0, 0); if (task == NULL) { printf("[FAILED]\n"); - printf("Failed to send write10 command: %s\n", iscsi_get_error(iscsi)); + printf("Failed to send WRITE10 command: %s\n", iscsi_get_error(iscsi)); ret = -1; goto finished; } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("Write10 command should fail when writing beyond end of device\n"); + printf("WRITE10 command should fail when writing beyond end of device\n"); ret = -1; scsi_free_scsi_task(task); goto finished; diff --git a/test-tool/0314_writeverify10_beyondeol.c b/test-tool/0314_writeverify10_beyondeol.c index d52f149..d4f352c 100644 --- a/test-tool/0314_writeverify10_beyondeol.c +++ b/test-tool/0314_writeverify10_beyondeol.c @@ -34,9 +34,10 @@ int T0314_writeverify10_beyondeol(const char *initiator, const char *url, int da printf("=======================\n"); if (show_info) { printf("Test that WRITEVERIFY10 fails if writing beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Writing 1-256 blocks with one block beyond end-of-lun should fail.\n"); - printf("2, Writing 1-256 blocks at LBA 2^31 should fail. (Only on LUN < 1TB)\n"); - printf("3, Writing 1-256 blocks at LBA -1 should fail. (Only on LUN < 2TB)\n"); + printf("2, Writing 1-256 blocks at LBA 2^31 should fail.\n"); + printf("3, Writing 1-256 blocks at LBA -1 should fail.\n"); printf("4, Writing 1-256 blocks all but one block beyond eol\n"); printf("\n"); return 0; @@ -63,7 +64,7 @@ int T0314_writeverify10_beyondeol(const char *initiator, const char *url, int da } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -81,7 +82,14 @@ int T0314_writeverify10_beyondeol(const char *initiator, const char *url, int da ret = 0; - /* read 1 - 256 blocks beyond the end of the device */ + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with WRITEVERIFY10. Skipping test.\n"); + ret = -2; + goto finished; + } + + /* write+verify 1 - 256 blocks beyond the end of the device */ printf("Writing 1-256 blocks with one block beyond end-of-device ... "); for (i = 1; i <= 256; i++) { task = iscsi_writeverify10_sync(iscsi, lun, num_blocks + 2 - i, data, i * block_size, block_size, 0, 0, 0, 0); @@ -91,13 +99,31 @@ int T0314_writeverify10_beyondeol(const char *initiator, const char *url, int da ret++; goto test2; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + printf("[SKIPPED]\n"); + printf("Opcode is not implemented on target\n"); + scsi_free_scsi_task(task); + ret = -2; + goto finished; + } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY10 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY10 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test2; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test2; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -120,11 +146,20 @@ test2: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY10 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY10 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test3; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test3; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -147,11 +182,20 @@ test3: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY10 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY10 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test4; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test4; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -169,7 +213,7 @@ test4: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY10 beyond end-of-lun did not return sense.\n"); + printf("WRITEVERIFY10 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; @@ -178,7 +222,7 @@ test4: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITEVERIFY10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITEVERIFY10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0324_writeverify12_beyondeol.c b/test-tool/0324_writeverify12_beyondeol.c index 90dbed8..8af040d 100644 --- a/test-tool/0324_writeverify12_beyondeol.c +++ b/test-tool/0324_writeverify12_beyondeol.c @@ -34,9 +34,10 @@ int T0324_writeverify12_beyondeol(const char *initiator, const char *url, int da printf("=======================\n"); if (show_info) { printf("Test that WRITEVERIFY12 fails if writing beyond end-of-lun.\n"); + printf("This test is skipped for LUNs with more than 2^31 blocks\n"); printf("1, Writing 1-256 blocks with one block beyond end-of-lun should fail.\n"); - printf("2, Writing 1-256 blocks at LBA 2^31 should fail. (Only on LUN < 1TB)\n"); - printf("3, Writing 1-256 blocks at LBA -1 should fail. (Only on LUN < 2TB)\n"); + printf("2, Writing 1-256 blocks at LBA 2^31 should fail.\n"); + printf("3, Writing 1-256 blocks at LBA -1 should fail.\n"); printf("4, Writing 1-256 blocks all but one block beyond eol\n"); printf("\n"); return 0; @@ -63,7 +64,7 @@ int T0324_writeverify12_beyondeol(const char *initiator, const char *url, int da } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -81,6 +82,13 @@ int T0324_writeverify12_beyondeol(const char *initiator, const char *url, int da ret = 0; + if (num_blocks >= 0x80000000) { + printf("[SKIPPED]\n"); + printf("LUN is too big for read-beyond-eol tests with WRITEVERIFY12. Skipping test.\n"); + ret = -2; + goto finished; + } + /* read 1 - 256 blocks beyond the end of the device */ printf("Writing 1-256 blocks with one block beyond end-of-device ... "); for (i = 1; i <= 256; i++) { @@ -91,13 +99,31 @@ int T0324_writeverify12_beyondeol(const char *initiator, const char *url, int da ret++; goto test2; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + printf("[SKIPPED]\n"); + printf("Opcode is not implemented on target\n"); + scsi_free_scsi_task(task); + ret = -2; + goto finished; + } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY12 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY12 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test2; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY12 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test2; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -120,11 +146,20 @@ test2: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY12 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY12 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test3; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY12 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test3; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -147,11 +182,20 @@ test3: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY12 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY12 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test4; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY12 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test4; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -169,7 +213,7 @@ test4: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY12 beyond end-of-lun did not return sense.\n"); + printf("WRITEVERIFY12 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; @@ -178,7 +222,7 @@ test4: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITEVERIFY12 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITEVERIFY12 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0334_writeverify16_beyondeol.c b/test-tool/0334_writeverify16_beyondeol.c index 5c43fb0..3869619 100644 --- a/test-tool/0334_writeverify16_beyondeol.c +++ b/test-tool/0334_writeverify16_beyondeol.c @@ -33,7 +33,7 @@ int T0334_writeverify16_beyondeol(const char *initiator, const char *url, int da printf("0334_writeverify16_beyond_eol:\n"); printf("=======================\n"); if (show_info) { - printf("Test that WRITEVERIFY10 fails if writing beyond end-of-lun.\n"); + printf("Test that WRITEVERIFY16 fails if writing beyond end-of-lun.\n"); printf("1, Writing 1-256 blocks with one block beyond end-of-lun should fail.\n"); printf("2, Writing 1-256 blocks at LBA 2^63 should fail.\n"); printf("3, Writing 1-256 blocks at LBA -1 should fail.\n"); @@ -63,7 +63,7 @@ int T0334_writeverify16_beyondeol(const char *initiator, const char *url, int da } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -91,13 +91,31 @@ int T0334_writeverify16_beyondeol(const char *initiator, const char *url, int da ret++; goto test2; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + printf("[SKIPPED]\n"); + printf("Opcode is not implemented on target\n"); + scsi_free_scsi_task(task); + ret = -2; + goto finished; + } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY16 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY16 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test2; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test2; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -116,11 +134,20 @@ test2: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY16 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY16 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test3; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test3; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -139,11 +166,20 @@ test3: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY16 command should fail when writing beyond end of device\n"); + printf("WRITEVERIFY16 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test4; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("WRITEVERIFY16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test4; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -161,7 +197,7 @@ test4: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("WRITEVERIFY16 beyond end-of-lun did not return sense.\n"); + printf("WRITEVERIFY16 beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; @@ -170,7 +206,7 @@ test4: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("WRITEVERIFY16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("WRITEVERIFY16 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0343_compareandwrite_beyondeol.c b/test-tool/0343_compareandwrite_beyondeol.c index ab4e59b..6c0c5e7 100644 --- a/test-tool/0343_compareandwrite_beyondeol.c +++ b/test-tool/0343_compareandwrite_beyondeol.c @@ -63,7 +63,7 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -102,11 +102,20 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("COMPAREANDWRITE command should fail when writing beyond end of device\n"); + printf("COMPAREANDWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test2; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("COMPAREANDWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test2; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -125,11 +134,20 @@ test2: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("COMPAREANDWRITE command should fail when writing beyond end of device\n"); + printf("COMPAREANDWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test3; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("COMPAREANDWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test3; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -148,11 +166,20 @@ test3: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("COMPAREANDWRITE command should fail when writing beyond end of device\n"); + printf("COMPAREANDWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test4; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("COMPAREANDWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test4; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -170,7 +197,7 @@ test4: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("COMPAREANDWRITE beyond end-of-lun did not return sense.\n"); + printf("COMPAREANDWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; @@ -179,7 +206,7 @@ test4: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("COMPAREANDWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("COMPAREANDWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5; diff --git a/test-tool/0354_orwrite_beyondeol.c b/test-tool/0354_orwrite_beyondeol.c index e358040..26b5bd1 100644 --- a/test-tool/0354_orwrite_beyondeol.c +++ b/test-tool/0354_orwrite_beyondeol.c @@ -63,7 +63,7 @@ int T0354_orwrite_beyondeol(const char *initiator, const char *url, int data_los } rc16 = scsi_datain_unmarshall(task); if (rc16 == NULL) { - printf("failed to unmarshall READCAPACITY10 data. %s\n", iscsi_get_error(iscsi)); + printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto finished; @@ -91,13 +91,31 @@ int T0354_orwrite_beyondeol(const char *initiator, const char *url, int data_los ret++; goto test2; } + if (task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST + && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) { + printf("[SKIPPED]\n"); + printf("Opcode is not implemented on target\n"); + scsi_free_scsi_task(task); + ret = -2; + goto finished; + } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("ORWRITE command should fail when writing beyond end of device\n"); + printf("ORWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test2; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("ORWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test2; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -116,11 +134,20 @@ test2: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("ORWRITE command should fail when writing beyond end of device\n"); + printf("ORWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test3; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("ORWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test3; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -139,11 +166,20 @@ test3: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("ORWRITE command should fail when writing beyond end of device\n"); + printf("ORWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret++; scsi_free_scsi_task(task); goto test4; } + if (task->status != SCSI_STATUS_CHECK_CONDITION + || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST + || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { + printf("[FAILED]\n"); + printf("ORWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); + ret = -1; + scsi_free_scsi_task(task); + goto test4; + } scsi_free_scsi_task(task); } printf("[OK]\n"); @@ -161,7 +197,7 @@ test4: } if (task->status == SCSI_STATUS_GOOD) { printf("[FAILED]\n"); - printf("ORWRITE beyond end-of-lun did not return sense.\n"); + printf("ORWRITE beyond end-of-lun did not return sense. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); ret = -1; scsi_free_scsi_task(task); goto test5; @@ -170,7 +206,7 @@ test4: || task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST || task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) { printf("[FAILED]\n"); - printf("ORWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n"); + printf("ORWRITE failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi)); ret = -1; scsi_free_scsi_task(task); goto test5;