00001
00002 ** **
00003 ** This program tests all SUMS APIs **
00004 ** **
00005 **************************************/
00006
00007 #include <SUM.h>
00008 #include <soi_key.h>
00009 #include <sys/time.h>
00010 #include <sys/errno.h>
00011 #include <rpc/rpc.h>
00012 #include <sum_rpc.h>
00013 #include <soi_error.h>
00014 #include "drmsparams.h"
00015
00016 extern int errno;
00017
00018 #define MAXSUMREQ_CNT 3
00019 #define SUMSTESTBED_SUMOPEN 1
00020
00021
00022 KEY *rlist;
00023 FILE *logfp;
00024
00025 SUMID_t uid;
00026
00027 int soi_errno = NO_ERROR;
00028 int bytes, msgtag, petid, req_num, status, cnt, i, j, inum;
00029 char **cptr;
00030 float ftmp;
00031 uint64_t *dsixpt;
00032 uint64_t alloc_index;
00033 char alloc_wd[64];
00034 char cmd[128];
00035 char mod_name[] = "sum_rpc";
00036 char dsname[] = "hmi_lev1_fd_V";
00037 char hcomment[] = "this is a dummy history comment that is greater than 80 chars long to check out the code";
00038
00039 static struct timeval first[8], second[8];
00040
00041 void StartTimer(int n)
00042 {
00043 gettimeofday (&first[n], NULL);
00044 }
00045
00046 float StopTimer(int n)
00047 {
00048 gettimeofday (&second[n], NULL);
00049 if (first[n].tv_usec > second[n].tv_usec) {
00050 second[n].tv_usec += 1000000;
00051 second[n].tv_sec--;
00052 }
00053 return (float) (second[n].tv_sec-first[n].tv_sec) +
00054 (float) (second[n].tv_usec-first[n].tv_usec)/1000000.0;
00055 }
00056
00057
00058
00059
00060
00061 int (*history)(const char *fmt, ...)
00062
00063
00064 int main(int argc, char *argv[])
00065 {
00066 int status;
00067 char **srcptr;
00068 char **destptr;
00069 SUMEXP_t sumexp;
00070 SUM_t *sum = NULL;
00071
00072
00073
00074 if((sum = SUM_open(NULL, NULL, reportError)) == 0)
00075 {
00076 exit(SUMSTESTBED_SUMOPEN);
00077 }
00078
00079
00080
00081
00082
00083
00084 sumexp.uid = sum->uid;
00085 sumexp.host = "n02";
00086 sumexp.cmd = "scp";
00087 sumexp.src = (char **)calloc(SUMARRAYSZ, sizeof(char *));
00088 sumexp.dest = (char **)calloc(SUMARRAYSZ, sizeof(char *));
00089 srcptr = sumexp.src;
00090 destptr = sumexp.dest;
00091 *srcptr++ = "/home/jim/mark.alias";
00092 *destptr++ = "/tmp/jim";
00093 *srcptr++ = "/home/jim/.aliases";
00094 *destptr++ = "/tmp/jim";
00095 sumexp.reqcnt = 2;
00096 sumexp.port = 0;
00097
00098 printf("Calling: SUM_export()\n");
00099 status = SUM_export(&sumexp, printf);
00100
00101 printf("status = %d\n", status);
00102 free(sumexp.src);
00103 free(sumexp.dest);
00104
00105 SUM_close(sum, printf);
00106 }
00107
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125