apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bri...@apache.org>
Subject [PATCH] testpoll fix
Date Tue, 31 Jan 2006 04:47:42 GMT
This patch should allow the APR testpoll test to work with pollset  
implementations
where readability and writability events on the same descriptor can  
end up in two
separate pollfd_t objects, such as kqueue.

The only pollset implementations for which I have test environments,  
though, are
select and epoll.  Can someone with *BSD please try this patch and  
let me know if
testpoll passes with the kqueue impl?

Thanks,
Brian

Index: test/testpoll.c
===================================================================
--- test/testpoll.c     (revision 373696)
+++ test/testpoll.c     (working copy)
@@ -309,11 +309,20 @@
      rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
      ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));
-    ABTS_INT_EQUAL(tc, 1, lrv);
-    ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
-    ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);
-    ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);
-
+    ABTS_TRUE(tc, ((lrv == 1) || (lrv == 2)));
+    if (lrv == 1) {
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
+        ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs 
[0].rtnevents);
+        ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);
+    }
+    else {
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
+        ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s);
+        ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT,
+                       descs[0].rtnevents | descs[1].rtnevents);
+        ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);
+        ABTS_PTR_EQUAL(tc, s[0],  descs[1].client_data);
+    }
      recv_msg(s, 0, p, tc);
      rv = apr_pollset_poll(pollset, 0, &lrv, &descs);


Mime
View raw message