44 Commits

Author SHA1 Message Date
David Disseldorp
311548e860 test-tool: add iSCSICHAP.Base64 test
Some targets such as LIO support base64 encoded CHAP_R values. Test this
by intercepting hex-encoded CHAP_R responses and converting the value to
base64.
This will fail on targets which don't support base64; we should probably
skip the test instead.
base64 encoding is performed using the gnutls_base64_encode2() function,
so the test is only present for gnutls-enabled builds.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2026-05-21 21:53:43 +10:00
Anatoliy Glagolev
19d05ab7a7 RTPG support
Implementing support of the Report Target Port Groups command.

Tested on Ubuntu against Pure Storage Flash Array
using designated unit tests and new iscsi-rtpg utility

./iscsi-rtpg  -i iqn.2005-03.org.open-iscsi:6feb2db21ea iscsi://192.168.1.12/iqn.2010-06.com.purestorage:flasharray.4e8d52d82e4b2c0f/1
RTPG retrieved 2 groups
Group 0x0000: preferred 0, format 0x00, ALUA state ACTIVE-OPTIMIZED,flags 0x8f, status code 0x02, port count 65
Ports: [ 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a 0x4b 0x4c
0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67
0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71]
Group 0x0001: preferred 0, format 0x00, ALUA state ACTIVE-OPTIMIZED,flags 0x8f, status code 0x02, port count 65
Ports: [ 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7a
0x7b 0x7c 0x7d 0x7e 0x7f 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 0x92 0x93 0x94 0x95
0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2]
2025-07-03 17:20:52 -06:00
Bart Van Assche
2a5a0b3291 Enable -Wno-unused-parameter
Instead of adding __attribute__((unused)) to unused arguments, add the
-Wno-unused-parameter compiler flag.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 13:23:41 -07:00
Bart Van Assche
ea6b2282d4 Use __attribute__((format(printf, ...))) directly
Instead of defining the macro _R_(), define __attribute__() as a macro for
compilers that do not support __attribute__(), namely Microsoft Visual
Studio.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 11:52:40 -07:00
orbea
c437afa825 build: Add -no-undefined where missing
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:32:12 -07:00
orbea
9649fe1ddc build: Correct usage of LIBADD and LDADD
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:31:52 -07:00
orbea
c547d2dc7f build: Remove bogus LDADD variables
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:31:50 -07:00
Anastasia Kovaleva
2e8c571955 test-tool: Refactoring residuals write tests
Looking at test_write10_residuals.c, test_write12_residuals.c and
test_write16_residuals.c tests the similarity of the testing scenario
can be found. There are several EDTL and SPDTL combinations which are
the same for different length write command tests. They form the core
of testing scenario of these commands. There aren't so much differences
in the way of testing these combinations itself either. It is possible
to move the main parameters describing the testing scenario into a
separate structure and move the scenario itself into a separate function.
It will increase the readability and reduce the duplicate code of these tests.
2021-02-08 15:23:49 +03:00
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
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
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
2714f7705a test-tool/build: link against libiscsipriv.la
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>
2019-09-18 01:25:34 +02: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
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
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
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
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
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
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
Ronnie Sahlberg
6c16f9e322 Add tests for WRITE_ATOMIC_16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-09-08 10:17:15 -07:00
Ronnie Sahlberg
a6f7c06119 Add support and tests for ExtendedCopy and ReceiveCopyResults
From sushma.gurram@sandisk.com
Add support to libiscsi and tests for these two opcodes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-08-02 12:57:21 -07:00
Ronnie Sahlberg
ed17e17f8e Fix broken makefile
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-06-16 07:06:43 -07:00
David Disseldorp
34dea87a69 test: add simple multipath IO test
Write data to device via one path, then read back using a different
path. Confirm that data is correct.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-05-28 19:27:21 +02:00
David Disseldorp
a291c2b308 test: add multipath helper functions
mpath_check_matching_ids() walks the list of scsi devices, and confirms
that all entries share one common device identification designator or
unit serial number.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2015-05-28 16:52:54 +02:00
Chris Zankel
e186169064 build: fix 'out-of-tree' build
Prefix include paths with '${srcdir}' to allow 'out-of-tree' builds:

  cd $BUILD
  $LIBISCSI/configure
  make

Signed-off-by: Chris Zankel <chris@zankel.net>
2015-04-22 18:18:14 -07:00
Ronnie Sahlberg
b6fc366b5c TESTS: Add a test for D_SENSE in the CONTROL mode page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-04-19 18:20:12 -07:00
Ronnie Sahlberg
ba120e4347 TESTS: Add a test for the SWP flag in the CONTROL mode page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-04-18 08:27:03 -07:00
Ronnie Sahlberg
4e174f5d7c TESTS: Add basic test for CONTROL mode page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-04-18 08:03:15 -07:00
Ronnie Sahlberg
d33a0438a4 TESTS: replace read* flags tests with dedicated dpo/fua tests
Remove the flags tests for READ* and replace them with a test for the DPO
and FUA bits.
IF the device claims DPOFUA support in modesense then the READ* CDBs
MUST allow these two flags. IF the device does NOT claim DPOFUA then any
READ* CDB with these flags must fail with invalod field in cdb.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-22 20:05:29 -08: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
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
ea790b2f75 AUTOTOOLS: Add Makefile.am to test-tool 2014-03-22 16:46:25 -07:00