rearrange nm_teardown() to check correctness after shutting down

if a test failed at the beginning of nm_teardown(), the function
would abort before isc_nm_destroy() or isc_tlsctx_free() were reached;
we would then abort when nm_setup() was run for the next test case.
rearranging the teardown function prevents this problem.
This commit is contained in:
Evan Hunt
2021-04-02 22:34:18 -07:00
committed by Ondřej Surý
parent 86f4872dd6
commit 426c40c96d

View File

@@ -330,27 +330,27 @@ static int
nm_teardown(void **state __attribute__((unused))) {
UNUSED(state);
WAIT_FOR_EQ(active_cconnects, 0);
WAIT_FOR_EQ(active_csends, 0);
WAIT_FOR_EQ(active_csends, 0);
WAIT_FOR_EQ(active_ssends, 0);
WAIT_FOR_EQ(active_sreads, 0);
isc_nm_destroy(&connect_nm);
assert_null(connect_nm);
isc_nm_destroy(&listen_nm);
assert_null(listen_nm);
isc_tlsctx_free(&tcp_connect_tlsctx);
isc_tlsctx_free(&tcp_listen_tlsctx);
WAIT_FOR_EQ(active_cconnects, 0);
WAIT_FOR_EQ(active_csends, 0);
WAIT_FOR_EQ(active_csends, 0);
WAIT_FOR_EQ(active_ssends, 0);
WAIT_FOR_EQ(active_sreads, 0);
isc_refcount_destroy(&active_cconnects);
isc_refcount_destroy(&active_csends);
isc_refcount_destroy(&active_creads);
isc_refcount_destroy(&active_ssends);
isc_refcount_destroy(&active_sreads);
isc_tlsctx_free(&tcp_connect_tlsctx);
isc_tlsctx_free(&tcp_listen_tlsctx);
return (0);
}