diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-04-26 19:14:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-04-26 19:14:05 -0400 |
commit | 702c9aa40370f3770ab2e81648cf29ba5ce2466e (patch) | |
tree | dab06e258933abadb6fbb6d43951ee5b50106b01 /test/regress.c | |
parent | d5967397b0f321a758fa94d2f0d1b9ed7adcb178 (diff) | |
download | libevent-702c9aa40370f3770ab2e81648cf29ba5ce2466e.tar.gz |
Fix a bug in the new main/event_foreach test
It wasn't making sure that the events weren't internal.
Diffstat (limited to 'test/regress.c')
-rw-r--r-- | test/regress.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/regress.c b/test/regress.c index 01717955..00071a74 100644 --- a/test/regress.c +++ b/test/regress.c @@ -2684,6 +2684,8 @@ foreach_count_cb(const struct event_base *base, const struct event *ev, void *ar { struct foreach_helper *h = event_get_callback_arg(ev); struct timeval *tv = arg; + if (event_get_callback(ev) != timeout_cb) + return 0; tt_ptr_op(event_get_base(ev), ==, base); tt_int_op(tv->tv_sec, ==, 10); h->ev = ev; @@ -2698,6 +2700,8 @@ foreach_find_cb(const struct event_base *base, const struct event *ev, void *arg { const struct event **ev_out = arg; struct foreach_helper *h = event_get_callback_arg(ev); + if (event_get_callback(ev) != timeout_cb) + return 0; if (h->count == 99) { *ev_out = ev; return 101; @@ -2716,15 +2720,15 @@ test_event_foreach(void *arg) struct timeval ten_sec = {10,0}; const struct event *ev_found = NULL; - tt_int_op(-1, ==, event_base_foreach_event(NULL, foreach_count_cb, NULL)); - tt_int_op(-1, ==, event_base_foreach_event(base, NULL, NULL)); - for (i = 0; i < 5; ++i) { visited[i].count = 0; visited[i].ev = NULL; ev[i] = event_new(base, -1, 0, timeout_cb, &visited[i]); } + tt_int_op(-1, ==, event_base_foreach_event(NULL, foreach_count_cb, NULL)); + tt_int_op(-1, ==, event_base_foreach_event(base, NULL, NULL)); + event_add(ev[0], &ten_sec); event_add(ev[1], &ten_sec); event_active(ev[1], EV_TIMEOUT, 1); |