lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1784 - nss-pam-ldapd/tests

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

nss-pam-ldapd commit: r1784 - nss-pam-ldapd/tests



Author: arthur
Date: Sat Oct 13 14:15:32 2012
New Revision: 1784
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1784&view=revision

Log:
update tests to new tio interface (fixes r1783)

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

Modified: nss-pam-ldapd/tests/test_tio.c
==============================================================================
--- nss-pam-ldapd/tests/test_tio.c      Fri Oct 12 21:49:59 2012        (r1783)
+++ nss-pam-ldapd/tests/test_tio.c      Sat Oct 13 14:15:32 2012        (r1784)
@@ -51,18 +51,14 @@
 static void *help_tiowriter(void *arg)
 {
   TFILE *fp;
-  struct timeval timeout;
   size_t i,j,k;
   uint8_t *buf;
   struct helper_args *hargs=(struct helper_args *)arg;
   /* allocate the buffer */
   buf=(uint8_t *)malloc(hargs->blocksize);
   assert(buf!=NULL);
-  /* set the timeout */
-  timeout.tv_sec=hargs->timeout;
-  timeout.tv_usec=0;
   /* open the file */
-  fp=tio_fdopen(hargs->fd,&timeout,&timeout,4*1024,8*1024,4*1024,8*1024);
+  
fp=tio_fdopen(hargs->fd,hargs->timeout*1000,hargs->timeout*1000,4*1024,8*1024,4*1024,8*1024);
   assertok(fp!=NULL);
   /* write the blocks */
   i=0;
@@ -83,18 +79,14 @@
 static void *help_tioreader(void *arg)
 {
   TFILE *fp;
-  struct timeval timeout;
   size_t i,j,k;
   uint8_t *buf;
   struct helper_args *hargs=(struct helper_args *)arg;
   /* allocate the buffer */
   buf=(uint8_t *)malloc(hargs->blocksize);
   assert(buf!=NULL);
-  /* set the timeout */
-  timeout.tv_sec=hargs->timeout;
-  timeout.tv_usec=0;
   /* open the file */
-  fp=tio_fdopen(hargs->fd,&timeout,&timeout,4*1024,8*1024,4*1024,8*1024);
+  
fp=tio_fdopen(hargs->fd,hargs->timeout*1000,hargs->timeout*1000,4*1024,8*1024,4*1024,8*1024);
   assertok(fp!=NULL);
   /* read the blocks */
   i=0;
@@ -202,7 +194,6 @@
   pthread_t wthread;
   struct helper_args wargs;
   TFILE *fp;
-  struct timeval timeout;
   size_t i,j,k,save;
   uint8_t buf[20];
   /* set up the socket pair */
@@ -214,9 +205,7 @@
   wargs.timeout=2;
   assertok(pthread_create(&wthread,NULL,help_normwriter,&wargs)==0);
   /* set up read handle */
-  timeout.tv_sec=2;
-  timeout.tv_usec=0;
-  fp=tio_fdopen(sp[1],&timeout,&timeout,2*1024,4*1024,2*1024,4*1024);
+  fp=tio_fdopen(sp[1],2000,2000,2*1024,4*1024,2*1024,4*1024);
   assertok(fp!=NULL);
   /* perform 20 reads */
   i=0;
@@ -281,7 +270,6 @@
   int sp[2];
   TFILE *rfp;
   FILE *wfp;
-  struct timeval timeout;
   uint8_t buf[20];
   time_t start,end;
   /* set up the socket pair */
@@ -289,9 +277,7 @@
   /* open the writer */
   assertok((wfp=fdopen(sp[0],"wb"))!=NULL);
   /* open the reader */
-  timeout.tv_sec=1;
-  timeout.tv_usec=100000;
-  
assertok((rfp=tio_fdopen(sp[1],&timeout,&timeout,2*1024,4*1024,2*1024,4*1024))!=NULL);
+  
assertok((rfp=tio_fdopen(sp[1],1100,1100,2*1024,4*1024,2*1024,4*1024))!=NULL);
   /* perform a read */
   start=time(NULL);
   assertok(tio_read(rfp,buf,sizeof(buf))!=0);
@@ -309,7 +295,6 @@
   FILE *rfp;
   TFILE *wfp;
   int i;
-  struct timeval timeout;
   uint8_t buf[20];
   time_t start,end;
   /* set up the socket pair */
@@ -317,9 +302,7 @@
   /* open the reader */
   assertok((rfp=fdopen(sp[0],"rb"))!=NULL);
   /* open the writer */
-  timeout.tv_sec=1;
-  timeout.tv_usec=100000;
-  
assertok((wfp=tio_fdopen(sp[1],&timeout,&timeout,2*1024,4*1024,2*20,4*20+1))!=NULL);
+  assertok((wfp=tio_fdopen(sp[1],1100,1100,2*1024,4*1024,2*20,4*20+1))!=NULL);
   /* perform a few write (these should be OK because they fill the buffer) */
   assertok(tio_write(wfp,buf,sizeof(buf))==0);
   assertok(tio_write(wfp,buf,sizeof(buf))==0);
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/