mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 12:28:19 -04:00
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.
This commit is contained in:
parent
b3aca5d96c
commit
b1b054f064
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user