]> granicus.if.org Git - libevent/commitdiff
Make all tests pass under EVENT_DEBUG_MODE=1
authorNick Mathewson <nickm@torproject.org>
Fri, 26 Apr 2013 16:12:08 +0000 (12:12 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 26 Apr 2013 16:12:08 +0000 (12:12 -0400)
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
test/regress_dns.c
test/regress_et.c
test/regress_main.c

index 449a59b0080bc450cc14c732e3df37841ee7c9b2..4e4844d2f35fc16a0198977c681f13104310cf57 100644 (file)
@@ -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)
index 094613d49d984d324f98589b09631bd51adec5ec..9990b0e66e09b3cd51dcb88e5cb1881f8d92753e 100644 (file)
@@ -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));
index cb3d1ceb56396a1ea9ef58d95bec1711e0465eec..229a78e2d429722fdcab5de36b35415f627655cd 100644 (file)
@@ -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();
 
index a47a78ae5b3e4efd6cb787d26acfa2823b62f9ee..ca6b2cb5cdb0028cbf60d24733ce3ae3c16b4bec 100644 (file)
@@ -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);