]> granicus.if.org Git - libevent/commitdiff
test/dns: in solaris under EMFILE devpoll does not dispatch (due DP_POLL failure)
authorAzat Khuzhin <azat@libevent.org>
Mon, 4 Feb 2019 19:34:10 +0000 (22:34 +0300)
committerAzat Khuzhin <azat@libevent.org>
Mon, 4 Feb 2019 19:43:47 +0000 (22:43 +0300)
test/regress_dns.c

index df696f0c96d249ae93a9002f53c24f8902ffb136..9f1d6283c293a17dba7e045f07804ea3560c41cd 100644 (file)
@@ -1215,6 +1215,7 @@ test_bufferevent_connect_hostname(void *arg)
        int success = BEV_EVENT_CONNECTED;
        int default_error = 0;
        unsigned i;
+       int ret;
 
        if (emfile) {
                success = BEV_EVENT_ERROR;
@@ -1225,6 +1226,7 @@ test_bufferevent_connect_hostname(void *arg)
 #elif defined(__sun__)
                /* on solaris it returns EAI_FAIL */
                default_error = EVUTIL_EAI_FAIL;
+               /** the DP_POLL can also fail with EINVAL under EMFILE */
 #else
                /* on osx/freebsd it returns EAI_NONAME */
                default_error = EVUTIL_EAI_NONAME;
@@ -1307,7 +1309,17 @@ test_bufferevent_connect_hostname(void *arg)
        tt_assert(!bufferevent_socket_connect_hostname(be[2], dns, AF_INET,
                "nobodaddy.example.com", listener_port));
 
-       event_base_dispatch(data->base);
+       ret = event_base_dispatch(data->base);
+#ifdef __sun__
+       if (emfile && !strcmp(event_base_get_method(data->base), "devpoll")) {
+               tt_int_op(ret, ==, -1);
+               /** DP_POLL failed */
+               tt_skip();
+       } else
+#endif
+       {
+               tt_int_op(ret, ==, 0);
+       }
 
        tt_int_op(be_outcome[0].what, ==, BEV_EVENT_ERROR);
        tt_int_op(be_outcome[0].dnserr, ==, EVUTIL_EAI_NONAME);