home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / test / io / description / debug-main.c < prev    next >
C/C++ Source or Header  |  2006-05-17  |  2KB  |  97 lines

  1. /*
  2.  * (C) 2002 Clemson University.
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */       
  6.  
  7. #include <unistd.h>
  8. #include <stdlib.h>
  9. #include <stdio.h>
  10. #include <pvfs2-types.h>
  11. #include <gossip.h>
  12. #include <pvfs2-debug.h>
  13.  
  14. #include <pint-distribution.h>
  15. #include <pint-dist-utils.h>
  16. #include <pvfs2-request.h>
  17. #include <pint-request.h>
  18. #include "pvfs2-internal.h"
  19.  
  20. #include "debug.h"
  21.  
  22. #define SEGMAX 16
  23. #define BYTEMAX (4*1024*1024)
  24.  
  25. int longflag = 0;
  26. int gossipflag = 0;
  27.  
  28. extern int request_debug(void);
  29.  
  30. int main(int argc, char **argv)
  31. {
  32.     int c;
  33.     while ((c = getopt(argc, argv, "lg")) != -1)
  34.     {
  35.         switch (c)
  36.         {
  37.             case 'l' : longflag++;
  38.                 break;
  39.             case 'g' : gossipflag++;
  40.                 break;
  41.             default :
  42.                 break;
  43.         }
  44.     }
  45.     return request_debug();
  46. }
  47.  
  48. void prtval(long long val, char *s)
  49. {
  50.     if (!longflag)
  51.         return;
  52.     printf("%s: ",s);
  53.     printf("%lld\n",val);
  54. }
  55.  
  56. void cmpval(long long val, long long exp)
  57. {
  58.     if (val != exp)
  59.         printf("TEST FAILED! <<=============================\n");
  60.     else
  61.         printf("TEST SUCCEEDED!\n");
  62. }
  63.  
  64. void prtseg(PINT_Request_result *seg, char *s)
  65. {
  66.     int i;
  67.     if (!longflag)
  68.         return;
  69.     printf("%s\n",s);
  70.     printf("%d segments with %lld bytes\n", seg->segs, lld(seg->bytes));
  71.     for(i=0; i<seg->segs && i<seg->segmax; i++)
  72.     {
  73.         printf("  segment %d: offset: %lld size: %lld\n",
  74.                 i, lld(seg->offset_array[i]), lld(seg->size_array[i]));
  75.     }
  76. }
  77.  
  78. void cmpseg(PINT_Request_result *seg, PINT_Request_result *exp)
  79. {
  80.     int i;
  81.     if (seg->segs != exp->segs || seg->bytes != exp->bytes)
  82.     {
  83.         printf("TEST FAILED! <<=============================\n");
  84.         return;
  85.     }
  86.     for(i=0; i<seg->segs && i<seg->segmax; i++)
  87.     {
  88.         if (seg->offset_array[i] != exp->offset_array[i] ||
  89.                 seg->size_array[i] != exp->size_array[i])
  90.         {
  91.             printf("TEST FAILED! <<=============================\n");
  92.             return;
  93.         }
  94.     }
  95.     printf("TEST SUCCEEDED!\n");
  96. }
  97.