int ReceiveData2(int sourcefd, int targetfd, unsigned long int *filesize)
{
  long             nread=0, nwrite, ns=0, nt, readsize;
  char             buff[MAXBUFFLEN], *buffptr;
  struct ibp_timer timeout;

/*//  fprintf(stderr,"IN RECEIVE DATA 2 <%s>\n",glb.IBP_cap);*/

  timeout.ServerSync = 10;
  timeout.ClientTimeout = 10;
  while (nread < *filesize) {  
    readsize = min(*filesize-nread,MAXBUFFLEN);
    bzero(buff,MAXBUFFLEN);
    ns = sRead(sourcefd, buff, readsize);
    if (ns < 0){
      perror("serverTCP: error reading from socket");
      return -1; 
    }
    nwrite = 0; 
    buffptr = buff;
    while (nwrite < ns) { 

#ifdef IBP_DEBUG   
      fprintf(stderr,"#");
#endif
      /**nt = sWrite(targetfd, buffptr, ns-nwrite);*/
      nt = IBP_store(glb.IBP_cap, &timeout, buffptr, ns-nwrite);
      if (nt < 0){
	fprintf(stderr,"UP TO NOW: %d\n",nwrite);
	perror("serverTCP: error writing to local storage");
	return -1;
      }
      buffptr += nt;
      nwrite += nt;
    }
    nread += ns;
  }
  
  *filesize = nread;
  write(sourcefd,"FIN",3);
  return 1;
}
int ReceiveData(int recvfd,socklen_t salen)
{
  ssize_t n;
  char buf[MAXBUF]; 
  int retwrite;
  int ooffset;
  int size;
  int filesize;
  int load,remsize;
  int retread;
  struct sockaddr *sa;
  socklen_t len;
  struct ibp_timer timeout;
  double temptim;
  int i;
  char hdr[8];
  int this;

  start1 = time(NULL);
  
  timeout.ServerSync = 100;
  timeout.ClientTimeout = 300;

  ooffset = lseek(glb.sourcefd,0,SEEK_CUR);
   
  size=0;
  filesize=glb.filesize;
  remsize=glb.filesize;
  sa=malloc(salen);

  i=0;  
  temptim = seconds();
  printf("--in here 2 \n");
  while(size < filesize)
  {
     load = (remsize > MAXLOAD ? MAXLOAD:remsize);
     do
     { 
        signal(SIGALRM,wake);
        ualarm(10000000,0);
        retread=recvfrom(recvfd,buf,load+HDR,0,sa,&len);
         printf("time %6.2f ",(seconds()-temptim));
        /*//printf("retread %d \n",retread);*/
        if(retread < 0)
        {
          if(errno != EINTR)
          {
            fprintf(stderr,"recvfrom failed \n");
            return -1;  
          }
          else 
            fprintf(stderr,"errno %d \n",errno);
        }
        ualarm(0,0);
     }while(retread < 0);

    strcpy(hdr,strtok(buf," "));
    this=atoi(hdr);
    printf("-->this %d i %d ",this,i);

/*
    lseek(glb.sourcefd, load+ooffset,SEEK_SET);
    retwrite = write(glb.sourcefd,buf,load);
     if(retwrite < 0)
      fprintf(stderr,"write error \n");
 */

       retwrite = IBP_store(glb.IBP_cap,&timeout,buf+HDR,load);
/*//       printf("retwrite %d \n",retwrite);*/
       if(retwrite == 0)
       {
         printf("IBP store failed \n");
         continue;
       }

     printf("time %6.2f secs \n",(seconds()-temptim));
     size += load;
     wsize += load;
     remsize -= load;
     i++;
   /*//  printf("group %s size %d remsize %d retwrite %d \n",group,size,remsize,retwrite);*/
/*//    printf("time %6.2f secs remsize %d i %d\n",(seconds()-temptim),remsize,i);    */
  } 
 return 1;  
   
} 
void ibp_test_nfu(struct ibp_depot *depot) 
{
    struct ibp_attributes ls_att;
    time_t ls_now;
    struct ibp_timer timeout;
    IBP_set_of_caps caps1,caps2,caps3;
    char  buf[]="123456789123456789123456789123456789";
    int ret,i;
    char retBuf[60];
    PARAMETER paras[3];
    int len = strlen(buf);
    
    time(&ls_now);
    ls_att.duration = (ls_now + 5);
    ls_att.reliability = IBP_STABLE;
    ls_att.type = IBP_BYTEARRAY;

    timeout.ServerSync = 10000;
    timeout.ClientTimeout = 10000;

    if ( NULL == ( caps1 = IBP_allocate(depot,&timeout, 500,&ls_att)) ){
        fprintf(stderr," Allocate failed %d\n",IBP_errno);
        exit(-1);
    }
    if ( NULL == ( caps2 = IBP_allocate(depot,&timeout, 500,&ls_att)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
    if ( NULL == ( caps3 = IBP_allocate(depot,&timeout, 500,&ls_att)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
    if ( len != ( ret = IBP_store(caps1->writeCap,&timeout,buf,len)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
    if ( len != ( ret = IBP_store(caps2->writeCap,&timeout,buf,len)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
/*
    fprintf(stderr,"cap = %s\n",caps3->writeCap );
    fprintf(stderr,"store\n");

    if ( len != ( ret = IBP_store(caps3->writeCap,&timeout,buf,len)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
*/
    //exit(-1);
    paras[0].ioType = IBP_REF_RD;
    paras[0].data = caps1->readCap;
    paras[0].offset = 0;
    paras[0].len = len;

    
    paras[1].ioType = IBP_REF_RD;
    paras[1].data = caps2->readCap;
    paras[1].offset = 0;
    paras[1].len = len;

    paras[2].ioType = IBP_REF_RDWR;
    paras[2].data = caps3->writeCap;
    paras[2].offset = 0;
    paras[2].len = len;

    if ( (ret = IBP_nfu_op(depot,1,3,paras,&timeout)) != IBP_OK ){
        fprintf(stderr," failed %d\n", IBP_errno);
        exit(-1);
    }
/*
    retBuf[32]= '\0';
    fprintf(stderr,"MD5 = %s len = %d \n",retBuf,strlen(retBuf));

    return;
*/
    if ( len != ( ret = IBP_load(caps3->readCap,&timeout,buf,len,0)) ){
        fprintf(stderr,"failed %d\n",IBP_errno);
        exit(-1);
    }
    
    for ( i = 0 ; i < len ; i ++ ){
        if ( buf[i] != 0 ){
            fprintf(stderr,"failed \n");
            exit(-1);
        }
    }

    return;
}
Esempio n. 4
0
int main(int argc, char **argv)
{
  ibp_depotinfo_t *depotinfo;
  ibp_depot_t depot1, depot2;
  ibp_attributes_t attr;
  ibp_timer_t timer;
  ibp_capset_t *caps, *caps2, *caps4;
  ibp_capset_t caps3, caps5;
  ibp_capstatus_t astat;
  ibp_alias_capstatus_t alias_stat;
  int err, i, len, offset;
  int bufsize = 1024*1024;
  char wbuf[bufsize];
  char rbuf[bufsize];
  char *host1, *host2;
  int port1, port2;
  rid_t rid1, rid2;

  failed_tests = 0;

  if (argc < 6) {
     printf("ibp_test [-d loglevel] [-config ibp.cfg] host1 port1 rid1 host2 port2 rid2\n");
     printf("\n");
     printf("     2 depots are requred to test depot-depot copies.\n");
     printf("     Can use the same depot if necessary\n");
     printf("\n");
     printf("\n");
     return(-1);
  }

  ibp_init();  //** Initialize IBP


  //*** Read in the arguments ***    
  i = 1;
  if (strcmp(argv[i], "-d") == 0) {
     i++;
     set_log_level(atoi(argv[i]));
     i++;
  }

  if (strcmp(argv[i], "-config") == 0) { //** Read the config file
     i++;
     ibp_load_config(argv[i]);
     i++;
  }

  host1 = argv[i];  i++;
  port1 = atoi(argv[i]); i++;
  rid1 = ibp_str2rid(argv[i]); i++;  

  host2 = argv[i];  i++;
  port2 = atoi(argv[i]); i++;
  rid2 = ibp_str2rid(argv[i]); i++;  

  //*** Print the ibp client version ***
  printf("\n");
  printf("================== IBP Client Version =================\n");
  printf("%s\n", ibp_client_version());

  //*** Init the structures ***
  ibp_timeout = 5;
  set_ibp_depot(&depot1, host1, port1, rid1);
  set_ibp_depot(&depot2, host2, port2, rid2);
  set_ibp_attributes(&attr, time(NULL) + 60, IBP_HARD, IBP_BYTEARRAY); 
  set_ibp_timer(&timer, ibp_timeout, ibp_timeout);

//printf("Before allocate\n"); fflush(stdout);

  //*** Perform single allocation
  caps = IBP_allocate(&depot1, &timer, bufsize, &attr);

  if (caps == NULL) {
     printf("Error!!!! ibp_errno = %d\n", IBP_errno);
     return(1);
  } else {
     printf("Read: %s\n", caps->readCap);
     printf("Write: %s\n", caps->writeCap);
     printf("Manage: %s\n", caps->manageCap);
  }  

  printf("ibp_manage(IBP_PROBE):-----------------------------------\n");
  memset(&astat, 0, sizeof(astat));
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("read count = %d\n", astat.readRefCount);
     printf("write count = %d\n", astat.writeRefCount);
     printf("current size = %d\n", astat.currentSize);
     printf("max size = %lu\n", astat.maxSize);
     printf("duration = %ld\n", astat.attrib.duration - time(NULL));
     printf("reliability = %d\n", astat.attrib.reliability);
     printf("type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }


  printf("ibp_manage(IBP_DECR for write cap):-----------------------------------\n");
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_DECR, IBP_WRITECAP, &astat);
  if (err != 0) { printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno); }
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("read count = %d\n", astat.readRefCount);
     printf("write count = %d\n", astat.writeRefCount);
     printf("current size = %d\n", astat.currentSize);
     printf("max size = %lu\n", astat.maxSize);
     printf("duration = %lu\n", astat.attrib.duration - time(NULL));
     printf("reliability = %d\n", astat.attrib.reliability);
     printf("type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }


  printf("ibp_manage(IBP_CHNG - incresing size to 2MB and changing duration to 20 sec):-----------------------------------\n");
  set_ibp_attributes(&(astat.attrib), time(NULL) + 20, IBP_HARD, IBP_BYTEARRAY);
  astat.maxSize = 2*1024*1024;
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_CHNG, 0, &astat);
  if (err != 0) { printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno); }
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("read count = %d\n", astat.readRefCount);
     printf("write count = %d\n", astat.writeRefCount);
     printf("current size = %d\n", astat.currentSize);
     printf("max size = %lu\n", astat.maxSize);
     printf("duration = %lu\n", astat.attrib.duration - time(NULL));
     printf("reliability = %d\n", astat.attrib.reliability);
     printf("type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }

  //**** Basic Write tests ****
  printf("write tests..................................\n");
  for (i=0; i<bufsize; i++) wbuf[i] = '0';
  len = 3*bufsize/4;
  err = IBP_store(get_ibp_cap(caps, IBP_WRITECAP), &timer, wbuf, len);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_store1! wrote=%d err=%d\n", err, IBP_errno);
  }    

  len = bufsize - len;
  err = IBP_store(get_ibp_cap(caps, IBP_WRITECAP), &timer, wbuf, len);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_store2! wrote=%d err=%d\n", err, IBP_errno);
  }    

  for (i=0; i<bufsize; i++) wbuf[i] = '1';
  len = bufsize/2;
  offset = 10;
  err = IBP_write(get_ibp_cap(caps, IBP_WRITECAP), &timer, wbuf, len, offset);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_Write! wrote=%d err=%d\n", err, IBP_errno);
  }    


  printf("ibp_load test...............................\n");
  len = bufsize;
  offset = 0;
  err = IBP_load(get_ibp_cap(caps, IBP_READCAP), &timer, rbuf, len, offset);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_load! wrote=%d err=%d\n", err, IBP_errno);
  } else {
    rbuf[50] = '\0';
    printf("rbuf=%s\n", rbuf);
  }

  printf("ibp_copy test................................\n");
  //*** Perform single allocation
  caps2 = IBP_allocate(&depot2, &timer, bufsize, &attr);
  if (caps2 == NULL) {
     failed_tests++;
     printf("Error with allocation of dest cap!!!! ibp_errno = %d\n", IBP_errno);
     return(1);
  } else {
     printf("dest Read: %s\n", caps2->readCap);
     printf("dest Write: %s\n", caps2->writeCap);
     printf("dest Manage: %s\n", caps2->manageCap);
  }  
  err = IBP_copy(get_ibp_cap(caps, IBP_READCAP), get_ibp_cap(caps2, IBP_WRITECAP), &timer, &timer, 1024, 0);
  if (err != 1024) { failed_tests++; printf("ibp_copy size = %d * ibp_errno=%d\n", err, IBP_errno); }

  printf("ibp_phoebus_copy test................................\n");
  //*** Perform single allocation
  caps4 = IBP_allocate(&depot2, &timer, bufsize, &attr);
  if (caps4 == NULL) {
     printf("Error with allocation of dest cap!!!! ibp_errno = %d\n", IBP_errno);
     failed_tests++;
     return(1);
  } else {
     printf("dest Read: %s\n", caps4->readCap);
     printf("dest Write: %s\n", caps4->writeCap);
     printf("dest Manage: %s\n", caps4->manageCap);
  }  
  err = IBP_phoebus_copy(NULL, get_ibp_cap(caps, IBP_READCAP), get_ibp_cap(caps4, IBP_WRITECAP), &timer, &timer, 1024, 0);
  if (err != 1024) { failed_tests++; printf("ibp_copy size = %d * ibp_errno=%d\n", err, IBP_errno); }

  //** Remove the cap
  err = IBP_manage(get_ibp_cap(caps4, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { 
     failed_tests++;
     printf("Error deleting phoebus dest cap error = %d * ibp_errno=%d\n", err, IBP_errno); 
  }
  destroy_ibp_capset(caps4); caps4 = NULL;

  printf("ibp_manage(IBP_DECR):-Removing allocations----------------------------------\n");
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { failed_tests++; printf("ibp_manage(decr) for caps1 error = %d * ibp_errno=%d\n", err, IBP_errno); }
  err = IBP_manage(get_ibp_cap(caps2, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { failed_tests++; printf("ibp_manage(decr) for caps2 error = %d * ibp_errno=%d\n", err, IBP_errno); }

  printf("ibp_status: IBP_ST_INQ--------------------------------------------------------\n");
  depotinfo = IBP_status(&depot1, IBP_ST_INQ, &timer, "ibp", 10,11,12);
  if (depotinfo != NULL) {
     printf("rid=%d * duration=%ld\n", depotinfo->rid, depotinfo->Duration);
     printf("hc=" LL " hs=" LL " ha=" LL "\n",depotinfo->HardConfigured, depotinfo->HardServed, depotinfo->HardAllocable);
     printf("tc=" LL " ts=" LL " tu=" LL "\n", depotinfo->TotalConfigured, depotinfo->TotalServed, depotinfo->TotalUsed);
  } else {
     failed_tests++;
     printf("ibp_status error=%d\n", IBP_errno);
  }

  //** Perform some basic async R/W alloc/remove tests
  base_async_test(2, &depot1);

  //** Now do a few of the extra tests for async only
  ibp_op_t op;

  //*** Print the depot version ***
  set_ibp_version_op(&op, &depot1, rbuf, sizeof(rbuf), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err == IBP_OK) {
     printf("Printing depot version information......................................\n");
     printf("%s\n", rbuf);
  } else {
     failed_tests++;
     printf("Error getting ibp_version. err=%d\n", err);
  }
  
  //*** Query the depot resources ***
  ibp_ridlist_t rlist;
  set_ibp_query_resources_op(&op, &depot1, &rlist, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err == IBP_OK) {
     printf("Number of resources: %d\n", ridlist_get_size(&rlist));
     for (i=0; i<ridlist_get_size(&rlist); i++) {
        printf("  %d: %s\n", i, ibp_rid2str(ridlist_get_element(&rlist, i), rbuf));
     }
  } else {
     failed_tests++;
     printf("Error querying depot resource list. err=%d\n", err);
  }  

  perform_user_rw_tests(&depot1);  //** Perform the "user" version of the R/W functions

  //-----------------------------------------------------------------------------------------------------
  //** check ibp_rename ****

  printf("Testing IBP_RENAME...............................................\n");
  caps = IBP_allocate(&depot1, &timer, bufsize, &attr);
  if (caps == NULL) {
     failed_tests++;
     printf("Error!!!! ibp_errno = %d\n", IBP_errno);
     return(1);
  } else {
     printf("Original Cap..............\n");
     printf("Read: %s\n", caps->readCap);
     printf("Write: %s\n", caps->writeCap);
     printf("Manage: %s\n", caps->manageCap);
  }  

  //** Upload the data
  char *data = "This is a test....";
  len = strlen(data)+1;
  err = IBP_store(get_ibp_cap(caps, IBP_WRITECAP), &timer, data, len);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_store1! wrote=%d err=%d\n", err, IBP_errno);
  }    

  //** Rename the allocation
  set_ibp_rename_op(&op, caps2, get_ibp_cap(caps, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error with ibp_rename. err=%d\n", err);
  } else {
     printf("Renamed Cap..............\n");
     printf("Read: %s\n", caps2->readCap);
     printf("Write: %s\n", caps2->writeCap);
     printf("Manage: %s\n", caps2->manageCap);
  }  
  
  //** Try reading the original which should fail
  rbuf[0] = '\0';
  err = IBP_load(get_ibp_cap(caps, IBP_READCAP), &timer, rbuf, len, 0);
  if (err != len) {
     printf("Can't read the original cap after the rename which is good!  Got err err=%d\n", err);
  } else {
     failed_tests++;
    printf("Oops!  The read of the original cap succeeded! rbuf=%s\n", rbuf);
  }

  //** Try reading with the new cap
  rbuf[0] = '\0';
  err = IBP_load(get_ibp_cap(caps2, IBP_READCAP), &timer, rbuf, len, 0);
  if (err == len) {
     if (strcmp(rbuf, data) == 0) {
        printf("Read using the new cap the original data!\n");
     } else {
        failed_tests++;
        printf("Read some data with the new cap but it wasn't correct!\n");
        printf("Original=%s\n", data);
        printf("     Got=%s\n", wbuf);
     }
  } else {
     failed_tests++;
     printf("Oops! Failed reading with new cap! err=%d\n", err);
  }

  //** Remove the cap
  err = IBP_manage(get_ibp_cap(caps2, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { 
     failed_tests++;
     printf("Error deleting new cap after rename caps2 error = %d * ibp_errno=%d\n", err, IBP_errno); 
  }
  printf("Completed ibp_rename test...........................\n");

  //-----------------------------------------------------------------------------------------------------
  //** check ibp_alias_allocate/manage ****

//**** GOOD
  printf("Testing IBP_alias_ALLOCATE/MANAGE...............................................\n");
  caps = IBP_allocate(&depot1, &timer, bufsize, &attr);
  if (caps == NULL) {
     failed_tests++;
     printf("Error!!!! ibp_errno = %d\n", IBP_errno);
     return(1);
  } else {
     printf("Original Cap..............\n");
     printf("Read: %s\n", caps->readCap);
     printf("Write: %s\n", caps->writeCap);
     printf("Manage: %s\n", caps->manageCap);
  }  

  set_ibp_alias_alloc_op(&op, caps2, get_ibp_cap(caps, IBP_MANAGECAP), 0, 0, 0, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error with ibp_alias_alloc. err=%d\n", err);
  } else {
     printf("Alias Cap..............\n");
     printf("Read: %s\n", caps2->readCap);
     printf("Write: %s\n", caps2->writeCap);
     printf("Manage: %s\n", caps2->manageCap);
  }  


  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("Actual cap info\n");
     printf(" read count = %d\n", astat.readRefCount);
     printf(" write count = %d\n", astat.writeRefCount);
     printf(" current size = %d\n", astat.currentSize);
     printf(" max size = %lu\n", astat.maxSize);
     printf(" duration = %lu\n", astat.attrib.duration - time(NULL));
     printf(" reliability = %d\n", astat.attrib.reliability);
     printf(" type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }

  err = IBP_manage(get_ibp_cap(caps2, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("Using alias to get actual cap info\n");
     printf(" read count = %d\n", astat.readRefCount);
     printf(" write count = %d\n", astat.writeRefCount);
     printf(" current size = %d\n", astat.currentSize);
     printf(" max size = %lu\n", astat.maxSize);
     printf(" duration = %lu\n", astat.attrib.duration - time(NULL));
     printf(" reliability = %d\n", astat.attrib.reliability);
     printf(" type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }

  set_ibp_alias_probe_op(&op, get_ibp_cap(caps2, IBP_MANAGECAP), &alias_stat, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error with ibp_alias_probe. err=%d\n", err);
  } else {
     printf("Alias stat..............\n");
     printf(" read count = %d\n", alias_stat.read_refcount);
     printf(" write count = %d\n", alias_stat.write_refcount);
     printf(" offset = " ST "\n", alias_stat.offset);
     printf(" size = " ST "\n", alias_stat.size);
     printf(" duration = %lu\n", alias_stat.duration - time(NULL));
  }

  set_ibp_alias_alloc_op(&op, &caps3, get_ibp_cap(caps, IBP_MANAGECAP), 10, 40, 0, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error with ibp_alias_alloc_op. err=%d\n", err);
  } else {
     printf("Alias Cap with range 10-50.............\n");
     printf("Read: %s\n", caps3.readCap);
     printf("Write: %s\n", caps3.writeCap);
     printf("Manage: %s\n", caps3.manageCap);
  }  

  err = IBP_manage(get_ibp_cap(&caps3, IBP_MANAGECAP), &timer, IBP_PROBE, 0, &astat);
  if (err == 0) {
     printf("Using limited alias to get actual cap info\n");
     printf(" read count = %d\n", astat.readRefCount);
     printf(" write count = %d\n", astat.writeRefCount);
     printf(" current size = %d\n", astat.currentSize);
     printf(" max size = %lu *** This should be 40\n", astat.maxSize);
     printf(" duration = %lu\n", astat.attrib.duration - time(NULL));
     printf(" reliability = %d\n", astat.attrib.reliability);
     printf(" type = %d\n", astat.attrib.type);
  } else {
     failed_tests++;
     printf("ibp_manage error = %d * ibp_errno=%d\n", err, IBP_errno);
  }

  printf("*append* using the full alias..................................\n");
  for (i=0; i<bufsize; i++) wbuf[i] = '0';
  err = IBP_store(get_ibp_cap(caps2, IBP_WRITECAP), &timer, wbuf, bufsize);
  if (err != bufsize) {
     failed_tests++;
     printf("Error with IBP_store! wrote=%d err=%d\n", err, IBP_errno);
  }    

  printf("write using the limited alias..................................\n");  
  data = "This is a test.";
  len = strlen(data)+1;
  err = IBP_write(get_ibp_cap(&caps3, IBP_WRITECAP), &timer, data, len, 0);
  if (err != len) {
     failed_tests++;
     printf("Error with IBP_Write! wrote=%d err=%d\n", err, IBP_errno);
  }    

  memcpy(&(wbuf[10]), data, strlen(data)+1);
  len = 10 + strlen(data)+1;
  err = IBP_load(get_ibp_cap(caps2, IBP_READCAP), &timer, rbuf, len, 0);
  if (err == len) {
     if (strcmp(rbuf, wbuf) == 0) {
        printf("Read using the new full alias the original data!\n");
        printf("  read=%s\n", rbuf);       
     } else {
        failed_tests++;
        printf("Read some data with the new cap but it wasn't correct!\n");
        printf("Original=%s\n", wbuf);
        printf("     Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("Oops! Failed reading with new cap! err=%d\n", err);
  }


  //** Try to R/W beyond the end of the limited cap **
  printf("attempting to R/W beyond the end of the limited alias......\n");
  data = "This is a test.";
  len = strlen(data)+1;
  err = IBP_write(get_ibp_cap(&caps3, IBP_WRITECAP), &timer, data, len, 35);
  if (err != len) {
     printf("Correctly got an IBP_Write error! wrote=%d err=%d\n", err, IBP_errno);
  } else {
     failed_tests++;
     printf("Oops! Was able to write beyond the end of the limited cap with new cap!\n");
  }

  err = IBP_load(get_ibp_cap(&caps3, IBP_READCAP), &timer, rbuf, len, 35);
  if (err != len) {
     printf("Correctly got an IBP_read error! wrote=%d err=%d\n", err, IBP_errno);
  } else {
     failed_tests++;
     printf("Oops! Was able to read beyond the end of the limited cap with new cap!\n");
  }

  //** Perform a alias->alias copy.  The src alias is restricted
  printf("Testing restricted alias->full alias depot-depot copy\n");
  caps4 = IBP_allocate(&depot1, &timer, bufsize, &attr);
  if (caps == NULL) {
     failed_tests++;
     printf("alias-alias allocate Error!!!! ibp_errno = %d\n", IBP_errno);
     return(1);
  } else {
     printf("Depot-Depot copy OriginalDestiniation Cap..............\n");
     printf("Read: %s\n", caps4->readCap);
     printf("Write: %s\n", caps4->writeCap);
     printf("Manage: %s\n", caps4->manageCap);
  }  

  set_ibp_alias_alloc_op(&op, &caps5, get_ibp_cap(caps4, IBP_MANAGECAP), 0, 0, 0, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error with ibp_alias_alloc_op. err=%d\n", err);
  } else {
     printf("Destination Alias Cap with full range.............\n");
     printf("Read: %s\n", caps5.readCap);
     printf("Write: %s\n", caps5.writeCap);
     printf("Manage: %s\n", caps5.manageCap);
  }  

//BAD!!!!!!!!!!!
  //** Perform the copy
  data = "This is a test.";
  len = strlen(data)+1;
  err = IBP_copy(get_ibp_cap(&caps3, IBP_READCAP), get_ibp_cap(&caps5, IBP_WRITECAP), &timer, &timer, len, 0);
  if (err != len) { printf("ibp_copy size = %d * ibp_errno=%d\n", err, IBP_errno); }

  //** Load it back and verify **
  err = IBP_load(get_ibp_cap(&caps5, IBP_READCAP), &timer, rbuf, len, 0);
  if (err == len) {
     if (strcmp(rbuf, data) == 0) {
        printf("Read using the new full alias the original data!\n");
        printf("  read=%s\n", rbuf);       
     } else {
        failed_tests++;
        printf("Read some data with the new cap but it wasn't correct!\n");
        printf("Original=%s\n", data);
        printf("     Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("Oops! Failed reading with new cap! err=%d\n", err);
  }

  //** Remove the cap5 (full alias)
  set_ibp_alias_remove_op(&op, get_ibp_cap(&caps5, IBP_MANAGECAP), get_ibp_cap(caps4, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error dest deleting alias cap error = %d\n", err); 
  }

  //** Remove the dest cap
  err = IBP_manage(get_ibp_cap(caps4, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { 
     failed_tests++;
     printf("Error deleting dest caps error = %d * ibp_errno=%d\n", err, IBP_errno); 
  }

  printf("completed alias depot->depot copy test\n");

  //** Try to remove the cap2 (full alias) with a bad cap
  set_ibp_alias_remove_op(&op, get_ibp_cap(caps2, IBP_MANAGECAP), get_ibp_cap(&caps3, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     printf("Correctly detected error deleting alias cap with an invalid master cap error = %d\n", err); 
  } else {
     failed_tests++;
     printf("Oops! Was able to delete the alias with an invalid master cap!!!!!!!!\n");
  }

  //** Remove the cap2 (full alias)
  set_ibp_alias_remove_op(&op, get_ibp_cap(caps2, IBP_MANAGECAP), get_ibp_cap(caps, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error deleting alias cap error = %d\n", err); 
  }

  printf("Try to read the deleted full falias.  This should generate an error\n");
  err = IBP_load(get_ibp_cap(caps2, IBP_READCAP), &timer, rbuf, len, 35);
  if (err != len) {
     printf("Correctly got an IBP_read error! wrote=%d err=%d\n", err, IBP_errno);
  } else {
     failed_tests++;
     printf("Oops! Was able to write beyond the end of the limited cap with new cap!\n");
  }

  //** Remove the limited alias (cap3)
  set_ibp_alias_remove_op(&op, get_ibp_cap(&caps3, IBP_MANAGECAP), get_ibp_cap(caps, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("Error deleting the limited alias cap  error = %d\n", err); 
  }

  //** Remove the original cap
  err = IBP_manage(get_ibp_cap(caps, IBP_MANAGECAP), &timer, IBP_DECR, IBP_READCAP, &astat);
  if (err != 0) { 
     failed_tests++;
     printf("Error deleting original caps error = %d * ibp_errno=%d\n", err, IBP_errno); 
  }

//GOOD!!!!!!!!!!!!!!!!!!!!

  printf("finished testing IBP_alias_ALLOCATE/MANAGE...............................................\n");

  perform_splitmerge_tests(&depot1);
  perform_pushpull_tests(&depot1, &depot2);

  printf("\n\n");
  printf("Final network connection counter: %d\n", network_counter(NULL));
  printf("Tests that failed: %d\n", failed_tests);

  ibp_finalize();

  return(0);
}
Esempio n. 5
0
void perform_pushpull_tests(ibp_depot_t *depot1, ibp_depot_t *depot2)
{
  int bufsize = 2048;
  char wbuf[bufsize+1], rbuf[bufsize+1];
  ibp_op_t op;
  ibp_attributes_t attr;
  ibp_capset_t caps1, caps2;
  int nbytes, err;
  ibp_timer_t timer;
  int start_nfailed = failed_tests;

  printf("perform_pushpull_tests:  Starting tests!\n");

  set_ibp_timer(&timer, ibp_timeout, ibp_timeout);

  //** Initialize the buffers **
  memset(wbuf, '0', sizeof(wbuf));  wbuf[1023]='1'; wbuf[1024]='2'; wbuf[bufsize] = '\0';
  memset(rbuf, 0, sizeof(rbuf));
  nbytes = 1024;

  //*** Make the allocation used in the tests ***
  set_ibp_attributes(&attr, time(NULL) + A_DURATION, IBP_HARD, IBP_BYTEARRAY);
  set_ibp_alloc_op(&op, &caps1, bufsize, depot1, &attr, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error creating allocation 1 for tests!! error=%d\n", err);
     return;
  }

  set_ibp_alloc_op(&op, &caps2, bufsize, depot2, &attr, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error creating allocation 2 for tests!! error=%d\n", err);
     return;
  }

  //** Fill caps1="1" with data **
  err = IBP_store(get_ibp_cap(&caps1, IBP_WRITECAP), &timer, "1", 1);
  if (err != 1) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with master IBP_store! wrote=%d err=%d\n", err, IBP_errno);
  }    

  //** Append it to cap2="1"
  set_ibp_copy_op(&op, IBP_PUSH, NS_TYPE_SOCK, NULL, get_ibp_cap(&caps1, IBP_READCAP), 
          get_ibp_cap(&caps2, IBP_WRITECAP), 0, -1, 1, ibp_timeout, ibp_timeout, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with copy 1!! error=%d\n", err);
     return;
  }

  //** Append cap2 to cap1="11"
  set_ibp_copy_op(&op, IBP_PULL, NS_TYPE_SOCK, NULL, get_ibp_cap(&caps1, IBP_WRITECAP), 
          get_ibp_cap(&caps2, IBP_READCAP), -1, 0, 1, ibp_timeout, ibp_timeout, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with copy 2!! error=%d\n", err);
     return;
  }

  //** Append it to cap2="111"
  set_ibp_copy_op(&op, IBP_PUSH, NS_TYPE_SOCK, NULL, get_ibp_cap(&caps1, IBP_READCAP), 
          get_ibp_cap(&caps2, IBP_WRITECAP), 0, -1, 2, ibp_timeout, ibp_timeout, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with copy 3!! error=%d\n", err);
     return;
  }

  //** Change  caps1="123"
  err = IBP_write(get_ibp_cap(&caps1, IBP_WRITECAP), &timer, "23", 2, 1);
  if (err != 2) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with IBP_store 2! wrote=%d err=%d\n", err, IBP_errno);
  }    

  //** offset it to also make cap2="123"
  set_ibp_copy_op(&op, IBP_PUSH, NS_TYPE_SOCK, NULL, get_ibp_cap(&caps1, IBP_READCAP), 
          get_ibp_cap(&caps2, IBP_WRITECAP), 1, 1, 2, ibp_timeout, ibp_timeout, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Error with copy 4!! error=%d\n", err);
     return;
  }

  //** Now read them back and check them
  //** verify caps1
  memset(rbuf, 0, sizeof(rbuf));
  memcpy(wbuf, "123", 4);
  err = IBP_load(get_ibp_cap(&caps1, IBP_READCAP), &timer, rbuf, 3, 0);
  if (err == 3) {
     if (strcmp(rbuf, wbuf) != 0) {
        failed_tests++;
        printf("perform_pushpull_tests: Read some data with the cap1 but it wasn't correct!\n");
        printf("perform_pushpull_tests: Original=%s\n", wbuf);
        printf("perform_pushpull_tests:      Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Failed reading cap1! err=%d\n", err);
  }

  //** and also caps2
  memset(rbuf, 0, sizeof(rbuf));
  err = IBP_load(get_ibp_cap(&caps2, IBP_READCAP), &timer, rbuf, 3, 0);
  if (err == 3) {
     if (strcmp(rbuf, wbuf) != 0) {
        failed_tests++;
        printf("perform_pushpull_tests: Read some data with the cap2 but it wasn't correct!\n");
        printf("perform_pushpull_tests: Original=%s\n", wbuf);
        printf("perform_pushpull_tests:      Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("perform_pushpull_tests: Oops! Failed reading cap2! err=%d\n", err);
  }

  //** Lastly Remove the allocations **
  set_ibp_remove_op(&op, get_ibp_cap(&caps1, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     printf("perform_pushpull_tests: Oops! Error removing allocation 1!  ibp_errno=%d\n", err);
  }
  set_ibp_remove_op(&op, get_ibp_cap(&caps2, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     printf("perform_pushpull_tests: Oops! Error removing allocation 2!  ibp_errno=%d\n", err);
  }

  if (start_nfailed == failed_tests) {
     printf("perform_pushpull_tests: Passed!\n");
  } else {
     printf("perform_pushpull_tests: Oops! FAILED!\n");
  }
}
Esempio n. 6
0
void perform_splitmerge_tests(ibp_depot_t *depot)
{
  int bufsize = 2048;
  char wbuf[bufsize+1], rbuf[bufsize+1];
  ibp_op_t op;
  ibp_attributes_t attr;
  ibp_capset_t mcaps, caps, caps2;
  ibp_capstatus_t probe;
  int nbytes, err, max_size, curr_size, dummy;
  ibp_timer_t timer;

  printf("perform_splitmerge_tests:  Starting tests!\n");

  set_ibp_timer(&timer, ibp_timeout, ibp_timeout);

  //** Initialize the buffers **
  memset(wbuf, '0', sizeof(wbuf));  wbuf[1023]='1'; wbuf[1024]='2'; wbuf[bufsize] = '\0';
  memset(rbuf, 0, sizeof(rbuf));
  nbytes = 1024;

  //*** Make the allocation used in the tests ***
  set_ibp_attributes(&attr, time(NULL) + A_DURATION, IBP_HARD, IBP_BYTEARRAY);
  set_ibp_alloc_op(&op, &mcaps, bufsize, depot, &attr, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error creating initial allocation for tests!! error=%d\n", err);
     return;
  }

  //** Fill the master with data **
  err = IBP_store(get_ibp_cap(&mcaps, IBP_WRITECAP), &timer, wbuf, bufsize);
  if (err != bufsize) {
     failed_tests++;
     printf("perform_splitmerge_tests: Error with master IBP_store! wrote=%d err=%d\n", err, IBP_errno);
  }    

  //** Split the allocation
  set_ibp_split_alloc_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), &caps, 1024, &attr, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error creating child allocation for tests!! error=%d\n", err);
     return;
  }
  
  //** Check the new size of the master
  set_ibp_probe_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), &probe, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error probing master allocation for tests!! error=%d\n", err);
     return;
  }

  get_ibp_capstatus(&probe, &dummy, &dummy, &curr_size, &max_size, &attr);
  if ((curr_size != 1024) && (max_size != 1024)) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with master allocation size!! curr_size=%d * max_size=%d should both be 1024\n", curr_size, max_size);
     return;
  }   

  //** Check the size of the child allocation
  set_ibp_probe_op(&op, get_ibp_cap(&caps, IBP_MANAGECAP), &probe, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error probing child allocation for tests!! error=%d\n", err);
     return;
  }

  get_ibp_capstatus(&probe, &dummy, &dummy, &curr_size, &max_size, &attr); 
  if ((curr_size != 0) && (max_size != 1024)) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with master allocation size!! curr_size=%d * max_size=%d should be 0 and 1024\n", curr_size, max_size);
     return;
  }   

  //** Verify the master data
  wbuf[1024] = '\0';
  err = IBP_load(get_ibp_cap(&mcaps, IBP_READCAP), &timer, rbuf, 1024, 0);
  if (err == 1024) {
     if (strcmp(rbuf, wbuf) != 0) {
        failed_tests++;
        printf("Read some data with the mastercap but it wasn't correct!\n");
        printf("Original=%s\n", wbuf);
        printf("     Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("Oops! Failed reading master cap! err=%d\n", err);
  }

  //** Load data into the child
  err = IBP_store(get_ibp_cap(&caps, IBP_WRITECAP), &timer, wbuf, 1024);
  if (err != 1024) {
     failed_tests++;
     printf("perform_splitmerge_tests: Error with child IBP_store! wrote=%d err=%d\n", err, IBP_errno);
  }    

  //** Read it back
  memset(rbuf, 0, sizeof(rbuf));
  err = IBP_load(get_ibp_cap(&caps, IBP_READCAP), &timer, rbuf, 1024, 0);
  if (err == 1024) {
     if (strcmp(rbuf, wbuf) != 0) {
        failed_tests++;
        printf("Read some data with the childcap but it wasn't correct!\n");
        printf("Original=%s\n", wbuf);
        printf("     Got=%s\n", rbuf);
     }
  } else {
     failed_tests++;
     printf("Oops! Failed reading child cap! err=%d\n", err);
  }

  //** Split the master again but htis time make it to big so it should fail
  set_ibp_split_alloc_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), &caps2, 2048, &attr, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err == IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error created child allocation when I shouldn't have! error=%d\n", err);
     return;
  }

  //** Check the size of the master to make sure it didn't change
  set_ibp_probe_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), &probe, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error probing master allocation2 for tests!! error=%d\n", err);
     return;
  }

  get_ibp_capstatus(&probe, &dummy, &dummy, &curr_size, &max_size, &attr);
  if ((curr_size != 1024) && (max_size != 1024)) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with master allocation size2!! curr_size=%d * max_size=%d should both be 1024\n", curr_size, max_size);
     return;
  }   

//GOOD!!!!!!!!!!!!!!!!!

  //** Merge the 2 allocations
  set_ibp_merge_alloc_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), get_ibp_cap(&caps, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with merge! error=%d\n", err);
     return;
  }

  //** Verify the child is gone
  set_ibp_probe_op(&op, get_ibp_cap(&caps, IBP_MANAGECAP), &probe, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err == IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Oops!  Child allocation is available after merge! ccap=%s\n", get_ibp_cap(&caps, IBP_MANAGECAP));
     return;
  }


  //** Verify the max/curr size of the master
  set_ibp_probe_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), &probe, ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with probe of mcapafter mergs! ccap=%s err=%d\n", get_ibp_cap(&mcaps, IBP_MANAGECAP), err);
     return;
  }

//GOOD!!!!!!!!!!!!!!!!!

  get_ibp_capstatus(&probe, &dummy, &dummy, &curr_size, &max_size, &attr);
  if ((curr_size != 1024) && (max_size != 2048)) {
     failed_tests++;
     printf("perform_splitmerge_tests:  Error with master allocation size after merge!! curr_size=%d * max_size=%d should both 1024 and 2048\n", curr_size, max_size);
     return;
  }   

  //** Lastly Remove the master allocation **
  set_ibp_remove_op(&op, get_ibp_cap(&mcaps, IBP_MANAGECAP), ibp_timeout, NULL, NULL);
  err = ibp_sync_command(&op);
  if (err != IBP_OK) {
     printf("perform_splitmerge_tests: Error removing master allocation!  ibp_errno=%d\n", err);
  }

  printf("perform_splitmerge_tests:  Passed!\n");
}