From e866dc36e0211847d8c7fa82a628f65fe250bd4e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 4 May 2017 15:08:32 -0700 Subject: [PATCH] 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 --- test-tool/test_async_abort_simple.c | 5 +++++ test-tool/test_async_lu_reset_simple.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/test-tool/test_async_abort_simple.c b/test-tool/test_async_abort_simple.c index b7ed825..3f3ff58 100644 --- a/test-tool/test_async_abort_simple.c +++ b/test-tool/test_async_abort_simple.c @@ -203,4 +203,9 @@ test_async_abort_simple(void) } scsi_free_scsi_task(state.wtask); + + /* Avoid that callbacks get invoked after this test finished */ + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); + sd->iscsi_ctx = NULL; } diff --git a/test-tool/test_async_lu_reset_simple.c b/test-tool/test_async_lu_reset_simple.c index 64e2559..e957a5c 100644 --- a/test-tool/test_async_lu_reset_simple.c +++ b/test-tool/test_async_lu_reset_simple.c @@ -192,4 +192,9 @@ test_async_lu_reset_simple(void) } scsi_free_scsi_task(state.wtask); + + /* Avoid that callbacks get invoked after this test finished */ + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); + sd->iscsi_ctx = NULL; }