From: Azat Khuzhin Date: Sat, 29 Apr 2017 22:11:31 +0000 (+0300) Subject: test: cover that after event_del() callback will not be scheduled again X-Git-Tag: release-2.1.9-beta^2~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23db747652a90b49ca699ef64dcbdd1b60447fe3;p=libevent test: cover that after event_del() callback will not be scheduled again Refs: #236 Refs: #225 (cherry picked from commit 5ff83989f30daef93a851c2162667375ed1663a5) --- diff --git a/test/regress.c b/test/regress.c index dcfb598c..e4ce98c0 100644 --- a/test/regress.c +++ b/test/regress.c @@ -997,9 +997,9 @@ static void del_wait_cb(evutil_socket_t fd, short event, void *arg) { struct timeval delay = { 0, 300*1000 }; - TT_BLATHER(("Sleeping")); + TT_BLATHER(("Sleeping: %i", test_ok)); evutil_usleep_(&delay); - test_ok = 1; + ++test_ok; } static void @@ -1010,7 +1010,7 @@ test_del_wait(void) setup_test("event_del will wait: "); - event_set(&ev, pair[1], EV_READ, del_wait_cb, &ev); + event_set(&ev, pair[1], EV_READ|EV_PERSIST, del_wait_cb, &ev); event_add(&ev, NULL); pthread_create(&thread, NULL, del_wait_thread, NULL); @@ -1034,6 +1034,8 @@ test_del_wait(void) pthread_join(thread, NULL); + tt_int_op(test_ok, ==, 1); + end: ; }