summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-01-03 09:49:38 +0000
committerYann Ylavic <ylavic@apache.org>2018-01-03 09:49:38 +0000
commitf54067bf7f6d79dd2dcaddbdf43d720e4ddf36ee (patch)
tree9cd079346ddae5acc42451b2af0f6e26a03b3ba3 /test
parent3e86f0bd7b20a9c387042430c638837407da9363 (diff)
downloadapr-f54067bf7f6d79dd2dcaddbdf43d720e4ddf36ee.tar.gz
Merge r1819857, r1819858, r1819860, r1819861, r1819934, r1819935 from trunk:
testpoll: check that the wakeup pipe is still in the pollset after returning from poll(), e.g. APR_POLLSET_PORT should re-arm it automatically. poll, port: re-add the wakeup pipe to the pollset after it triggered. Just like user fds (file, socket), otherwise it's one shot only (PR-61786). Corresponding test committed in r1819857. poll, port: no need to release and re-acquire the lock in between walking the pollset and handling the dead ring, all is simple/fast/nonblocking ops. Also, set types of "i" and "j" respectively to the ones of nget and *num. poll, port: follow up to r1819860. This test is redundant now, axe it (no functional change). poll, kqueue: save a pollfd (mem)copy per returned event. poll, epoll: pollset's pfd is not modified on poll(), mark it const. Reviewed/backported by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1819937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/testpoll.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/testpoll.c b/test/testpoll.c
index 644983df3..9f90af2dd 100644
--- a/test/testpoll.c
+++ b/test/testpoll.c
@@ -783,6 +783,7 @@ static void pollset_wakeup(abts_case *tc, void *data)
apr_pollset_t *pollset;
apr_int32_t num;
const apr_pollfd_t *descriptors;
+ int i;
rv = apr_pollset_create_ex(&pollset, 1, p, APR_POLLSET_WAKEABLE,
default_pollset_impl);
@@ -792,12 +793,18 @@ static void pollset_wakeup(abts_case *tc, void *data)
}
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- /* send wakeup but no data; apr_pollset_poll() should return APR_EINTR */
- rv = apr_pollset_wakeup(pollset);
- ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ /* Send wakeup but no data; apr_pollset_poll() should return APR_EINTR.
+ * Do it twice to test implementations that need to re-arm the events after
+ * poll()ing (e.g. APR_POLLSET_PORT), hence verify that the wakeup pipe is
+ * still in the place afterward.
+ */
+ for (i = 0; i < 2; ++i) {
+ rv = apr_pollset_wakeup(pollset);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- rv = apr_pollset_poll(pollset, -1, &num, &descriptors);
- ABTS_INT_EQUAL(tc, APR_EINTR, rv);
+ rv = apr_pollset_poll(pollset, -1, &num, &descriptors);
+ ABTS_INT_EQUAL(tc, APR_EINTR, rv);
+ }
/* send wakeup and data; apr_pollset_poll() should return APR_SUCCESS */
socket_pollfd.desc_type = APR_POLL_SOCKET;