]> granicus.if.org Git - libevent/commitdiff
regress_dns: drop hack for event_debug_map_HT_GROW in leak tests
authorAzat Khuzhin <a3at.mail@gmail.com>
Thu, 8 Jan 2015 01:45:49 +0000 (04:45 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Thu, 8 Jan 2015 01:51:27 +0000 (04:51 +0300)
test/regress_dns.c

index e03c143ca8d9d885846640820fc90db3d886e983..b91b31f1acc3f5d1c4de0f1e7fdd90c7a36a86b3 100644 (file)
@@ -1788,9 +1788,15 @@ testleak_setup(const struct testcase_t *testcase)
        struct testleak_env_t *env;
 
        allocated_chunks = 0;
+
+       /* Reset allocation counter, to start allocations from the very beginning.
+        * (this will avoid false-positive negative numbers for allocated_chunks)
+        */
+       libevent_global_shutdown();
+
        event_set_mem_functions(cnt_malloc, cnt_realloc, cnt_free);
-       if (!libevent_tests_running_in_debug_mode)
-               event_enable_debug_mode();
+
+       event_enable_debug_mode();
 
        /* not mm_calloc: we don't want to mess with the count. */
        env = calloc(1, sizeof(struct testleak_env_t));
@@ -1811,8 +1817,8 @@ testleak_cleanup(const struct testcase_t *testcase, void *env_)
 #ifdef EVENT__DISABLE_DEBUG_MODE
        tt_int_op(allocated_chunks, ==, 0);
 #else
-       /* FIXME: that's `1' because of event_debug_map_HT_GROW */
-       tt_int_op(allocated_chunks, ==, 1);
+       libevent_global_shutdown();
+       tt_int_op(allocated_chunks, ==, 0);
 #endif
        ok = 1;
 end: