Commit Graph

8 Commits

Author SHA1 Message Date
Ronnie Sahlberg
6a3888e39e 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.
2013-03-19 18:04:24 -07:00
Ronnie Sahlberg
5ad957b873 TESTS: Start fixing up the tests so we can test-suite them properly
Dont call READCAPACITY from every single test.
Remove two arguments from the test signatures and turn them into globals.
remove the ret++ silliness.  Tests return 0 : all ok, -2, skipped or -1 : test failed
2012-12-26 18:34:12 -08:00
Ronnie Sahlberg
ed1c3e1129 TESTS: Fix all 0block tests
Remove the test for accessing 0blocks (transfer length==0) at the end of the device since they were invalid.

SBC says that :
   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 means that if TL==0  then a LBA that is the first LBA beyond the end of
device is actually valid.

Improve output for error conditions and harminize all tests
2012-09-10 19:08:57 -07:00
Paolo Bonzini
e4377e7d91 iscsi-test: return -2 when skipping tests
This lets a test driver distinguish failure from skipping unsupported
tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-08-30 17:39:00 +02:00
Ronnie Sahlberg
27ea207fd4 Improve WRITE10/12/16 tests 2012-06-24 07:43:28 +10:00
Ronnie Sahlberg
288fd5e9fe TEST-TOOL: Add a --info argument to print more detailed infor what a test does
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-03 09:08:12 +10:00
Ronnie Sahlberg
c02a952911 Fix some cut and paste typos 2012-05-02 23:44:20 +10:00
Ronnie Sahlberg
33a398f21c TESTS Add basic tests for write12/16 2012-05-02 23:15:41 +10:00