apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: testpoll.c:multi_event_pollset and 1.2.x
Date Wed, 15 Mar 2006 12:09:06 GMT
On Tue, Mar 14, 2006 at 01:19:31PM -0800, Garrett Rooney wrote:
> Does anyone have an objection to reverting the addition of the new
> multi_event_pollset test on the 1.2.x branch?  It's testing for
> behavior that's never existed for a number of pollset back ends (at
> least kqueue, potentially epoll as well), and nobody has jumped up to
> make the test pass on those platforms in trunk, let alone get a fix
> that can be backported.
> 
> For the curious, the problem is that kqueue doesn't consolidate the
> events it returns, so you can get two separate events for the same
> file descriptor, some read, some write, etc.
> 
> Given that we've always had this behavior in the 1.x releases and
> nobody's complained about it, I'm willing to just say that the test is
> bogus.  If someone wants to rework the kqueue (and probably epoll)
> impls to meet this new standard that's something that can be
> discussed, but for now there's no real justification for us to
> suddenly condemn their behavior.

Returning two separate descriptors should be valid behaviour, the test 
just needs to be adjusted to handle that case; it'll still catch the bug 
in the select() backend.  Can you try this patch?

Index: testpoll.c
===================================================================
--- testpoll.c	(revision 385518)
+++ testpoll.c	(working copy)
@@ -309,10 +309,25 @@
 
     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);
+    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 if (lrv == 2) {
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
+        ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);
+        ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s);
+        ABTS_PTR_EQUAL(tc, s[0], descs[1].client_data);
+        ABTS_ASSERT(tc, "returned events incorrect",
+                    ((descs[0].rtnevents | descs[1].rtnevents)
+                     == (APR_POLLIN | APR_POLLOUT))
+                    && descs[0].rtnevents != descs[1].rtnevents);
+    }
+    else {
+        ABTS_ASSERT(tc, "either one or two events returned",
+                    lrv == 1 || lrv == 2);
+    }
 
     recv_msg(s, 0, p, tc);
 


Mime
View raw message