Commit Graph

761 Commits

Author SHA1 Message Date
David Disseldorp
c067eef9c1 test-tool/iSCSICmdSnTooLow: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
310e9ace02 test-tool/Compare&Write: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert the Compare&Write InvalidDataOutSize test to use
the regular transport driver callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
60a5856f00 test-tool/Compare&Write: skip InvalidDataOutSize unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
Khazhismel Kumykov
22648d9dbf add some missing includes
avoids forward referenced enums, and includes standard type defns

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:49:05 +10:00
Khazhismel Kumykov
08cd206c4a test-tool: fix async read/write test for bs != 512
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:47:47 +10:00
Khazhismel Kumykov
4409521cb6 test-tool: fix mpio_async_caw for bs != 512
wr_buf was hardcoded with blocksize 512, resulting in incorrect behavior
for larger block sizes, and buffer overflow. Use the block_size global.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 07:46:08 +10:00
David Disseldorp
cdf32e64d7 test_multipathio_simple: change data with path
This makes the data consistency check slightly more useful.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-07-09 11:24:33 +02:00
David Disseldorp
1af3314e2b test-tool: fix MPIO clear_pr() behaviour
clear_pr() can be called before connect_scsi_device() has been invoked
on each MPIO sdev. This results in a NULL pointer dereference in the
send_scsi_command() MPIO NOP-responder code-path.

Fix this by invoking clear_pr() after the MPIO connect_scsi_device()
loop has run. clear_pr() also only needs to be invoked via a single
path, so do so via the first path only.

Link: https://github.com/sahlberg/libiscsi/issues/289
Fixes: 16435a9 ("iscsi-test-cu: Improve persistent reservation clearing")
Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-04-15 14:32:54 +02:00
Tim Crawford
9347cfebf2 Replace file variables with .dir-locals.el
Signed-off-by: Tim Crawford <tcrawford@datto.com>
2019-02-21 11:54:02 -05:00
Bart Van Assche
16435a917d iscsi-test-cu: Improve persistent reservation clearing
Clear persistent reservations before sending the first SCSI command to the
target to avoid that that command fails due to persistent reservations left
behind by a previous run of the test tool.

Avoid that a subsequent test fails if a test did not remove the persistent
reservations it obtained.

Make sure that clear_pr() returns -1 if clearing persistent reservations
fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:53:09 -08:00
Bart Van Assche
1bd1232a2a Move the clear_pr() function definition
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:52:47 -08:00
Bart Van Assche
a15c2a5c61 test-tool/test_prin_read_keys_truncate: Do not crash if PERSISTENT RESERVE IN fails
Do not try to dereference the 'rk' pointer if it is NULL.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:48:08 -08:00
Ronnie Sahlberg
a7a14cc66c Merge pull request #271 from SexyC/master
Fix the 0 blocks writesame failed when target claims supporting maxim…
2018-10-02 06:45:14 +10:00
yayang1
8a3375e459 Fix the 0 blocks writesame failed when target claims supporting maximum writesame length to LUN's total blocks number.
When target claim it support maximum writesame length to the total blocks number, when
we trigger 0blocks writesame opertion, we should expect it to be succeed instread of failure.
2018-09-28 02:31:28 +00:00
David Disseldorp
ab0e40d689 test-tool: add PrinReadKeys.Truncate test
This test registers PR key and then sends a PR-In read-keys request with
an ALLOCATION LENGTH value that forces response truncation. Ensure that
the ADDITIONAL LENGTH is *not* modified as a result of the truncation.

This test currently passes against TGT but fails against LIO (fix
pending).

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-05-31 23:31:17 +02:00
David Disseldorp
31ab1e1ac9 test-tool: add prin_read_keys() allocation_len parameter
Accepting an Allocation Length parameter allows us to test for
truncation of response data, as per SPC5r17 4.2.5.6:
  The device server shall terminate transfers to the Data-In Buffer when
  the number of bytes or blocks specified by the ALLOCATION LENGTH field
  have been transferred or when all available data have been
  transferred, whichever is less.

With this change, all existing prin_read_keys() callers continue to use
same ALLOCATION LENGTH value as earlier (16K).

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-05-31 23:08:39 +02:00
David Disseldorp
58642c6d72 tests: drop duplicate PR-unsupported log messages
The helper function -2 return paths already print this message, so the
duplicate in the caller can be dropped.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-05-29 16:43:19 +02:00
Bart Van Assche
4d1918859f test-tool: Avoid crashes due to NULL-pointer dereferences
Avoid that certain test failures cause the test tool to trigger a
segmentation fault.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:25 -08:00
Bart Van Assche
8f2abea4de test-tool/test_compareandwrite_simple: Limit the number of blocks used
Make sure that 'maxbl' does not exceed the LUN capacity.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:25 -08:00
Bart Van Assche
18de10174b test-tool/test_compareandwrite_simple(): Fix end-of-LUN test
Make sure that the end-of-LUN test happens at the end of the LUN instead
of at the start of the LUN.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:22 -08:00
Bart Van Assche
8f468b14fc test-tool/test_compareandwrite_*: Stop at end of medium
Since the argument num_blocks - i is passed as the LBA argument
to COMPAREANDWRITE(), avoid that a negative number is passed.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Bart Van Assche
fee9eb9423 test-tool/test_async_lu_reset_simple: Continue upon reconnect error
Instead of stopping all tests if a reconnect fails, only stop
test_async_lu_reset_simple.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Bart Van Assche
ba8cac6b05 test-tool, check_result(): Make failure output more informative
If a SCSI command fails, report the SCSI status code.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
David Disseldorp
dc0c3c76c0 test_writesame_unmap_until_end: fix unsupported fallback
2e947cc1de added logic to check that
targets missing zero block writesame support return INVALID_FIELD_IN_CDB
to such requests. However, this change incorrectly set the writesame
number_of_logical_blocks field to one.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-12-20 17:54:18 +01:00
Sushil
0593ac20de 251_SCSI Executing with SCSI device only (no ISCSI URL) ProutRegister test case failed
<iscsi-url> parameter absent handled for SCSI devices.

* Verbose logging segfault fixed.

* For ioctl case, if reservation conflicts hits it is not considered as
test case failure.
2017-11-09 06:15:06 +10:00
Bart Van Assche
e5296920e9 test_multipathio_simple: Only compare if READ10 succeeded
Since the data in the read buffer is not valid if READ10() failed,
only compare the data in the read buffer if READ10() succeeded.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
0241fe8014 test_extended_copy_simple: Limit transfer size to half of the capacity
This avoids that the test fails for LUNs with less than 2048 blocks.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
1af120d2c3 test_extended_copy_simple: Fix buffer comparison code
Compare the buffers in their entirety instead of only a prefix of
the buffers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
e866dc36e0 test_async_*_simple: Fix a CUnit assertion failure
Using any of the CU_ASSERT macros after a test has finished causes
the test tool to abort. This patch adds an iSCSI logout to two tests
to avoid that the test tool aborts e.g. as follows:

==11578== Process terminating with default action of signal 6 (SIGABRT)
==11578==    at 0x54BB77F: raise (raise.c:58)
==11578==    by 0x54BD379: abort (abort.c:89)
==11578==    by 0x54B3B46: __assert_fail_base (assert.c:92)
==11578==    by 0x54B3BF1: __assert_fail (assert.c:101)
==11578==    by 0x504213E: CU_assertImplementation (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
==11578==    by 0x16FA36: test_async_abort_cb (test_async_abort_simple.c:67)
==11578==    by 0x5274B82: iscsi_process_task_mgmt_reply (task_mgmt.c:100)
==11578==    by 0x525E226: iscsi_process_pdu (pdu.c:598)
==11578==    by 0x526F2AA: iscsi_read_from_socket (socket.c:677)
==11578==    by 0x5270015: iscsi_tcp_service (socket.c:963)
==11578==    by 0x52700A5: iscsi_service (socket.c:980)
==11578==    by 0x52707E1: event_loop (sync.c:69)

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
4591a82209 test_report_supported_opcodes_rctd: Fix a NULL pointer dereference
Avoid that the test tool crashes due to a NULL pointer dereference
if unmarshalling the Data-In buffer fails.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Ronnie Sahlberg
fb45f0343e Fix another compiler warning
We do need a default: arm here as the switch is not supposed to deal with
all possible values for the enum.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-03 11:33:51 -07:00
Ronnie Sahlberg
854e37aab7 Fix compiler warning/error under gcc7
Gcc7 complains about falling through from the previous case to the default arm

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-03 11:20:20 -07:00
Bart Van Assche
7c10722449 test tool: Set BYTCHK=1 if EDTL != 0
From SBC-4: BYTCHK = 0 means that the Data-Out buffer contents
must not be used. BYTCHK = 1 means that the Data-Out buffer must
be compared against the data on the storage medium. Hence set
BYTCHK to 1 if EDTL != 0.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-03-20 12:15:44 -04:00
Bart Van Assche
71c797fd1c test-tool: Fix a segmentation fault in test_receive_copy_results_op_params()
Do not access the RECEIVE_COPY_RESULTS() output if this operation
failed.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Bart Van Assche
9df32565a6 test-tool/test_async_read.c: Allocate large arrays dynamically
This patch avoids that Valgrind complains about the memset() call
that was used to initialize the array that it triggers an invalid
write.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Bart Van Assche
38e6ab7582 Spelling fix: incase -> in case
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
David Disseldorp
14cc8facc1 TESTS: fix ExtendedCopy.ValidTgtDescr for SPC-4
With SPC-4, the 0xE4 descriptor LU ID TYPE field should be ignored, and
the NUL bit is obsolete. Update the ValidTgtDescr accordingly.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-12-29 20:49:12 +01:00
David Disseldorp
e427a813ad TESTS: exceed Maximum Descriptor List Length
ExtendedCopy.DescrLimits currently attempts to test Maximum Descriptor
List Length bounds checking by issuing a request with
(max_target_desc_count + 1 + max_segment_desc_count + 1) descriptors.

Maximum Descriptor List Length is a separately advertised field, that
may not be exceeded with the above logic, e.g. LIO advertises:
- Max Target Desc Count = 2
- Max Segment Desc Count = 1
- Max Desc List Len = 1024

Calculate the number of descriptors using the advertised Maximum
Descriptor List Length value, to explicitly test bounds checking.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-12-23 02:36:43 +01:00
Ronnie Sahlberg
3a598ea846 TESTS: Unmap. Clamp max number of unmap blocks to 256 if the target reports
no limit

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:37:59 -08:00
Ronnie Sahlberg
04b029dc88 TESTS: Allow iser:// style URLs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:21:35 -08:00
Ronnie Sahlberg
8c9519b145 TESTS: Setup and use iovectors for ALL data transfers in send_scsi_command
We need to use iovectors for iSER to work as it requires that the vectors
are attached to the task before we queue the task.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:07:23 -08:00
Ronnie Sahlberg
5228631a60 Merge pull request #220 from mimusato/unmap
adds max block descriptor count control to Unmap; skips Verify on LBA…
2016-11-14 17:11:39 -08:00
Michal Suchanek
a239423a0f Fix 32bit build.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2016-11-14 17:28:31 +01:00
Mihai Musatoiu
1a92fbcc12 adds max block descriptor count control to Unmap; skips Verify on LBA 2^31 if that LBA is valid (not outside the LUN) 2016-10-27 09:42:14 +00:00
Ronnie Sahlberg
8cc8fb98a7 TESTS: Skip the whole startstopunit test if the medium is not removable
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-09 15:10:01 -07:00
Ronnie Sahlberg
4d0c7559c0 TEST: Improve simple startstopunit test
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-09 14:31:09 -07:00
David Disseldorp
e6f7d5328c TESTS: simple LU RESET TMF test
Dispatch a write and subsequently reset the logical unit via iSCSI TMF.
This is based on the AbortTaskSimpleAsync test.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-10-09 11:54:10 -07:00
David Disseldorp
4694c4ec95 TESTS: drop /dev/sg device path check for iSCSI
When run against an iSCSI target sd->sgio_dev may be NULL, so the
strncmp() coredumps.

Fixes: 698ae7a649

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-10-05 15:03:24 +02:00
Ronnie Sahlberg
698ae7a649 TESTS: Dont use BLKSECTGET for /dev/sg devices
As BLKSECTGET is so unreliable, skip using this to detect max transfer sizes
for any device path starting with "/dev/sg"
instead force the max to be 120k

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-04 21:21:25 -07:00
Ronnie Sahlberg
bf3e388ec2 TESTS: Abort Reserve6 tests if task mgmt functions are missing
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-04 20:21:16 -07:00