Improve tests for READ10/READ12/READ16
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
Copyright (C) 2012 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,18 +24,20 @@ int T0102_read10_0blocks(const char *initiator, const char *url, int data_loss _
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
struct scsi_readcapacity10 *rc10;
|
||||
int ret, lun;
|
||||
uint32_t block_size, num_blocks;
|
||||
struct scsi_readcapacity16 *rc16;
|
||||
int ret = 0, lun;
|
||||
uint32_t block_size;
|
||||
uint64_t num_blocks;
|
||||
|
||||
printf("0102_read10_0blocks:\n");
|
||||
printf("====================\n");
|
||||
if (show_info) {
|
||||
printf("Test that READ10 works correctly when reading 0 number of blocks.\n");
|
||||
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. (only test this if the device is < 2TB)\n");
|
||||
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:2^31 should fail (only on LUNs < 2TB).\n");
|
||||
printf("5, Read at LBA:-1 should fail (only on LUNs < 2TB).\n");
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -47,142 +49,136 @@ int T0102_read10_0blocks(const char *initiator, const char *url, int data_loss _
|
||||
}
|
||||
|
||||
/* find the size of the LUN */
|
||||
task = iscsi_readcapacity10_sync(iscsi, lun, 0, 0);
|
||||
task = iscsi_readcapacity16_sync(iscsi, lun);
|
||||
if (task == NULL) {
|
||||
printf("Failed to send readcapacity10 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;
|
||||
}
|
||||
rc10 = scsi_datain_unmarshall(task);
|
||||
if (rc10 == NULL) {
|
||||
printf("failed to unmarshall readcapacity10 data. %s\n", iscsi_get_error(iscsi));
|
||||
rc16 = scsi_datain_unmarshall(task);
|
||||
if (rc16 == NULL) {
|
||||
printf("failed to unmarshall READCAPACITY16 data. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
}
|
||||
block_size = rc10->block_size;
|
||||
num_blocks = rc10->lba;
|
||||
|
||||
block_size = rc16->block_length;
|
||||
num_blocks = rc16->returned_lba;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
/* read10 0 blocks one block at lba 0 */
|
||||
printf("Reading 0 blocks at lba:0 ... ");
|
||||
printf("READ10 0blocks at LBA:0 ");
|
||||
task = iscsi_read10_sync(iscsi, lun, 0, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send read10 command: %s\n", iscsi_get_error(iscsi));
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send READ10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read10 of 0 at lba:0 failed with sense.\n");
|
||||
printf("[FAILED]\n");
|
||||
printf("READ10 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
/* read10 0 blocks one block beyond the eol */
|
||||
printf("Reading 0 blocks at one block beyond end ... ");
|
||||
|
||||
test2:
|
||||
printf("READ10 0blocks at LBA:<end-of-disk> ");
|
||||
task = iscsi_read10_sync(iscsi, lun, num_blocks, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send READ10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto test3;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("READ10 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test3;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test3:
|
||||
printf("READ10 0blocks at LBA:<beyond end-of-disk> ");
|
||||
task = iscsi_read10_sync(iscsi, lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send read10 command: %s\n", iscsi_get_error(iscsi));
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send READ10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read10 of 0 blocks one block beyond end-of-lun should fail.\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
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("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n");
|
||||
printf("READ10 command: Should fail when reading 0blocks beyond end\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
/* read10 0 blocks two blocks beyond the eol */
|
||||
printf("Reading 0 blocks at two blocks beyond end ... ");
|
||||
task = iscsi_read10_sync(iscsi, lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
test4:
|
||||
printf("READ10 0blocks at LBA 2^31 ... ");
|
||||
if (num_blocks > 0x80000000) {
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto test5;
|
||||
}
|
||||
task = iscsi_read10_sync(iscsi, lun, 0x80000000, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send read10 command: %s\n", iscsi_get_error(iscsi));
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send READ10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read10 of 0 blocks two blocks beyond end-of-lun should fail.\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
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("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n");
|
||||
printf("READ10 command: Should fail when reading 0blocks at 2^31\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
/* read10 0 at lba -1, only do this if the device is < 2TB */
|
||||
if (num_blocks == 0xffffffff) {
|
||||
goto finished;
|
||||
test5:
|
||||
printf("READ10 0blocks at LBA -1 ... ");
|
||||
if (num_blocks > 0x80000000) {
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto test5;
|
||||
}
|
||||
printf("Reading 0 blocks at lba:-1 ... ");
|
||||
task = iscsi_read10_sync(iscsi, lun, 0xffffff, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_read10_sync(iscsi, lun, -1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send read10 command: %s\n", iscsi_get_error(iscsi));
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send READ10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test6;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read10 of 0 blocks at lba:-1 should fail.\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
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("READ10 failed but ascq was wrong. Should have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.\n");
|
||||
printf("READ10 command: Should fail when reading 0blocks at -1\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test6;
|
||||
}
|
||||
scsi_free_scsi_task(task);
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test6:
|
||||
|
||||
|
||||
finished:
|
||||
iscsi_logout_sync(iscsi);
|
||||
iscsi_destroy_context(iscsi);
|
||||
|
||||
@@ -36,7 +36,8 @@ 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("4, Read at LBA:2^63 should fail.\n");
|
||||
printf("5, Read at LBA:-1 should fail.\n");
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -73,74 +74,103 @@ int T0203_read16_0blocks(const char *initiator, const char *url, int data_loss _
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
printf("Read16 0blocks at LBA:0 ");
|
||||
printf("READ16 0blocks at LBA:0 ");
|
||||
task = iscsi_read16_sync(iscsi, lun, 0, 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));
|
||||
printf("Failed to send READ16 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
printf("READ16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read16 0blocks at LBA:<end-of-disk> ");
|
||||
|
||||
test2:
|
||||
printf("READ16 0blocks at LBA:<end-of-disk> ");
|
||||
task = iscsi_read16_sync(iscsi, lun, num_blocks, 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));
|
||||
printf("Failed to send READ16 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test3;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
printf("READ16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test3;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read16 0blocks at LBA:<beyond end-of-disk> ");
|
||||
|
||||
test3:
|
||||
printf("READ16 0blocks at LBA:<beyond end-of-disk> ");
|
||||
task = iscsi_read16_sync(iscsi, lun, num_blocks + 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));
|
||||
printf("Failed to send READ16 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read16 command: Should fail when reading 0blocks beyond end\n");
|
||||
printf("READ16 command: Should fail when reading 0blocks beyond end\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read16 0blocks at LBA:-1 ");
|
||||
task = iscsi_read16_sync(iscsi, lun, -1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
|
||||
test4:
|
||||
printf("READ16 0blocks at LBA 2^63 ... ");
|
||||
task = iscsi_read16_sync(iscsi, lun, 0x8000000000000000, 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));
|
||||
printf("Failed to send READ16 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read16 command: Should fail when reading 0blocks at LBA -1\n");
|
||||
printf("READ16 command: Should fail when reading 0blocks at 2^63\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test5:
|
||||
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 test6;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("READ16 command: Should fail when reading 0blocks at -1\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto test6;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test6:
|
||||
|
||||
|
||||
finished:
|
||||
iscsi_logout_sync(iscsi);
|
||||
iscsi_destroy_context(iscsi);
|
||||
|
||||
@@ -36,7 +36,8 @@ 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("4, Read at LBA:2^31 should fail (only on LUNs < 2TB).\n");
|
||||
printf("5, Read at LBA:-1 should fail (only on LUNs < 2TB).\n");
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -73,78 +74,111 @@ int T0213_read12_0blocks(const char *initiator, const char *url, int data_loss _
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
printf("Read12 0blocks at LBA:0 ");
|
||||
printf("READ12 0blocks at LBA:0 ");
|
||||
task = iscsi_read12_sync(iscsi, lun, 0, 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));
|
||||
printf("Failed to send READ12 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read12 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
printf("READ12 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test2;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read12 0blocks at LBA:<end-of-disk> ");
|
||||
|
||||
test2:
|
||||
printf("READ12 0blocks at LBA:<end-of-disk> ");
|
||||
task = iscsi_read12_sync(iscsi, lun, num_blocks, 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));
|
||||
printf("Failed to send READ12 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test3;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read12 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
printf("READ12 command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test3;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
printf("Read12 0blocks at LBA:<beyond end-of-disk> ");
|
||||
|
||||
test3:
|
||||
printf("READ12 0blocks at LBA:<beyond end-of-disk> ");
|
||||
task = iscsi_read12_sync(iscsi, lun, num_blocks + 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));
|
||||
printf("Failed to send READ12 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read12 command: Should fail when reading 0blocks beyond end\n");
|
||||
printf("READ12 command: Should fail when reading 0blocks beyond end\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test4;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
/* read12 0 at lba -1, only do this if the device is < 2TB */
|
||||
if (num_blocks == 0xffffffff) {
|
||||
goto finished;
|
||||
|
||||
test4:
|
||||
printf("READ12 0blocks at LBA 2^31 ... ");
|
||||
if (num_blocks > 0x80000000) {
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto test5;
|
||||
}
|
||||
printf("Reading 0 blocks at lba:-1 ... ");
|
||||
task = iscsi_read12_sync(iscsi, lun, -1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_read12_sync(iscsi, lun, 0x80000000, 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));
|
||||
printf("Failed to send READ12 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
if (task->status == SCSI_STATUS_GOOD) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Read12 command: Should fail when reading 0blocks at -1\n");
|
||||
printf("READ12 command: Should fail when reading 0blocks at 2^31\n");
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
goto test5;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test5:
|
||||
printf("READ12 0blocks at LBA -1 ... ");
|
||||
if (num_blocks > 0x80000000) {
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto test5;
|
||||
}
|
||||
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 test6;
|
||||
}
|
||||
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 test6;
|
||||
}
|
||||
printf("[OK]\n");
|
||||
|
||||
|
||||
test6:
|
||||
|
||||
|
||||
finished:
|
||||
iscsi_logout_sync(iscsi);
|
||||
iscsi_destroy_context(iscsi);
|
||||
|
||||
Reference in New Issue
Block a user