Commit Graph

489 Commits

Author SHA1 Message Date
Ronnie Sahlberg
138939cb0e TESTS: change ORWRITE to use a single helper function for all
Switch orwrite helpers to use _command_async instead of calling _orwrite_sync()
to prepare for switching to non-iscsi targets. Use the new check_result API
so that we only need a single helper function for ORWRITE instead of one
helper for each expected result.

Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:07:52 -07:00
Ronnie Sahlberg
905695575f TESTS: add a new helper check_result to validate the result of SCSI helpers
Many/most all SCSI helpers do pretty much the same checking for the SCSI
result and status. Break this out into a separate helper that we can use
to reduce code duplication.

Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:07:49 -07:00
Ronnie Sahlberg
2dccc96160 Merge pull request #134 from plieven/fix_inquiry
test-tool: fix Inquiry.AllocLength
2014-08-21 18:50:12 -07:00
Ronnie Sahlberg
4650f47d63 Merge pull request #132 from plieven/test_lbas_check_desc
Some improvements for the get_lba_status tests.
2014-08-21 18:49:56 -07:00
Sitsofe Wheeler
3bac2a0e17 Add ULL suffix to large integer literals
When trying to compile libiscsi on a 32 bit Ubuntu 10.04 with gcc 4.4.3
errors like the following are produced:

test_get_lba_status_beyond_eol.c:45: error: integer constant is too
large for ‘long’ type

This is because we don't specify that we are explictly compiling to the
c99 standard and as such gcc defaults to gnu90 standard. This in turn
means the maximum default type of integer literals is unsigned long int
which not big enough to hold the literal on a 32 bit architecture.

Fix this by adding the ULL suffix to all large integer literals.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2014-08-21 18:04:37 +01:00
Bart Van Assche
ad5872c1d5 Fix test_writesame1[06]_unmap_unaligned()
As far as I know SPC-4 does not allow unaligned unmap requests to
fail. The only phrase I found in SPC-4 about unaligned unmap
requests is the following: "An unmap request with a starting LBA
that is not optimal may result in unmap operations on fewer LBAs
than requested." Hence check that unaligned unmap requests succeed.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-21 06:43:40 -07:00
Bart Van Assche
ded75ae18a Fix WRITE SAME data buffer length handling
From the SPC-4 paragraph about WRITE SAME(10): "The WRITE SAME (10)
command requests that the device server transfer a single logical
block from the Data-Out Buffer [ ... ]". Hence always pass a data
buffer when sending a WRITE SAME(10) command.

Set the NDOB bit in the WRITE SAME(16) command if no data out buffer
is present.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-21 06:42:49 -07:00
Bart Van Assche
e8c4be8f62 test_writesame16_0blocks: Add support for WSNZ=1
Support for WRITE SAME with NUMBER OF LOGICAL BLOCKS = 0 is optional.
Hence set NUMBER OF LOGICAL BLOCKS to 0 if this value is supported
and set this parameter to 1 otherwise.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-21 06:40:51 -07:00
Bart Van Assche
d4ac9ef1b5 Skip test_writesame1[06]_unmap large len test for small disks
Only perform the test with 65536 blocks on block devices with at
least that number of blocks. Fix the 65536 block test log message.
Generalize the WRITE SAME(10) 256-block test log messages. Fix
interpretation of the MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT field.
A quote from SPC-4: "If there is no limit on the number of UNMAP
block descriptors contained in the parameter data, then the device
server shall set the MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT field to
FFFF_FFFFh."

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-21 06:40:21 -07:00
Peter Lieven
1f900054e1 test-tool: fix Inquiry.AllocLength
according to SBC-2 the alloc length should be at least 5 when
evpd is set to zero.

Also don't leak task if SPC-3 or later.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-08-13 18:53:52 +02:00
Peter Lieven
f3ce541463 test-tool: fix GetLBAStatus.Simple exit
if GetLBAStatus fails immediately exit the test.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-08-13 17:58:32 +02:00
Peter Lieven
a2592bff3a test-tool: improve GetLBAStatus.UnmapSingle
the test became nearly useless when reverting most
of its contents in commit 7d96336.

This patch adds some useful stuff back. While
we can't check that unmapped blocks are deallocated
we still can check that the blocks surrounding the
unmapped area don't get dealloaced.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-08-13 17:55:09 +02:00
Peter Lieven
8e4e03d85d test-tool: allow get_lba_status to return provisioning type
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-08-13 17:02:51 +02:00
Bart Van Assche
b631a2146c SPC-2 RESERVE tests: Use MODE SENSE instead of TEST UNIT READY
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>
2014-08-04 16:05:25 -07:00
Bart Van Assche
bb8d01e093 test_compareandwrite_simple: Make error messages more verbose
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-04 16:05:09 -07:00
Bart Van Assche
f6c4a82a22 test_writesame*_0blocks.c: Include WSNZ bit in test
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>
2014-08-04 16:04:43 -07:00
Bart Van Assche
cfce944b35 test_write*_residuals: Fix overflow tests
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>
2014-08-04 16:04:21 -07:00
Ronnie Sahlberg
7d96336d52 TESTS: don't check that UNMAP actually unmapped the blocks
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>
2014-07-23 17:22:16 -07:00
Ronnie Sahlberg
cefb6a6127 TESTS: update the get_lba_status + unmap test to account for lbppbe
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-16 05:37:34 -07:00
Ronnie Sahlberg
e09d5fcefc Typo
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-14 20:29:23 -07:00
Ronnie Sahlberg
a41ec1fe60 TESTS: Add tests that get_lba_status for a single range works
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>
2014-07-14 19:46:12 -07:00
Peter Lieven
d6af861c57 iscsi-test: check for invalid descriptors offsets in get_lba_status
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>
2014-07-10 14:44:16 +02:00
Ronnie Sahlberg
20b4f9a3fb tests: remove deprecated test tool iscsi-test
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-05-20 18:05:57 -07:00
Ronnie Sahlberg
e66b50f8ec tests: use alloca when allocating scratch buffer for writesame
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-05-20 17:52:23 -07:00
Ronnie Sahlberg
b7089d64e1 Merge pull request #111 from jpocas/upstream
- test_unmap_simple: was assuming that zero buffer was already cleared, ...
2014-05-20 17:48:17 -07:00
jpocas
69c466a6c9 - writesame10 and writesame16 were looking at the datalen, when they wanted to be looking at the number of blocks 2014-05-07 13:49:25 -04:00
jpocas
b0c57802bc - test_unmap_simple: was assuming that zero buffer was already cleared, which is not guaranteed and resulted in spurious failures
- 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.
2014-05-07 13:32:21 -04:00
Ronnie Sahlberg
717b95cb8a slist.h: rename SLIST_ to ISCSI_LIST_ to avoid clash on *BSD
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>
2014-05-07 06:44:19 -07:00
Ronnie Sahlberg
91156cffe9 TESTS: Allow specifying a file instead of a test glob pattern
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.
2014-03-26 19:10:12 -07:00
Ronnie Sahlberg
458764a77d TESTS: Add support to specify multiple test glob expressions 2014-03-26 18:35:07 -07:00
Ronnie Sahlberg
68610bd7cf TESTS: The SCSI test is called TestUnitReady, not UnitReady 2014-03-26 18:20:27 -07:00
Ross Judson
90b6658482 Match actual option name with usage 2014-03-26 12:14:33 -04:00
Ross Judson
81c71649e7 Fix usage to reflect options with underscore 2014-03-26 12:11:25 -04:00
Ronnie Sahlberg
ea790b2f75 AUTOTOOLS: Add Makefile.am to test-tool 2014-03-22 16:46:25 -07:00
Bart Van Assche
e8545d6a03 verify1[02]_invalidfieldincdb(): Fix an error message
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-03-15 08:45:21 -07:00
Jon Hermansen
d34d61a782 add automated XML output option to iscsi-test-cu 2014-03-11 16:15:19 -07:00
Jon Hermansen
d348633763 fix capacity checks in READ(6) tests 2014-03-11 10:44:54 -07:00
Ronnie Sahlberg
270db13f7c TESTS: Warn not fail if inquiry descriptors do not contain SPC* or SBC*
Only print a warning but do not fail if the standard inquire version
descriptors do not contain a SPC* or SBC* entry.
2014-03-06 20:30:00 -08:00
Ronnie Sahlberg
b0dbecaff7 TESTS: compare and write: Invalidfieldincdb is illegal-request, not miscompare 2014-03-06 17:30:46 -08:00
Ronnie Sahlberg
879f542ebf TESTS: CompareAndWrite are bounded by the max block setting in BlockLimits
Make sure that we check that a target returns an error if we try to compare and write too much.
2014-03-05 18:47:24 -08:00
Ronnie Sahlberg
fc91b41b5a TESTS: Clear iscsi_local_iscsi_queue_pdy pointer before we return from the test. 2014-03-03 17:25:24 -08:00
Ronnie Sahlberg
dbc9ffb5cb TESTS: ReportSupportedOpcodes return the opcode itself as data[0], not 0xff
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.
...
2014-02-24 19:04:58 -08:00
Ronnie Sahlberg
cc81b67620 TESTS: Add tests for invalid iSCSI DATASN values. 2014-01-26 09:35:17 -08:00
Ronnie Sahlberg
5eb9d8750b Merge pull request #87 from sitsofe/oldtests
OLD TESTS: Fix use after free in unsolicited_[non]immediate_data tests.
2014-01-26 08:25:49 -08:00
Sitsofe Wheeler
b42a6ede19 OLD TESTS: Fix use after free in unsolicited_[non]immediate_data tests.
After destroying iscsi, nullify iscsi_url's reference to it to prevent a use
after free.

Detected by clang's AddressSanitizer.
2014-01-25 08:59:35 +00:00
Sitsofe Wheeler
e1659b1973 TESTS: Fix WRITESAME tests to handle targets that don't like datalen == 0
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.
2014-01-25 05:37:45 +00:00
Sitsofe Wheeler
38ba5b6c0e Fix logging typo. 2014-01-24 18:56:54 +00:00
vn516726
262ac3b5c6 Corrected the log 2014-01-24 11:39:25 +08:00
Ronnie Sahlberg
25078d0d91 Old TESTS: Abort 0180 thin provisioning test early if the LUN does not have LBPME enabled 2014-01-06 18:36:48 -08:00
Ronnie Sahlberg
993be6c439 Free the correct inq task to avoid leaking memory during startup. 2014-01-06 18:26:03 -08:00