You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2015/04/07 14:15:00 UTC

svn commit: r1671829 - /apr/apr/branches/1.6.x/test/testpoll.c

Author: trawick
Date: Tue Apr  7 12:15:00 2015
New Revision: 1671829

URL: http://svn.apache.org/r1671829
Log:
Backport the parts of trunk r899905 that add a minimal testcase
for apr_pollset_wakeup().  (The other parts do not apply to
1.6.x.)

Submitted by: Neil Conway <nr...@cs.berkeley.edu>

Modified:
    apr/apr/branches/1.6.x/test/testpoll.c

Modified: apr/apr/branches/1.6.x/test/testpoll.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/test/testpoll.c?rev=1671829&r1=1671828&r2=1671829&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/test/testpoll.c (original)
+++ apr/apr/branches/1.6.x/test/testpoll.c Tue Apr  7 12:15:00 2015
@@ -769,6 +769,28 @@ static void pollcb_default(abts_case *tc
     }
 }
 
+static void pollset_wakeup(abts_case *tc, void *data)
+{
+    apr_status_t rv;
+    apr_pollset_t *pollset;
+    apr_int32_t num;
+    const apr_pollfd_t *descriptors;
+
+    rv = apr_pollset_create(&pollset, 1, p, APR_POLLSET_WAKEABLE);
+    if (rv == APR_ENOTIMPL) {
+        ABTS_NOT_IMPL(tc, "apr_pollset_wakeup() not supported");
+        return;
+    }
+    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);
+
+    rv = apr_pollset_poll(pollset, -1, &num, &descriptors);
+    ABTS_INT_EQUAL(tc, APR_EINTR, rv);
+}
+
 static void justsleep(abts_case *tc, void *data)
 {
     apr_int32_t nsds;
@@ -871,6 +893,7 @@ abts_suite *testpoll(abts_suite *suite)
     abts_run_test(suite, close_all_sockets, NULL);
     abts_run_test(suite, pollset_default, NULL);
     abts_run_test(suite, pollcb_default, NULL);
+    abts_run_test(suite, pollset_wakeup, NULL);
     abts_run_test(suite, justsleep, NULL);
     return suite;
 }