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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user