For now this only changes iSCSIDataSnInvalid to use
iscsi_pdu_set_datasn() instead of scsi_set_uint32().
iSCSICmdSnTooHigh/Low changes should also be possible, as noted, but
haven't been converted yet.
Signed-off-by: David Disseldorp <ddiss@suse.de>
libiscsipriv.la exposes all symbols, so allows tests to perform low
level PDU manipulation, etc. without duplicating code.
As a trade-off, this results in a larger iscsi-test-cu, with libiscsi.so
linking removed.
Link: https://github.com/sahlberg/libiscsi/issues/297
Signed-off-by: David Disseldorp <ddiss@suse.de>
All users have now been changed to overload via the iscsi_ctx transport
callback, so the dlsym based overloading can now be dropped.
Signed-off-by: David Disseldorp <ddiss@suse.de>
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>
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>
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>
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.
This commit also removes a number of unnecessary "WRITE10 is not
implemented" checks, which should all be caught by the first check.
Signed-off-by: David Disseldorp <ddiss@suse.de>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
<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.
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>
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>
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>
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>
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>