]> granicus.if.org Git - libevent/commitdiff
New test for active_later->active transition on event_active
authorNick Mathewson <nickm@torproject.org>
Fri, 26 Apr 2013 17:49:45 +0000 (13:49 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 26 Apr 2013 17:49:45 +0000 (13:49 -0400)
When event_active is called, an active_later event is supposed to become
active now.  We had lacked a test for that.

test/regress.c

index bfd2e78bc44ab42d17f8c5b754dce0fb3922084c..961bc0640eac4c36f0ad82deb699ece6e58d5360 100644 (file)
@@ -1407,6 +1407,12 @@ test_active_later(void *ptr)
        tt_int_op(n_read_and_drain_cb, >, 100);
        tt_int_op(n_activate_other_event_cb, >, 100);
 
+       event_active_later_(&ev4, EV_READ);
+       event_active(&ev4, EV_READ, 1); /* This should make the event
+                                          active immediately. */
+       tt_assert((ev4.ev_flags & EVLIST_ACTIVE) != 0);
+       tt_assert((ev4.ev_flags & EVLIST_ACTIVE_LATER) == 0);
+
        /* Now leave this one around, so that event_free sees it and removes
         * it. */
        event_active_later_(&ev3, EV_READ);