From b1b054f0646386ebb3c87585d5991dbc370eabfd Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 26 Apr 2013 12:12:08 -0400 Subject: [PATCH] Make all tests pass under EVENT_DEBUG_MODE=1 The fix was easy: the tests that were failing were those tests that also enabled debug mode themselves. So, let them know when EVENT_DEBUG_MODE is on, so they won't do that. --- test/regress.h | 2 ++ test/regress_dns.c | 3 ++- test/regress_et.c | 3 ++- test/regress_main.c | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/regress.h b/test/regress.h index 449a59b0..4e4844d2 100644 --- a/test/regress.h +++ b/test/regress.h @@ -78,6 +78,8 @@ extern const struct testcase_setup_t basic_setup; extern const struct testcase_setup_t legacy_setup; void run_legacy_test_fn(void *ptr); +extern int libevent_tests_running_in_debug_mode; + /* A couple of flags that basic/legacy_setup can support. */ #define TT_NEED_SOCKETPAIR TT_FIRST_USER_FLAG #define TT_NEED_BASE (TT_FIRST_USER_FLAG<<1) diff --git a/test/regress_dns.c b/test/regress_dns.c index 094613d4..9990b0e6 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -1694,7 +1694,8 @@ testleak_setup(const struct testcase_t *testcase) allocated_chunks = 0; event_set_mem_functions(cnt_malloc, cnt_realloc, cnt_free); - event_enable_debug_mode(); + if (!libevent_tests_running_in_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)); diff --git a/test/regress_et.c b/test/regress_et.c index cb3d1ceb..229a78e2 100644 --- a/test/regress_et.c +++ b/test/regress_et.c @@ -167,7 +167,8 @@ test_edgetriggered_mix_error(void *data_) tt_skip(); #endif - event_enable_debug_mode(); + if (!libevent_tests_running_in_debug_mode) + event_enable_debug_mode(); base = event_base_new(); diff --git a/test/regress_main.c b/test/regress_main.c index a47a78ae..ca6b2cb5 100644 --- a/test/regress_main.c +++ b/test/regress_main.c @@ -412,6 +412,8 @@ struct testlist_alias_t testaliases[] = { END_OF_ALIASES }; +int libevent_tests_running_in_debug_mode = 0; + int main(int argc, const char **argv) { @@ -438,8 +440,10 @@ main(int argc, const char **argv) evthread_enable_lock_debugging(); #endif - if (getenv("EVENT_DEBUG_MODE")) + if (getenv("EVENT_DEBUG_MODE")) { event_enable_debug_mode(); + libevent_tests_running_in_debug_mode = 1; + } tinytest_set_aliases(testaliases); -- 2.40.0