In the test iSCSI.iSCSITMF.LUNResetSimpleAsync
CU_ASSERT_EQUAL(reconnect_succeeded, 1) must be called after the async
TMF command completes. Hence move that assert into the TMF completion
callback.
This patch fixes a race condition.
[bvanassche: edited commit message]
iscsi_logout_sync in lu_reset_simple will still refer to wtask in the
case that we bail out due to reconnect failure.
abort_simple would sometimes refer to wtask during iscsi_logout_sync,
even if the test passed.
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Since it is easy to trigger a stack overflow with variable-length arrays,
use dynamic memory allocation instead of VLAs. Add -Wvla to the compiler
options such that no new VLAs get introduced.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
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>
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>