Commit Graph

735 Commits

Author SHA1 Message Date
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
Ronnie Sahlberg
f6570e6f12 TESTS: Abort the cold/warm reset tests if the target support is missing.
Not all targets support cold/warm reset task management functions.
Abort these tests if the support is missing and the commands fail.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-02 15:35:46 -07:00
Ronnie Sahlberg
c27db02a30 TESTS: Fix startstopunit test
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-10-02 11:29:17 -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
2e947cc1de TESTS: WRITESAME1* with 0 DataOut should fail if WSNZ is set
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-22 18:44:44 -07:00
Ronnie Sahlberg
875c0222f2 Revert "TESTS: Fix writesame1* unmap until end tests"
This reverts commit 6aa8c17b59.
2016-09-22 06:26:12 -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
Ronnie Sahlberg
6aa8c17b59 TESTS: Fix writesame1* unmap until end tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-09-21 19:05:15 -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
871eb1b61b test: don't segfault in TMF callback on reconnect
Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-07-21 21:29:33 +02:00
Ronnie Sahlberg
df1dc08eb7 TESTS: cleanup and remove noise warnings for iscsi cmdsn tests
The iscsi cmdsn tests are noisy and generate a lot of [FAILURE]
warnings for things that are expected.
Fix this by do the plumbing to allow using a EXPECT_STATUS_TIMEOUT
for commands we expect will never be replied to and will thus time out.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-11 20:50:47 -07:00
Sitsofe Wheeler
b908bdeb99 Tests: WRITESAME 0-blocks fixes and improvements
The current WRITE SAME (WS) 0 blocks test at LBA 0 isn't always correct
because if:
- The target's WSNZ bit set is 0
- The target's MAXIMUM WRITE SAME LENGTH (MWSL) is greater than 0
- We are issuing a WS with a NUMBER OF LOGICAL BLOCKS of 0

then whether the command should return success or failure depends on
whether the starting LBA is within MWSL blocks of the end of the LUN
(see http://www.t10.org/pipermail/t10/2016-May/017988.html for details).

Replace the vestigial code which tried to handle this (but no longer
worked since commit 8585e4509b ) and add
some additional MAXIMUM WRITE SAME LENGTH tests.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2016-05-30 12:37:58 +01:00
Ronnie Sahlberg
99980b2437 TESTS: fix unsigned/signed warning in writesame tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-05-23 21:47:21 -07: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
Ronnie Sahlberg
a6fc65b4ef Tests: remove the warning if a SSD supports SANITIZE/OVERWRITE
There is technically no reason why a SSD with (assumingly with thin
provisioning) can not support SANITIZE/OVERWRITE instead or or in addition
to the more expected SANITIZE/BLOCK-ERASE so remove the warning for this.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-05-01 12:35:29 -07: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
678d70eb68 Tests: writeatimic simple. Make sure that writes are aligned correctly
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-04-03 09:56:16 -07:00
Sitsofe Wheeler
71879c913a Silence clang missing-field-initializers warning
When libiscsi is built with clang several spurious
missing-field-initializers warnings like the following are reported:

test_async_write.c:61:45: error: missing field 'completed' initializer
[-Werror,-Wmissing-field-initializers]
	struct tests_async_write_state state = { 0 };

These appear to be due to clang being overzealous in its checking
because the code is legal C (see
https://llvm.org/bugs/show_bug.cgi?id=21689 ) but it causes compilation
to be aborted. Workaround the problem by specifying a 0 or NULL for each
structure member.
2016-03-31 20:32:47 +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
bfd614053e test-tool: add test_get_clock_sec() helper
Useful for test IO timeouts.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-22 21:19:59 +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