diff --git a/test-tool/0102_read10_0blocks.c b/test-tool/0102_read10_0blocks.c index cfb8353..8a478ec 100644 --- a/test-tool/0102_read10_0blocks.c +++ b/test-tool/0102_read10_0blocks.c @@ -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("2, Read at LBA:end-of-lun+1 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"); return 0; } @@ -151,7 +151,10 @@ int T0102_read10_0blocks(const char *initiator, const char *url, int data_loss _ 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 ... "); task = iscsi_read10_sync(iscsi, lun, 0xffffff, 0, block_size); if (task == NULL) { diff --git a/test-tool/0203_read16_0blocks.c b/test-tool/0203_read16_0blocks.c index 256720f..14bc3e6 100644 --- a/test-tool/0203_read16_0blocks.c +++ b/test-tool/0203_read16_0blocks.c @@ -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("2, Read at end-of-lun should work.\n"); printf("3, Read beyond end-of-lun should fail.\n"); + printf("4, Read at LBA -1 should fail.\n"); printf("\n"); return 0; } @@ -123,6 +124,23 @@ int T0203_read16_0blocks(const char *initiator, const char *url, int data_loss _ } 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: iscsi_logout_sync(iscsi); iscsi_destroy_context(iscsi); diff --git a/test-tool/0213_read12_0blocks.c b/test-tool/0213_read12_0blocks.c index c139ce3..0a49aa4 100644 --- a/test-tool/0213_read12_0blocks.c +++ b/test-tool/0213_read12_0blocks.c @@ -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("2, Read at end-of-lun should work.\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"); return 0; } @@ -123,6 +124,27 @@ int T0213_read12_0blocks(const char *initiator, const char *url, int data_loss _ } 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: iscsi_logout_sync(iscsi); iscsi_destroy_context(iscsi);