TESTS: Old and new testsuite tested slightly different things for 0block tests
Change all tests in the old testsuite to check 0block tests 2 blocks past the end of the device, just like the new testsuite. These tests check that we get an error if we do a 0-block read/write etc beyond the end of the device. In the SBC standard, the only thing that discusses LBA_OUT_OF_RANGE is wordings such as this : If the LBA plus the transfer length exceeds the capacity of the medium, then the device server shall terminate the command with CHECK CONDITION status with the sense key set to ILLEGAL REQUEST and the additional sense code set to LOGICAL BLOCK ADDRESS OUT OF RANGE. This is very clear for when transfer length is > 0, but what when transfer length is == 0? Assume we have a device that is 0x31fff in size. With this wording, if we read 1 block at LBA : 0x31fff we end up at 0x32000 and this is at the end, but not beyond the end. We are reading/accessing the last block at 0x31fff and we stop at 0x32000. Similarly, if we are reading 1 block, starting at 0x32000 and reading to 0x32001 which would be LBA_OUT_OF_RANGE since we are accessing beyond the end of the device. The question now is what happens if we try to read 0-blocks just at the edge at the end of the device. I.e. What is we try to read 0 blocks at LBA:0x32000 ? Looking at the standard, the wordings say that this should be fine. Because the SBC standard only says that we should check LBA+transfer length. Thus since 0x31fff + 1 block is exactly the same as 0x32000 + 0 blocks thus a device SHOULD allow reading of 0 blocks just at the end. This is the conclusion from reading SBC by the letter. However It might be unreasonable to do so and it might be wiser to just stay away from this ambigous area of SBC. Following the SBC standard by the letter, the new test suite was wrong since it should have flagged this as a failure. But it did checks on one block beyond the blobk at the end of the device. It checked that we would fail for 0x32001 in the example above. Strictly, I should have fixed the new test to check 0x32000 but I think it might be unreasonably to enforce something here for this ambigous area of "what happens when accessing 0 blocks just at the edge of the device". So instead I have changed the OLD tests so that they now check one block further on. In the example above it means they too now check 0x32001 instead of 0x32000. Technically speaking this is wrong, but this is the imho reasonable thing to do.
This commit is contained in:
@@ -70,7 +70,7 @@ int T0102_read10_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
task = iscsi_read10_sync(iscsi, lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_read10_sync(iscsi, lun, num_blocks + 2, 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));
|
||||
|
||||
@@ -91,7 +91,7 @@ int T0184_writesame10_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
task = iscsi_writesame10_sync(iscsi, lun, num_blocks + 1,
|
||||
task = iscsi_writesame10_sync(iscsi, lun, num_blocks + 2,
|
||||
buf, block_size,
|
||||
0,
|
||||
0, 0, 0, 0);
|
||||
|
||||
@@ -86,7 +86,7 @@ int T0194_writesame16_0blocks(const char *initiator, const char *url)
|
||||
|
||||
|
||||
printf("Writesame16 0blocks at one block beyond <end-of-LUN> ... ");
|
||||
task = iscsi_writesame16_sync(iscsi, lun, num_blocks + 1,
|
||||
task = iscsi_writesame16_sync(iscsi, lun, num_blocks + 2,
|
||||
buf, block_size,
|
||||
0,
|
||||
0, 0, 0, 0);
|
||||
|
||||
@@ -65,7 +65,7 @@ int T0203_read16_0blocks(const char *initiator, const char *url)
|
||||
|
||||
|
||||
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);
|
||||
task = iscsi_read16_sync(iscsi, lun, num_blocks + 2, 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));
|
||||
|
||||
@@ -71,7 +71,7 @@ int T0213_read12_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
task = iscsi_read12_sync(iscsi, lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_read12_sync(iscsi, lun, num_blocks + 2, 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));
|
||||
|
||||
@@ -77,7 +77,7 @@ int T0233_write12_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
task = iscsi_write12_sync(iscsi, lun, num_blocks + 1, NULL, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_write12_sync(iscsi, lun, num_blocks + 2, NULL, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send WRITE12 command: %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
@@ -63,7 +63,7 @@ int T0243_prefetch10_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
ret = prefetch10_lbaoutofrange(iscsi, lun, num_blocks + 1, 0, 0, 0);
|
||||
ret = prefetch10_lbaoutofrange(iscsi, lun, num_blocks + 2, 0, 0, 0);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int T0253_prefetch16_0blocks(const char *initiator, const char *url)
|
||||
|
||||
/* Prefetch 0 blocks beyond end of the LUN */
|
||||
printf("PREFETCH16 0blocks at one block beyond <end-of-LUN>.\n");
|
||||
ret = prefetch16_lbaoutofrange(iscsi, lun, num_blocks + 1, 0, 0, 0);
|
||||
ret = prefetch16_lbaoutofrange(iscsi, lun, num_blocks + 2, 0, 0, 0);
|
||||
if (ret != 0) {
|
||||
goto finished;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ int T0293_write10_0blocks(const char *initiator, const char *url)
|
||||
printf("LUN is too big, skipping test\n");
|
||||
goto finished;
|
||||
}
|
||||
task = iscsi_write10_sync(iscsi, lun, num_blocks + 1, NULL, 0, block_size, 0, 0, 0, 0, 0);
|
||||
task = iscsi_write10_sync(iscsi, lun, num_blocks + 2, NULL, 0, block_size, 0, 0, 0, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
printf("Failed to send WRITE10 command: %s\n", iscsi_get_error(iscsi));
|
||||
|
||||
Reference in New Issue
Block a user