lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1846 - in nss-pam-ldapd: common tests

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1846 - in nss-pam-ldapd: common tests



Author: arthur
Date: Thu Dec  6 21:53:23 2012
New Revision: 1846
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1846&view=revision

Log:
make test even more verbose and set number of writes back at 10000 to avoid 
issues with systems with large buffers

Modified:
   nss-pam-ldapd/common/tio.c
   nss-pam-ldapd/tests/test_tio.c

Modified: nss-pam-ldapd/common/tio.c
==============================================================================
--- nss-pam-ldapd/common/tio.c  Fri Nov 30 15:43:51 2012        (r1845)
+++ nss-pam-ldapd/common/tio.c  Thu Dec  6 21:53:23 2012        (r1846)
@@ -414,7 +414,7 @@
 {
   struct pollfd fds[1];
   int rv;
-  /* wait for activity */
+  /* see if we can write without blocking */
   fds[0].fd=fp->fd;
   fds[0].events=POLLOUT;
   rv=poll(fds,1,0);

Modified: nss-pam-ldapd/tests/test_tio.c
==============================================================================
--- nss-pam-ldapd/tests/test_tio.c      Fri Nov 30 15:43:51 2012        (r1845)
+++ nss-pam-ldapd/tests/test_tio.c      Thu Dec  6 21:53:23 2012        (r1846)
@@ -297,6 +297,7 @@
   int i;
   uint8_t buf[20];
   time_t start,end;
+  int numblocks=10000;
   /* set up the socket pair */
   assertok(socketpair(AF_UNIX,SOCK_STREAM,0,sp)==0);
   /* open the reader */
@@ -306,16 +307,19 @@
       2*1024,4*1024, /* read buffer sizes */
       2*sizeof(buf),4*sizeof(buf)+1 /* write buffer sizes */
       ))!=NULL);
+  printf("test_tio: test_timeout_writer: trying to write %d blocks of %d 
bytes\n",
+         numblocks,(int)sizeof(buf));
   /* we perform a number of writes to the stream to see if they are buffered */
+  errno=0;
   start=time(NULL);
-  for (i=0;(i<1000)&&(tio_write(wfp,buf,sizeof(buf))==0);i++);
+  for (i=0;(i<numblocks)&&(tio_write(wfp,buf,sizeof(buf))==0);i++);
   end=time(NULL);
-  printf("test_tio: test_timeout_writer: written %d blocks of %d bytes in %d 
second(s)\n",
-         i,(int)sizeof(buf),(int)(end-start));
+  printf("test_tio: test_timeout_writer: written %d blocks of %d bytes in %d 
second(s) (%s)\n",
+         i,(int)sizeof(buf),(int)(end-start),strerror(errno));
   /* at the very least 4 writes should be OK because they filled the tio 
buffer */
   assert(i>=4);
   /* but at a certain point the writes should have failed */
-  assert(i<1000);
+  assert(i<numblocks);
   /* since the write timeout is more than a second end time should be bigger
      than start time */
   assert(end>start);
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/