apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: apr/test testpoll.c
Date Tue, 06 Aug 2002 04:08:03 GMT
brianp      2002/08/05 21:08:03

  Modified:    test     testpoll.c
  Log:
  Added more detailed checking of the apr_pollset_poll results
  
  Revision  Changes    Path
  1.19      +18 -3     apr/test/testpoll.c
  
  Index: testpoll.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testpoll.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- testpoll.c	4 Aug 2002 04:43:23 -0000	1.18
  +++ testpoll.c	6 Aug 2002 04:08:03 -0000	1.19
  @@ -255,6 +255,7 @@
           socket_pollfd.desc_type = APR_POLL_SOCKET;
           socket_pollfd.reqevents = APR_POLLIN;
           socket_pollfd.desc.s = s[i];
  +        socket_pollfd.client_data = s[i];
           if (apr_pollset_add(pollset, &socket_pollfd) != APR_SUCCESS){
               printf("Failed to add socket %d\n", i);
               exit (-1);
  @@ -272,8 +273,11 @@
   
       printf("\nTest 2: First descriptor signalled.....\n");
       send_msg(s, sa, 0);
  +    descriptors_out = NULL;
       if ((rv = apr_pollset_poll(pollset, 0, &num, &descriptors_out)
  -         != APR_SUCCESS) || (num != 1)) {
  +         != APR_SUCCESS) || (num != 1) || !descriptors_out ||
  +        (descriptors_out[0].desc.s != s[0]) ||
  +        (descriptors_out[0].client_data != s[0])) {
           printf("Test 2: FAILED (errno=%d, num=%d (expected 1)\n", rv, num);
           exit(-1);
       }
  @@ -283,8 +287,16 @@
       printf("\nTest 3: Middle descriptors signalled.....\n");
       send_msg(s, sa, 2);
       send_msg(s, sa, 5);
  +    descriptors_out = NULL;
  +    /* note that the descriptors in the result set can be in
  +     * any order, so we have to test for both permutations here
  +     */
       if ((rv = apr_pollset_poll(pollset, 0, &num, &descriptors_out)
  -         != APR_SUCCESS) || (num != 2)) {
  +         != APR_SUCCESS) || (num != 2) || !descriptors_out ||
  +        !(((descriptors_out[0].desc.s == s[2]) &&
  +           (descriptors_out[1].desc.s == s[5])) ||
  +          ((descriptors_out[0].desc.s == s[5]) &&
  +           (descriptors_out[1].desc.s == s[2])))) {
           printf("Test 2: FAILED (errno=%d, num=%d (expected 2)\n", rv, num);
           exit(-1);
       }
  @@ -294,8 +306,11 @@
   
       printf("\nTest 4: Last descriptor signalled......\n");
       send_msg(s, sa, LARGE_NUM_SOCKETS - 1);
  +    descriptors_out = NULL;
       if ((rv = apr_pollset_poll(pollset, 0, &num, &descriptors_out) !=
  -         APR_SUCCESS) || (num != 1)) {
  +         APR_SUCCESS) || (num != 1) || !descriptors_out ||
  +        (descriptors_out[0].desc.s != s[LARGE_NUM_SOCKETS - 1]) ||
  +        (descriptors_out[0].client_data != s[LARGE_NUM_SOCKETS - 1])) {
           printf("Test 4: FAILED (errno=%d, num=%d (expected 1)\n", rv, num);
           exit(-1);
       }
  
  
  

Mime
View raw message