Commit Graph

175 Commits

Author SHA1 Message Date
David Disseldorp
88a6060c7a test-tool: add simple REPORT LUNS test
Check for duplicate LUN entries in the REPORT LUNS response.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-01-22 21:27:18 +01:00
David Disseldorp
957cc96232 test-tool: add COMPARE AND WRITE MiscompareSense test
This test checks regular sense/ascq values on miscompare as well as
the Information sense field, which should be set as follows:
  sense key set to MISCOMPARE and the additional sense code set to
  MISCOMPARE DURING VERIFY OPERATION. In the sense data (see 4.18 and
  SPC-5) the offset from the start of the Data-Out Buffer to the first
  byte of data that was not equal shall be reported in the INFORMATION
  field.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-10-19 14:54:58 +02:00
Aleksandr Miloserdov
f342056a52 test-tool: add version descriptor checks for more SBC-3 versions
If device claims SBC-3 version in its version descriptors it won't be marked as SBC-3 compliant.

This commit adds checks for:
* SBC-3 T10/BSR INCITS 514 revision 35
* SBC-3 T10/BSR INCITS 514 revision 36
* SBC-3 ANSI INCITS 514-2014
2020-09-11 13:26:26 +03:00
David Disseldorp
54b3dcaa30 test-tool: add LogoutDuringIOAsync test case
This attempts to reproduce upstream LIO reports of a use after free bug
when logout occurs alongside concurrent I/O.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-08-18 17:12:28 +02:00
David Disseldorp
a89583aec3 test/xcopy_simple: add XCOPY test with 0x0A segment descriptor
Check for 0x0A descriptor support via SCSI_COPY_RESULTS_OP_PARAMS. If
supported, perform a 0x0A type XCOPY using target's
maximum_segment_length (or 256M if larger).

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-03-18 18:59:43 +01:00
Bart Van Assche
529350eab1 Do not cast away constness
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2020-02-28 21:54:49 -08:00
Bart Van Assche
69c4783d2d test-tool: Give up if READ CAPACITY reports that the block size is zero
Since the test tool can't proceed in a meaningful way if the block size
is zero, give up if the SCSI target reports that the block size is zero.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2020-02-23 20:11:14 -08:00
Bart Van Assche
cc3ddbff42 Improve robustness of the code that restores .queue_pdu()
In my tests I hit a stack overflow caused by infinite recursion of
.queue_pdu() calls, caused by .queue_pdu() not being restored in an
error path. Make the approach for restoring .queue_pdu() more robust.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-11-12 18:12:27 -08:00
David Disseldorp
84d80878a6 test-tool: add iSCSI CHAP_A negotiation tests
The iSCSICHAP.Simple test ensures that CHAP_A comma separated lists
are correctly handled. iSCSICHAP.Invalid tests a range of invalid
CHAP_A parameters.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-23 16:46:26 +02:00
David Disseldorp
1511ddcbe4 test-tool: add simple iSCSI NOP-Out test
Send a ping with/without data and expect a valid response.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
98d383d159 test-tool: add iSCSI SendTargets.Invalid test case
This test sends a series of Text request PDUs with key-value data that
doesn't match SendTargets=All.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
955b16b3e3 test-tool: add iSCSI SendTargets.Simple test
This test currently only sends a SendTargets request via existing normal
iSCSI sessions.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:07:52 +02:00
David Disseldorp
dd17293bcc test-tool: remove unused iscsi_queue_pdu() symbol overload
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>
2019-09-16 19:29:52 +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
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
Ronnie Sahlberg
04b029dc88 TESTS: Allow iser:// style URLs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:21:35 -08: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
73fe55596d TESTS: We need to clear local_iscsi_queue_pdu before each test
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-02 10:45:27 -07:00
Ronnie Sahlberg
39001203b7 TESTS: simple support for READDEFECTDATA10/12
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-22 22:43:16 -07:00
Ronnie Sahlberg
01a8e22207 TESTS: COMPAREANDWRITE should fail if DATAOUT is not exactly 2*TL blocks
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-22 19:12:09 -07:00
Ronnie Sahlberg
bb22ff71eb TESTS: Add tests that a target will reject WriteSame where DataOut has invalid size. 2016-09-21 19:53:22 -07:00
David Disseldorp
e6f2ce306c test: COMPARE AND WRITE against unwritten range
Simulate VMware ESXi behaviour in issuing COMPARE AND WRITE requests
against unwritten ranges.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-07-25 13:00:09 +02:00
David Disseldorp
3644504147 tests: add WRITESAME data verification tests
Based on the corresponding simple tests. Issue a WRITESAME request and
confirm that the data written matches the data read back.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-05-18 11:59:54 +02:00
Sitsofe Wheeler
f291c7f9c0 Tests: Exit iscsi-test-cu with 1 if a test fails
Make it easier for build systems to tell a test run had failures by
changing the exit code to 1.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2016-05-05 17:18:19 +01:00
Sitsofe Wheeler
190f5712fe Tests: Ensure each path sends a different initiator when using multipath
Tests such as ProutPreempt presume each path they have is sending a
different initiator name. When using multipath this did not happen and
initiatorname1 was used on all paths.

Fix this by creating and initializing an array (currently size 2) of
initiator names and iterating it in step with each new path we make
(hopefully the compiler will complain if iscsi-test-cu ever supports
more than two multipaths and there isn't a corresponding initiatorname).

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2016-04-05 09:13:15 +01:00
Ronnie Sahlberg
8afffbd506 Fix compiler warning
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-03-27 10:51:05 -07:00
David Disseldorp
bf9c7cb277 test: simple ABORT TASK TMF test
Dispatch a write and subsequently abort it.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-22 21:27:25 +01:00
David Disseldorp
9ae5a64662 Tests: Asynchronous iSCSI Multipath Compare And Write
Dispatch a number of Compare And Write requests simultaneously via
separate iSCSI sessions and await all responses.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-11 19:16:10 +01:00
David Disseldorp
51da17c41f Tests: Asynchronous iSCSI write test
Dispatch a number of WRITE10 requests simultaneously, and await all
responses.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-11 18:53:24 +01:00
David Disseldorp
ebeca19480 Tests: Asynchronous iSCSI read test
Dispatch a number of READ10 requests simultaneously, and await all
responses.

The iscsi-support test helper functions are currently all synchronous,
so this test mostly uses the bare libiscsi API. As new async tests are
added, we can make a more informed decision on which boilerplate code
can be split out.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-10 18:20:37 +01:00
Ronnie Sahlberg
b4320bd76c Tests: convert tabs to 8 spaces
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 16:17:18 -08:00
Ronnie Sahlberg
1deee0898a Tests: Add a test that RC16 must be supported when SBC3 is claimed
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:51:53 -08:00
Ronnie Sahlberg
f88bcf61cc Tests: Create a global scratch buffer and avoid allocating memory in the tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 15:17:43 -08:00
Ronnie Sahlberg
99a5f99527 Add some emacs defaults. Tabs are 8 spaces.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-18 21:34:43 -08:00
Ronnie Sahlberg
3c44092635 Add a feature to request transparent reconnects without any UA
Normal applications want the current behaviour where we have the library
consume any/all of the UnitAttentions that the target may have queued on the
initial connection, but when we reconnect the session after a failure the
library will pass all the UAs back to the application to process.

Some applications, such as the test suite or really trivial applications
might not want to have to deal with handling of UAs and just "make it work".
Those applications can now request that upon any reconnection of the session
that libiscsi will automatically consume any and all UAs and hide them from
the application.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-12-13 14:29:32 -08:00
Bart Van Assche
0e0073e818 test-tool: Clear persistent reservation keys before tests are run
If a previous run of the test tool had been interrupted one or
more persistent reservation keys can still be registered. This
can cause tests in the new run to fail. Avoid this by clearing
these keys before running any tests. Do this only if --dataloss
has been specified.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:45:32 -07:00
Bart Van Assche
393165d66a test-tool: Remove three casts
This patch does not change any functionality but removes the number
of casts in the test tool source code.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-10-07 07:43:00 -07:00
David Disseldorp
b9b414981c test/pr: PRout PREEMPT remove registration test
Check that the Persistent Reserve Out PREEMT request removes the
registration referenced by the service action key.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:25 +02:00
David Disseldorp
9aa5b55b41 test/pr: simple PRin REPORT CAPABILITIES test
Check that the Persistent Reserve In REPORT CAPABILITIES response
carries valid LENGTH, ALLOW COMMANDS, and PERSISTENT RESERVATION TYPE
MASK fields.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-30 11:00:19 +02:00
Ronnie Sahlberg
e57b266e91 TESTS: Fix how we compute the max transfer length the bus can handle was broken
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-19 14:41:52 -07:00
David Disseldorp
5c0b1b9913 test/pr: simple PR Out CLEAR test
Check that a Persistent Reserve Out CLEAR request:
- clears an existing reservation
- clears existing registration keys
- bumps the PRgeneration number

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-18 18:06:25 +02:00
David Disseldorp
a569d55a0e test/multipath: add COMPARE AND WRITE test
Confirm that data is consistent across paths when using the atomic
COMPARE AND WRITE operation.
This should be extended in future to issue the requests simultaneously
across both paths, in an attempt to trigger a read/write race.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-17 19:13:39 +02:00
David Disseldorp
b9dd210194 test/multipath: add logical unit reset test
This test issues a logical unit reset iSCSI TMF request, and then
confirms that all paths report a subsequent unit attention condition.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-09-17 19:13:39 +02:00
Ronnie Sahlberg
b4cdf07271 Add tests that BlockLimits VPD matches the AtomicWrite16 support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-09 06:49:51 -07:00