TESTS: Create helpers for PREFETCH16 and switch all tests over to them
This commit is contained in:
@@ -34,6 +34,7 @@ int T0240_prefetch10_simple(const char *initiator, const char *url, int data_los
|
|||||||
printf("Test basic PREFETCH10 functionality.\n");
|
printf("Test basic PREFETCH10 functionality.\n");
|
||||||
printf("1, Verify we can prefetch the first 0-256 blocks of the LUN.\n");
|
printf("1, Verify we can prefetch the first 0-256 blocks of the LUN.\n");
|
||||||
printf("2, Verify we can prefetch the last 0-256 blocks of the LUN.\n");
|
printf("2, Verify we can prefetch the last 0-256 blocks of the LUN.\n");
|
||||||
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ int T0250_prefetch16_simple(const char *initiator, const char *url, int data_los
|
|||||||
printf("===================\n");
|
printf("===================\n");
|
||||||
if (show_info) {
|
if (show_info) {
|
||||||
printf("Test basic PREFETCH16 functionality.\n");
|
printf("Test basic PREFETCH16 functionality.\n");
|
||||||
printf("1, Verify we can prefetch the first 1-256 blocks of the LUN.\n");
|
printf("1, Verify we can prefetch the first 0-256 blocks of the LUN.\n");
|
||||||
printf("2, Verify we can prefetch the last 1-256 blocks of the LUN.\n");
|
printf("2, Verify we can prefetch the last 0-256 blocks of the LUN.\n");
|
||||||
printf("3, Verify we can prefetch the last 256 blocks of the LUN by setting LEN==0.\n");
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -70,80 +69,25 @@ int T0250_prefetch16_simple(const char *initiator, const char *url, int data_los
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* prefetch the first 1 - 256 blocks at the start of the LUN */
|
/* prefetch the first 0 - 256 blocks at the start of the LUN */
|
||||||
printf("Prefetching first 1-256 blocks ... ");
|
printf("Prefetching first 0-256 blocks.\n");
|
||||||
for (i = 1; i <= 256; i++) {
|
for (i = 0; i <= 256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0, i, 0, 0);
|
ret = prefetch16(iscsi, lun, 0, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
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;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test2;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/* Prefetch the last 0 - 255 blocks at the end of the LUN */
|
/* Prefetch the last 0 - 255 blocks at the end of the LUN */
|
||||||
printf("Prefetching last 0-255 blocks ... ");
|
printf("Prefetching last 0-255 blocks.\n");
|
||||||
for (i = 1; i < 256; i++) {
|
for (i = 1; i < 256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks - i, i, 0, 0);
|
ret = prefetch16(iscsi, lun, num_blocks - i, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test3;
|
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test3;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test3:
|
|
||||||
|
|
||||||
printf("Prefetching last 0-255 blocks ... ");
|
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks - 256, 0, 0, 0);
|
|
||||||
if (task == NULL) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test4;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test4;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test4:
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
|
|||||||
@@ -69,56 +69,22 @@ int T0251_prefetch16_flags(const char *initiator, const char *url, int data_loss
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* prefetch with IMMED==1 */
|
/* prefetch with IMMED==1 */
|
||||||
printf("Prefetch with IMMED==1 ... ");
|
printf("Check PREFETCH16 with IMMED==1.\n");
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0, 1, 1, 0);
|
ret = prefetch16(iscsi, lun, 0, 1, 1, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
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;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test2;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/* Prefetch with GROUPNUMBER==0..31 */
|
/* Prefetch with GROUPNUMBER==0..31 */
|
||||||
printf("Prefetching with GROUPNEMBER==0..31 ... ");
|
printf("Check PREFETCH16 with GROUPNEMBER 0-31.\n");
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0, 1, 0, i);
|
ret = prefetch16(iscsi, lun, 0, 1, 0, i);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test3;
|
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test3;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test3:
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
|
|||||||
@@ -72,136 +72,46 @@ int T0252_prefetch16_beyondeol(const char *initiator, const char *url, int data_
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* prefetch 1-256 blocks, one block beyond the end-of-lun */
|
/* prefetch 1-256 blocks, one block beyond the end-of-lun */
|
||||||
printf("Prefetch last 1-256 blocks one block beyond eol ... ");
|
printf("Prefetch last 1-256 blocks one block beyond eol.\n");
|
||||||
for (i = 1; i <= 256; i++) {
|
for (i = 1; i <= 256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks + 2 - i, i, 0, 0);
|
ret = prefetch16_lbaoutofrange(iscsi, lun, num_blocks + 2 - i, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
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;
|
goto finished;
|
||||||
}
|
}
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/* Prefetch 1 - 256 blocks at LBA 2^63 */
|
/* Prefetch 1 - 256 blocks at LBA 2^63 */
|
||||||
printf("Prefetch 1-256 blocks at LBA 2^63 ... ");
|
printf("Prefetch 1-256 blocks at LBA 2^63.\n");
|
||||||
for (i = 1; i <= 256; i++) {
|
for (i = 1; i <= 256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0x8000000000000000, i, 0, 0);
|
ret = prefetch16_lbaoutofrange(iscsi, lun, 0x8000000000000000, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test3;
|
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command should fail for LBA 2^31\n");
|
|
||||||
ret = -1;
|
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
test3:
|
|
||||||
/* prefetch 1 - 256 blocks at LBA -1 */
|
/* prefetch 1 - 256 blocks at LBA -1 */
|
||||||
|
printf("Prefetch 1-256 blocks at LBA -1.\n");
|
||||||
for (i = 1; i <= 256; i++) {
|
for (i = 1; i <= 256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, -1, i, 0, 0);
|
ret = prefetch16_lbaoutofrange(iscsi, lun, -1, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test4;
|
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command should fail for LBA -1\n");
|
|
||||||
ret = -1;
|
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
test4:
|
|
||||||
/* prefetch 2-256 blocks, all but one block beyond the eol */
|
/* prefetch 2-256 blocks, all but one block beyond the eol */
|
||||||
printf("Prefetch 1-255 blocks beyond eol starting at last block ... ");
|
printf("Prefetch 1-255 blocks beyond eol starting at last block.\n");
|
||||||
for (i=2; i<=256; i++) {
|
for (i=2; i<=256; i++) {
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks, i, 0, 0);
|
ret = prefetch16_lbaoutofrange(iscsi, lun, num_blocks, i, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test5;
|
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 beyond end-of-lun did not return sense.\n");
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test5;
|
|
||||||
}
|
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
}
|
}
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
test5:
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
@@ -71,123 +71,38 @@ int T0253_prefetch16_0blocks(const char *initiator, const char *url, int data_lo
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* prefetch 0 blocks at the start of the LUN */
|
|
||||||
printf("PREFETCH16 0blocks at LBA==0 ... ");
|
/* prefetch 0blocks at the start of the LUN */
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0, 0, 0, 0);
|
printf("PREFETCH16 0blocks at LBA==0.\n");
|
||||||
if (task == NULL) {
|
ret = prefetch16(iscsi, lun, 0, 0, 0, 0);
|
||||||
printf("[FAILED]\n");
|
if (ret != 0) {
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
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;
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test2;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
test2:
|
|
||||||
/* Prefetch 0 blocks beyond end of the LUN */
|
/* Prefetch 0 blocks beyond end of the LUN */
|
||||||
printf("PREFETCH16 0blocks at one block beyond <end-of-LUN> ... ");
|
printf("PREFETCH16 0blocks at one block beyond <end-of-LUN>.\n");
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks + 1, 0, 0, 0);
|
ret = prefetch16_lbaoutofrange(iscsi, lun, num_blocks + 1, 0, 0, 0);
|
||||||
if (task == NULL) {
|
if (ret != 0) {
|
||||||
printf("[FAILED]\n");
|
goto finished;
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test3;
|
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command: Should fail when reading 0blocks beyond end\n");
|
|
||||||
ret = -1;
|
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test3:
|
|
||||||
/* Prefetch 0 blocks at 2^63 */
|
|
||||||
printf("PREFETCH16 0blocks at LBA:2^63 ... ");
|
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0x8000000000000000ULL, 0, 0, 0);
|
|
||||||
if (task == NULL) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test4;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command: Should fail when prefetching at LBA 2^63\n");
|
|
||||||
ret = -1;
|
|
||||||
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("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;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test4:
|
/* Prefetch 0blocks at LBA:2^63 */
|
||||||
/* Prefetch 0 blocks at -1 */
|
printf("PREFETCH16 0blocks at LBA:2^63.\n");
|
||||||
printf("PREFETCH16 0blocks at LBA:-1 ... ");
|
ret = prefetch16_lbaoutofrange(iscsi, lun, 0x8000000000000000, 0, 0, 0);
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0xffffffffffffffffULL, 0, 0, 0);
|
if (ret != 0) {
|
||||||
if (task == NULL) {
|
goto finished;
|
||||||
printf("[FAILED]\n");
|
}
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto test5;
|
/* Prefetch 0blocks at LBA:-1 */
|
||||||
|
printf("PREFETCH16 0blocks at LBA:-1.\n");
|
||||||
|
ret = prefetch16_lbaoutofrange(iscsi, lun, 0xffffffffffffffff, 0, 0, 0);
|
||||||
|
if (ret != 0) {
|
||||||
|
goto finished;
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 command: Should fail when prefetching at LBA -1\n");
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto test5;
|
|
||||||
}
|
|
||||||
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("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 test5;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
test5:
|
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
|
|||||||
@@ -353,27 +353,8 @@ int T0370_nomedia(const char *initiator, const char *url, int data_loss, int sho
|
|||||||
prefetch10_nomedium(iscsi, lun, 0, 1, 1, 0);
|
prefetch10_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||||
|
|
||||||
|
|
||||||
printf("Test PREFETCH16 ... ");
|
printf("Test PREFETCH16.\n");
|
||||||
task = iscsi_prefetch16_sync(iscsi, lun, 0, 1, 1, 0);
|
prefetch16_nomedium(iscsi, lun, 0, 1, 1, 0);
|
||||||
if (task == NULL) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("Failed to send PREFETCH16 command: %s\n", iscsi_get_error(iscsi));
|
|
||||||
ret = -1;
|
|
||||||
goto finished;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
|
||||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
|
||||||
printf("[FAILED]\n");
|
|
||||||
printf("PREFETCH16 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT*\n");
|
|
||||||
ret = -1;
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
goto finished;
|
|
||||||
}
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
printf("[OK]\n");
|
|
||||||
|
|
||||||
|
|
||||||
printf("Test VERIFY10 ... ");
|
printf("Test VERIFY10 ... ");
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <popt.h>
|
#include <popt.h>
|
||||||
@@ -802,7 +803,7 @@ int prefetch10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_block
|
|||||||
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
printf("[FAILED]\n");
|
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));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||||
@@ -832,7 +833,7 @@ int prefetch10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|||||||
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
printf("[FAILED]\n");
|
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));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||||
@@ -865,7 +866,7 @@ int prefetch10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int
|
|||||||
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
task = iscsi_prefetch10_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
printf("[FAILED]\n");
|
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));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
||||||
@@ -892,6 +893,104 @@ int prefetch10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int prefetch16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group)
|
||||||
|
{
|
||||||
|
struct scsi_task *task;
|
||||||
|
|
||||||
|
printf("Send PREFETCH16 LBA:%" PRIu64 " Count:%d IMEMD:%d GROUP:%d ... ", lba, num_blocks, immed, group);
|
||||||
|
task = iscsi_prefetch16_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
|
if (task == NULL) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Failed to send PREFETCH16 command: %s\n", 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) {
|
||||||
|
printf("[SKIPPED]\n");
|
||||||
|
printf("PREFETCH16 is not implemented on target\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (task->status != SCSI_STATUS_GOOD) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("PREFETCH16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
printf("[OK]\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int prefetch16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group)
|
||||||
|
{
|
||||||
|
struct scsi_task *task;
|
||||||
|
|
||||||
|
printf("Send PREFETCH16 LBA:%" PRIu64 " Count:%d IMEMD:%d GROUP:%d (expecting ILLEGAL_REQUEST/LBA_OUT_OF_RANGE) ... ", lba, num_blocks, immed, group);
|
||||||
|
task = iscsi_prefetch16_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
|
if (task == NULL) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Failed to send PREFETCH16 command: %s\n", 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) {
|
||||||
|
printf("[SKIPPED]\n");
|
||||||
|
printf("PREFETCH16 is not implemented on target\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
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("PREFETCH16 should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[OK]\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int prefetch16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group)
|
||||||
|
{
|
||||||
|
struct scsi_task *task;
|
||||||
|
|
||||||
|
printf("Send PREFETCH16 LBA:%" PRIu64 " Count:%d IMEMD:%d GROUP:%d (expecting NOT_READY/MEDIUM_NOT_PRESENT) ... ", lba, num_blocks, immed, group);
|
||||||
|
task = iscsi_prefetch16_sync(iscsi, lun, lba, num_blocks, immed, group);
|
||||||
|
if (task == NULL) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Failed to send PREFETCH16 command: %s\n", 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) {
|
||||||
|
printf("[SKIPPED]\n");
|
||||||
|
printf("PREFETCH16 is not implemented on target\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
||||||
|
|| task->sense.key != SCSI_SENSE_NOT_READY
|
||||||
|
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
||||||
|
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
||||||
|
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("PREFETCH16 after eject failed with the wrong sense code. Should fail with NOT_READY/MEDIUM_NOT_PRESENT*\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[OK]\n");
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -258,5 +258,8 @@ int testunitready_conflict(struct iscsi_context *iscsi, int lun);
|
|||||||
int prefetch10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
int prefetch10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||||
int prefetch10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
int prefetch10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||||
int prefetch10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
int prefetch10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group);
|
||||||
|
int prefetch16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group);
|
||||||
|
int prefetch16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group);
|
||||||
|
int prefetch16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group);
|
||||||
|
|
||||||
#endif /* _ISCSI_TEST_H_ */
|
#endif /* _ISCSI_TEST_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user