apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/test testpoll.c
Date Sun, 15 Dec 2002 19:22:10 GMT
rbb         2002/12/15 11:22:10

  Modified:    test     testpoll.c
  Log:
  Use less sockets in the large pollset.  Solaris has a default fd limit of
  64, and we were hitting it when testpoll was run as a part of the test
  suite.  Tests should clean up after themselves, but if they don't, we now
  have 15 fd's lee-way built-in.
  
  Also, we were seg-faulting if we hit that limit, because some of the
  sockets in the array would be NULL.  Now, we don't seg-fault, although
  we do fail a lot of tests if we hit the limit.
  
  Revision  Changes    Path
  1.23      +12 -1     apr/test/testpoll.c
  
  Index: testpoll.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testpoll.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- testpoll.c	28 Nov 2002 08:35:26 -0000	1.22
  +++ testpoll.c	15 Dec 2002 19:22:10 -0000	1.23
  @@ -61,7 +61,11 @@
   #include "apr_poll.h"
   
   #define SMALL_NUM_SOCKETS 3
  -#define LARGE_NUM_SOCKETS 64
  +/* We can't use 64 here, because some platforms *ahem* Solaris *ahem* have
  + * a default limit of 64 open file descriptors per process.  If we use
  + * 64, the test will fail even though the code is correct.
  + */
  +#define LARGE_NUM_SOCKETS 50
   
   static apr_socket_t *s[LARGE_NUM_SOCKETS];
   static apr_sockaddr_t *sa[LARGE_NUM_SOCKETS];
  @@ -112,6 +116,8 @@
       apr_size_t len = 5;
       apr_status_t rv;
   
  +    CuAssertPtrNotNull(tc, sockarray[which]);
  +
       rv = apr_socket_sendto(sockarray[which], sas[which], 0, "hello", &len);
       CuAssertIntEquals(tc, APR_SUCCESS, rv);
       CuAssertIntEquals(tc, strlen("hello"), len);
  @@ -125,6 +131,8 @@
       apr_sockaddr_t *recsa;
       apr_status_t rv;
   
  +    CuAssertPtrNotNull(tc, sockarray[which]);
  +
       apr_sockaddr_info_get(&recsa, "127.0.0.1", APR_UNSPEC, 7770, 0, p);
   
       rv = apr_socket_recvfrom(recsa, sockarray[which], 0, buffer, &buflen);
  @@ -317,6 +325,9 @@
   
       for (i = 0; i < LARGE_NUM_SOCKETS;i++){
           apr_pollfd_t socket_pollfd;
  +
  +        CuAssertPtrNotNull(tc, s[i]);
  +
           socket_pollfd.desc_type = APR_POLL_SOCKET;
           socket_pollfd.reqevents = APR_POLLIN;
           socket_pollfd.desc.s = s[i];
  
  
  

Mime
View raw message