mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -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;
|
extern const struct testcase_setup_t legacy_setup;
|
||||||
void run_legacy_test_fn(void *ptr);
|
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. */
|
/* A couple of flags that basic/legacy_setup can support. */
|
||||||
#define TT_NEED_SOCKETPAIR TT_FIRST_USER_FLAG
|
#define TT_NEED_SOCKETPAIR TT_FIRST_USER_FLAG
|
||||||
#define TT_NEED_BASE (TT_FIRST_USER_FLAG<<1)
|
#define TT_NEED_BASE (TT_FIRST_USER_FLAG<<1)
|
||||||
|
@ -1694,6 +1694,7 @@ testleak_setup(const struct testcase_t *testcase)
|
|||||||
|
|
||||||
allocated_chunks = 0;
|
allocated_chunks = 0;
|
||||||
event_set_mem_functions(cnt_malloc, cnt_realloc, cnt_free);
|
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. */
|
/* not mm_calloc: we don't want to mess with the count. */
|
||||||
|
@ -167,6 +167,7 @@ test_edgetriggered_mix_error(void *data_)
|
|||||||
tt_skip();
|
tt_skip();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!libevent_tests_running_in_debug_mode)
|
||||||
event_enable_debug_mode();
|
event_enable_debug_mode();
|
||||||
|
|
||||||
base = event_base_new();
|
base = event_base_new();
|
||||||
|
@ -412,6 +412,8 @@ struct testlist_alias_t testaliases[] = {
|
|||||||
END_OF_ALIASES
|
END_OF_ALIASES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int libevent_tests_running_in_debug_mode = 0;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, const char **argv)
|
main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
@ -438,8 +440,10 @@ main(int argc, const char **argv)
|
|||||||
evthread_enable_lock_debugging();
|
evthread_enable_lock_debugging();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getenv("EVENT_DEBUG_MODE"))
|
if (getenv("EVENT_DEBUG_MODE")) {
|
||||||
event_enable_debug_mode();
|
event_enable_debug_mode();
|
||||||
|
libevent_tests_running_in_debug_mode = 1;
|
||||||
|
}
|
||||||
|
|
||||||
tinytest_set_aliases(testaliases);
|
tinytest_set_aliases(testaliases);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user