Although SPC-2 specifies that a reservation conflict should be
reported when TEST UNIT READY is received from another initiator than
the registered initiator, it is an established practice that TEST
UNIT READY is accepted in this case. Hence use the MODE SENSE command
to test the effect of the RESERVE command instead of TEST UNIT READY.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
From the SBC-4 section about the block limits VPD page: "A write
same non-zero (WSNZ) bit set to one indicates that the device
server does not support a value of zero in the NUMBER OF LOGICAL
BLOCKS field in the WRITE SAME command CDBs (see 5.45, 5.46, and
5.47). A WSNZ bit set to zero indicates that the device server may
or may not support a value of zero in the NUMBER OF LOGICAL BLOCKS
field of the WRITE SAME commands." Hence verify that WRITE SAME
with NUMBER OF LOGICAL BLOCKS set to zero fails if WSNZ = 0.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
RFC 3720 is not clear about whether a target should return SUCCESS
or CHECK CONDITION if SPDTL > EDTL. Hence accept both. See also
Fred Knight, Re: [Ips] Data Out residual overflow/underflow handling,
IETF mailing list archive, 21 September 2012
(http://www.ietf.org/mail-archive/web/ips/current/msg02756.html).
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
We can not test that UNMAP will actually unmap anything even if
it returned status GOOD from the device.
Devices are allowed to "do nothing and return status GOOD" whenever they
want to.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Add a test for unmapping a single range of blocks and that
get_lba_status returns correct data.
Test unmapping a single block at offsets 0-255
Test unmapping 1-255 blocks at offset 0 and verify that
get_lba_status at LBA 0 returns a descriptor of 1-255 blocks.
get_lba_status at the last block of the unmapped range returns
a descriptor for a single block.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Dell Equallogic sans report an invalid LBA offset in the descriptor when
using 4k LUNs. Check the descriptor for consistency with the request.
Signed-off-by: Peter Lieven <pl@kamp.de>
- writesame10_unmap_until_end, writesame16_unmap, writesame16_unmap_until_end were doing an CU_ASSERT *PER-BYTE* in the verification phase,
which was very CPU-intensive. This change uses memcmp on a whole block which finishes much quicker.
Rename the macros for managing the linked lists from SLIST_* to ISCSI_LIST_*
to avoid a clash on *BSD which already have other macros SLIST_*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Allow specifying a --test <file> in which case the tests listed in the file
will be executed.
This makes it easier than having to specify a potentially huge number
of tests on the command line.
The first byte of CDB USAGE FIELD contains the opcode value itself, not
0xff.
From SPC4 :
...
The first byte of the CDB USAGE FIELD
field shall contain the operation code for the command being queried.
...
Recent SBC specs say (when the WSNZ bit is set to one and the NUMBER OF LOGICAL
BLOCKS field is set to zero) or (if MAXIMUM WRITE SAME LENGTH is greater than 0
and the number of logical blocks specified to be written exceeds the MAXIMUM
WRITE SAME LENGTH) the server should terminate with CHECK CONDITION, set the
sense key to ILLEGAL REQUEST and the additional sense code to INVALID FIELD IN
CDB.
Update the WRITESAME tests to cope with this.
This helps testing SCSI target implementations that represent the
byte offset from the start of the device as a signed or unsigned
64-bit integer.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Free read_write_buf and task after each test. Free iscsi2 after
each PGR test when using CUnit version 2. Note: CUnit version 1
doesn't support test setup and teardown functions.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>