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>
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.