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>
This commit is contained in:
Bart Van Assche
2017-05-04 15:08:32 -07:00
committed by Ronnie Sahlberg
parent 4591a82209
commit e866dc36e0
2 changed files with 10 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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;
}