TESTS: Improve tests for reading at LBA -1
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -35,7 +35,7 @@ int T0102_read10_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
printf("1, Read at LBA:0 should work.\n");
|
printf("1, Read at LBA:0 should work.\n");
|
||||||
printf("2, Read at LBA:end-of-lun+1 should fail.\n");
|
printf("2, Read at LBA:end-of-lun+1 should fail.\n");
|
||||||
printf("3, Read at LBA:end-of-lun+2 should fail.\n");
|
printf("3, Read at LBA:end-of-lun+2 should fail.\n");
|
||||||
printf("4, Read at LBA:-1 should fail.\n");
|
printf("4, Read at LBA:-1 should fail. (only test this if the device is < 2TB)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,10 @@ int T0102_read10_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
|
||||||
/* read10 0 at lba -1 */
|
/* read10 0 at lba -1, only do this if the device is < 2TB */
|
||||||
|
if (num_blocks == 0xffffffff) {
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
printf("Reading 0 blocks at lba:-1 ... ");
|
printf("Reading 0 blocks at lba:-1 ... ");
|
||||||
task = iscsi_read10_sync(iscsi, lun, 0xffffff, 0, block_size);
|
task = iscsi_read10_sync(iscsi, lun, 0xffffff, 0, block_size);
|
||||||
if (task == NULL) {
|
if (task == NULL) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ int T0203_read16_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
printf("1, Read at 0 should work.\n");
|
printf("1, Read at 0 should work.\n");
|
||||||
printf("2, Read at end-of-lun should work.\n");
|
printf("2, Read at end-of-lun should work.\n");
|
||||||
printf("3, Read beyond end-of-lun should fail.\n");
|
printf("3, Read beyond end-of-lun should fail.\n");
|
||||||
|
printf("4, Read at LBA -1 should fail.\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -123,6 +124,23 @@ int T0203_read16_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
printf("Read16 0blocks at LBA:-1 ");
|
||||||
|
task = iscsi_read16_sync(iscsi, lun, -1, 0, block_size, 0, 0, 0, 0, 0);
|
||||||
|
if (task == NULL) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Failed to send read16 command: %s\n", iscsi_get_error(iscsi));
|
||||||
|
ret = -1;
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
if (task->status == SCSI_STATUS_GOOD) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Read16 command: Should fail when reading 0blocks at LBA -1\n");
|
||||||
|
ret = -1;
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
printf("[OK]\n");
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ int T0213_read12_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
printf("1, Read at 0 should work.\n");
|
printf("1, Read at 0 should work.\n");
|
||||||
printf("2, Read at end-of-lun should work.\n");
|
printf("2, Read at end-of-lun should work.\n");
|
||||||
printf("3, Read beyond end-of-lun should fail.\n");
|
printf("3, Read beyond end-of-lun should fail.\n");
|
||||||
|
printf("4, Read at LBA:-1 should fail. (only test this if the device is < 2TB)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -123,6 +124,27 @@ int T0213_read12_0blocks(const char *initiator, const char *url, int data_loss _
|
|||||||
}
|
}
|
||||||
printf("[OK]\n");
|
printf("[OK]\n");
|
||||||
|
|
||||||
|
/* read12 0 at lba -1, only do this if the device is < 2TB */
|
||||||
|
if (num_blocks == 0xffffffff) {
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
printf("Reading 0 blocks at lba:-1 ... ");
|
||||||
|
task = iscsi_read12_sync(iscsi, lun, -1, 0, block_size, 0, 0, 0, 0, 0);
|
||||||
|
if (task == NULL) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Failed to send read12 command: %s\n", iscsi_get_error(iscsi));
|
||||||
|
ret = -1;
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
if (task->status == SCSI_STATUS_GOOD) {
|
||||||
|
printf("[FAILED]\n");
|
||||||
|
printf("Read12 command: Should fail when reading 0blocks at -1\n");
|
||||||
|
ret = -1;
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
goto finished;
|
||||||
|
}
|
||||||
|
printf("[OK]\n");
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
iscsi_logout_sync(iscsi);
|
iscsi_logout_sync(iscsi);
|
||||||
iscsi_destroy_context(iscsi);
|
iscsi_destroy_context(iscsi);
|
||||||
|
|||||||
Reference in New Issue
Block a user