Commit Graph

515 Commits

Author SHA1 Message Date
Ronnie Sahlberg
55c1f0d2ec TESTS: Add support to test against a /dev/sg device on linux
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-19 16:26:46 -07:00
Ronnie Sahlberg
bd6570c324 TESTS: create an abstraction to connect to a device
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-19 06:26:53 -07:00
Ronnie Sahlberg
48e14f5ccf TESTS: update main program to use helpers instead of calling directly to libiscsi
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-19 06:21:02 -07:00
Ronnie Sahlberg
8ed2ad9b69 TESTS: start abstracting away the error string handling from transports
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 19:20:49 -07:00
Ronnie Sahlberg
5efc7bf925 TESTS: create a helper/wrapper for sending scsi commands
Create a wrapper for sending scsi_commands so that we can hide the
libiscsi function far away from the "opcode" helpers.
This means we only have a single place later to switch to a different
type of device, such as a SG_IO one.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 18:52:08 -07:00
Ronnie Sahlberg
74a50052cd TESTS: get rid of iscsic2
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 18:37:35 -07:00
Ronnie Sahlberg
072291c852 TESTS: change the function signatures for the helpers
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 18:19:04 -07:00
Ronnie Sahlberg
9b768f7de9 TESTS: move the default url, lun and iscsi context into a structure
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 16:42:45 -07:00
Ronnie Sahlberg
f015ab095a TESTS: update reportsupportedopcodes to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
9be6ddaf09 TESTS: update inquiry to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
398f03205d TESTS: update unmap to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
832d88797a TESTS: remove the read10_task helper
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
9e75b10103 TESTS: change get_lba_status to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
fd21a8f2c4 TESTS: convert readcapacity to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
46eaa7dcc3 TESTS: convert compareandwrite to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
44d88e3bc6 TESTS: update synchronizecache to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
1c14b9b911 TESTS: update read6 to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:22 -07:00
Ronnie Sahlberg
3ee3964332 TESTS: change testunitready to new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 14:07:21 -07:00
Ronnie Sahlberg
fe11a6178b TESTS: add ASCQ check to miscompare
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 13:12:59 -07:00
Ronnie Sahlberg
f1d198c684 TESTS: update startstopunit to use new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 13:12:58 -07:00
Ronnie Sahlberg
28b0a0ab11 TESTS: update the READ tests to the new API
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 13:12:58 -07:00
Ronnie Sahlberg
4b2e9bd417 TESTS: update the prefetch tests to the new api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:08:02 -07:00
Ronnie Sahlberg
8585e4509b TESTS: update writesame tests to new API
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:08:01 -07:00
Ronnie Sahlberg
d3f98dfdd5 TESTS: rework WRITEVERIFY* tests to the new API
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:07:59 -07:00
Ronnie Sahlberg
8ffd78c117 temp: redo the write10/12/16 commands to the new saner api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:07:57 -07:00
Ronnie Sahlberg
8aefc7d579 TEST: update all the verify tests to a new API
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-09-18 12:07:55 -07:00
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