Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ONGOING work on exceptions plus minor cleanups.
[simgrid.git] / testsuite / gras / datadesc_usage.c
1 /* $Id$ */
2
3 /* datadesc: test of data description (using file transport).               */
4
5 /* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include <stdio.h>
11 #include "gras.h"
12
13 #include "gras/DataDesc/datadesc_interface.h"
14 XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
15
16 #define READ  0
17 #define WRITE 1
18 #define RW    2
19
20 int r_arch;
21 const char *filename = "datadesc_usage.out";  
22
23 void
24 write_read(gras_datadesc_type_t type,void *src, void *dst, 
25            gras_socket_t sock, int direction);
26
27 void
28 write_read(gras_datadesc_type_t type,void *src, void *dst, 
29            gras_socket_t sock, int direction) {
30    
31   /* write */
32   if (direction == RW) 
33     sock = gras_socket_client_from_file(filename);
34   if (direction == WRITE || direction == RW)
35     gras_datadesc_send(sock, type, src);
36 /*  gras_datadesc_gen_send(sock, type, src);*/
37   if (direction == RW) 
38     gras_socket_close(sock);
39    
40   /* read */
41   if (direction == RW) 
42     sock = gras_socket_server_from_file(filename);
43
44   if (direction == READ || direction == RW)
45     gras_datadesc_recv(sock, type, r_arch, dst);
46
47   if (direction == RW) 
48     gras_socket_close(sock);
49 }
50
51 void test_int(gras_socket_t sock, int direction);
52 void test_float(gras_socket_t sock, int direction);
53 void test_double(gras_socket_t sock, int direction);
54 void test_array(gras_socket_t sock, int direction);
55 void test_dynar_scal(gras_socket_t sock, int direction);
56 void test_intref(gras_socket_t sock, int direction);
57 void test_string(gras_socket_t sock, int direction);
58
59 void test_homostruct(gras_socket_t sock, int direction);
60 void test_hetestruct(gras_socket_t sock, int direction);
61 void test_nestedstruct(gras_socket_t sock, int direction);
62 void test_chain_list(gras_socket_t sock, int direction);
63 void test_graph(gras_socket_t sock, int direction);
64 void test_dynar_ref(gras_socket_t sock, int direction);
65
66 void test_pbio(gras_socket_t sock, int direction);
67 void test_clause(gras_socket_t sock, int direction);
68
69 /* defined in datadesc_structures.c, which in perl generated */
70 void test_structures(gras_socket_t sock, int direction); 
71
72
73
74 void test_int(gras_socket_t sock, int direction) {
75   int i=5,j;
76   
77   INFO0("---- Test on integer ----");
78   write_read(gras_datadesc_by_name("int"), &i,&j, sock,direction);
79   if (direction == READ || direction == RW) 
80     xbt_assert(i == j);
81 }
82 void test_float(gras_socket_t sock, int direction) {
83   float i=5.0,j;
84   
85   INFO0("---- Test on float ----");
86   write_read(gras_datadesc_by_name("float"), &i,&j, sock,direction);
87   if (direction == READ || direction == RW)
88     xbt_assert2(i == j,"%f != %f",i,j);
89 }
90 void test_double(gras_socket_t sock, int direction) {
91   double i=-3252355.1234,j;
92   
93   INFO0("---- Test on double ----");
94   write_read(gras_datadesc_by_name("double"), &i,&j, sock,direction);
95   if (direction == READ || direction == RW)
96     xbt_assert2(i == j,"%f != %f",i,j);
97 }
98
99 #define SIZE 5
100 typedef int array[SIZE];
101 void test_array(gras_socket_t sock, int direction) {
102   gras_datadesc_type_t my_type;
103   
104   array i = { 35212,-6226,74337,11414,7733};
105   array j;
106   int cpt;
107
108   INFO0("---- Test on fixed array ----");
109
110   my_type=gras_datadesc_array_fixed("fixed int array", 
111                                     gras_datadesc_by_name("int"),
112                                     SIZE);
113
114   write_read(my_type, &i,&j, sock,direction);
115   if (direction == READ || direction == RW) {
116     for (cpt=0; cpt<SIZE; cpt++) {
117       DEBUG1("Test spot %d",cpt);
118       xbt_assert4(i[cpt] == j[cpt],"i[%d]=%d  !=  j[%d]=%d",
119                    cpt,i[cpt],cpt,j[cpt]);
120     }
121   }
122 }
123 /*** Dynar of scalar ***/
124
125 void test_dynar_scal(gras_socket_t sock, int direction){
126   gras_datadesc_type_t my_type;
127   xbt_dynar_t i,j;
128   int cpt;
129    
130   INFO0("---- Test on dynar containing integers ----");
131   my_type = gras_datadesc_dynar(gras_datadesc_by_name("int"),NULL);
132   i = xbt_dynar_new(sizeof(int),NULL);
133   for (cpt=0; cpt<64; cpt++) {
134     xbt_dynar_push_as(i,int,cpt); 
135     DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(i));
136   }
137 /*  xbt_dynar_dump(i);*/
138   write_read(my_type, &i,&j, sock, direction);
139 /*  xbt_dynar_dump(j);*/
140   if (direction == READ || direction == RW) {
141      for (cpt=0; cpt<64; cpt++){
142         int ret=xbt_dynar_get_as(j,cpt,int);
143         if (cpt != ret) {
144            CRITICAL3("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
145                      cpt,ret,cpt);
146            xbt_abort();
147         }
148      }
149      xbt_dynar_free(&j);
150   }
151   xbt_dynar_free(&i);
152 }
153 void test_intref(gras_socket_t sock, int direction) {
154   gras_datadesc_type_t my_type;
155   int *i,*j;
156   
157   i=xbt_new(int,1);
158   *i=12345;
159
160   INFO1("---- Test on a reference to an integer (%p) ----",i);
161
162   my_type = gras_datadesc_ref("int*",gras_datadesc_by_name("int"));
163
164   write_read(my_type, &i,&j, sock,direction);
165   if (direction == READ || direction == RW) {
166     xbt_assert(*i == *j);
167     free(j);
168   }
169   free(i);
170 }
171
172 /***
173  *** string (dynamic array)
174  ***/ 
175 void test_string(gras_socket_t sock, int direction) {
176   char *i=xbt_strdup("Some data"), *j=NULL;
177   int cpt;
178   
179   INFO0("---- Test on string (ref to dynamic array) ----");
180   write_read(gras_datadesc_by_name("string"), &i,&j,
181              sock,direction);
182   if (direction == READ || direction == RW) {
183     for (cpt=0; cpt<strlen(i); cpt++) {
184       xbt_assert4(i[cpt] == j[cpt],"i[%d]=%c  !=  j[%d]=%c",
185                    cpt,i[cpt],cpt,j[cpt]);
186     } 
187     free(j);
188   }
189   free(i);
190 }
191
192
193 /***
194  *** homogeneous struct
195  ***/ 
196 typedef struct {
197   int a,b,c,d;
198 } homostruct;
199 void test_homostruct(gras_socket_t sock, int direction) {
200   gras_datadesc_type_t my_type;
201   homostruct *i, *j; 
202
203   INFO0("---- Test on homogeneous structure ----");
204   /* create descriptor */
205   my_type=gras_datadesc_struct("homostruct");
206   gras_datadesc_struct_append(my_type,"a",
207                               gras_datadesc_by_name("signed int"));
208   gras_datadesc_struct_append(my_type,"b",
209                               gras_datadesc_by_name("int"));
210   gras_datadesc_struct_append(my_type,"c",
211                               gras_datadesc_by_name("int"));
212   gras_datadesc_struct_append(my_type,"d",
213                               gras_datadesc_by_name("int"));
214   gras_datadesc_struct_close(my_type);
215   my_type=gras_datadesc_ref("homostruct*",
216                             gras_datadesc_by_name("homostruct"));
217
218   /* init a value, exchange it and check its validity*/
219   i=xbt_new(homostruct,1);
220   i->a = 2235;    i->b = 433425;
221   i->c = -23423;  i->d = -235235;
222
223   write_read(my_type, &i,&j, sock,direction);
224   if (direction == READ || direction == RW) {
225     xbt_assert2(i->a == j->a,"i->a=%d != j->a=%d",i->a,j->a);
226     xbt_assert(i->b == j->b);
227     xbt_assert(i->c == j->c);
228     xbt_assert(i->d == j->d);
229     free(j);
230   }
231   free(i);
232 }
233
234 /***
235  *** heterogeneous struct
236  ***/ 
237 typedef struct {
238   unsigned char c1;
239   unsigned long int l1;
240   unsigned char c2;
241   unsigned long int l2;
242 } hetestruct;
243 void test_hetestruct(gras_socket_t sock, int direction) {
244   gras_datadesc_type_t my_type;
245   hetestruct *i, *j; 
246
247   INFO0("---- Test on heterogeneous structure ----");
248   /* create descriptor */
249   my_type=gras_datadesc_struct("hetestruct");
250   gras_datadesc_struct_append(my_type,"c1",
251                               gras_datadesc_by_name("unsigned char"));
252   gras_datadesc_struct_append(my_type,"l1",
253                               gras_datadesc_by_name("unsigned long int"));
254   gras_datadesc_struct_append(my_type,"c2",
255                               gras_datadesc_by_name("unsigned char"));
256   gras_datadesc_struct_append(my_type,"l2",
257                               gras_datadesc_by_name("unsigned long int"));
258   gras_datadesc_struct_close(my_type);
259   my_type=gras_datadesc_ref("hetestruct*", gras_datadesc_by_name("hetestruct"));
260
261
262   /* init a value, exchange it and check its validity*/
263   i=xbt_new(hetestruct,1);
264   i->c1 = 's'; i->l1 = 123455;
265   i->c2 = 'e'; i->l2 = 774531;
266
267   write_read(my_type, &i,&j, sock,direction);
268   if (direction == READ || direction == RW) {
269     xbt_assert(i->c1 == j->c1);
270     xbt_assert(i->c2 == j->c2);
271     xbt_assert2(i->l1 == j->l1,"i->l1(=%ld)  !=  j->l1(=%ld)",i->l1,j->l1);
272     xbt_assert(i->l2 == j->l2);
273     free(j);
274   }
275   free(i);
276 }
277
278 /***
279  *** nested struct
280  ***/ 
281 typedef struct {
282   hetestruct hete;
283   homostruct homo;
284 } nestedstruct;
285 void test_nestedstruct(gras_socket_t sock, int direction) {
286   gras_datadesc_type_t my_type;
287   nestedstruct *i, *j; 
288
289   INFO0("---- Test on nested structures ----");
290   /* create descriptor */
291   my_type=gras_datadesc_struct("nestedstruct");
292
293   gras_datadesc_struct_append(my_type,"hete",
294                               gras_datadesc_by_name("hetestruct"));
295   gras_datadesc_struct_append(my_type,"homo",
296                               gras_datadesc_by_name("homostruct"));
297   gras_datadesc_struct_close(my_type);
298   my_type=gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"));
299
300   /* init a value, exchange it and check its validity*/
301   i=xbt_new(nestedstruct,1);
302   i->homo.a = 235231;  i->homo.b = -124151;
303   i->homo.c = 211551;  i->homo.d = -664222;
304   i->hete.c1 = 's'; i->hete.l1 = 123455;
305   i->hete.c2 = 'e'; i->hete.l2 = 774531;
306
307   write_read(my_type, &i,&j, sock,direction);
308   if (direction == READ || direction == RW) {
309     xbt_assert(i->homo.a == j->homo.a);
310     xbt_assert(i->homo.b == j->homo.b);
311     xbt_assert(i->homo.c == j->homo.c);
312     xbt_assert(i->homo.d == j->homo.d);
313     xbt_assert(i->hete.c1 == j->hete.c1);
314     xbt_assert(i->hete.c2 == j->hete.c2);
315     xbt_assert(i->hete.l1 == j->hete.l1);
316     xbt_assert(i->hete.l2 == j->hete.l2);
317     free(j);
318   }
319   free(i);
320 }
321
322 /***
323  *** chained list
324  ***/ 
325 typedef struct s_chained_list chained_list_t;
326 struct s_chained_list {
327   int          v;
328   chained_list_t *l;
329 };
330 void declare_chained_list_type(void);
331 chained_list_t *cons(int v, chained_list_t *l);
332 void list_free(chained_list_t *l);
333 int list_eq(chained_list_t*i,chained_list_t*j);
334
335 void declare_chained_list_type(void) {
336   gras_datadesc_type_t my_type,ref_my_type;
337
338   my_type=gras_datadesc_struct("chained_list_t");
339   ref_my_type=gras_datadesc_ref("chained_list_t*",my_type);
340
341   gras_datadesc_struct_append(my_type,"v", gras_datadesc_by_name("int"));
342   gras_datadesc_struct_append(my_type,"l", ref_my_type);
343   gras_datadesc_struct_close(my_type);
344 }
345
346 chained_list_t * cons(int v, chained_list_t *l) {
347   chained_list_t *nl = xbt_new(chained_list_t,1);
348   
349   nl->v = v;
350   nl->l = l;
351   
352   return nl;
353 }
354 void list_free(chained_list_t*l) {
355   if (l) {
356     list_free(l->l);
357     free(l);
358   }
359 }
360 int list_eq(chained_list_t*i,chained_list_t*j) {
361   if (!i || !j) return i == j;
362   if (i->v != j->v)
363     return 0;
364   return list_eq(i->l, j->l); 
365 }
366 void test_chain_list(gras_socket_t sock, int direction) {
367   chained_list_t *i, *j; 
368
369   INFO0("---- Test on chained list ----");
370
371   /* init a value, exchange it and check its validity*/
372   i = cons( 12355, cons( 246264 , cons( 23263, NULL)));
373   j = NULL;
374
375   write_read(gras_datadesc_by_name("chained_list_t*"),
376              &i,&j,  sock,direction);
377   if (direction == READ || direction == RW) {
378     xbt_assert(list_eq(i,j));    
379     list_free(j);
380   }
381
382   list_free(i);
383 }
384 /***
385  *** graph
386  ***/
387 void test_graph(gras_socket_t sock, int direction) {
388   chained_list_t *i, *j; 
389
390   INFO0("---- Test on graph (cyclique chained list) ----");
391   /* init a value, exchange it and check its validity*/
392   i = cons( 1151515, cons( -232362 , cons( 222552, NULL)));
393   i->l->l->l = i;
394   j = NULL;
395
396   gras_datadesc_cycle_set(gras_datadesc_by_name("chained_list_t*"));
397   write_read(gras_datadesc_by_name("chained_list_t*"),
398              &i,&j, sock,direction);
399   if (direction == READ || direction == RW) {
400     
401     DEBUG1("i=%p"         ,i);
402     DEBUG1("i->l=%p"      ,i->l);
403     DEBUG1("i->l->l=%p"   ,i->l->l);
404     DEBUG1("i->l->l->l=%p",i->l->l->l);
405     DEBUG1("j=%p"         ,j);
406     DEBUG1("j->l=%p"      ,j->l);
407     DEBUG1("j->l->l=%p"   ,j->l->l);
408     DEBUG1("j->l->l->l=%p",j->l->l->l);
409     xbt_assert4(j->l->l->l == j,
410                  "Received list is not cyclic. j=%p != j->l->l->l=%p\n"
411                  "j=%p; &j=%p",
412                  j,j->l->l->l, 
413                  j ,&j);
414     j->l->l->l = NULL;
415     i->l->l->l = NULL;
416     xbt_assert(list_eq(i,j));
417
418     list_free(j);
419   }
420   i->l->l->l = NULL; /* do this even in WRITE mode */
421   list_free(i);
422 }
423
424
425 /*** Dynar of references ***/
426 static void free_string(void *d){ /* used to free the data in dynar */
427      free(*(void**)d);
428 }
429 void test_dynar_ref(gras_socket_t sock, int direction){
430   gras_datadesc_type_t my_type;
431   xbt_dynar_t i,j;
432   char buf[1024];
433   char *s1,*s2;
434   int cpt;
435    
436   INFO0("---- Test on dynar containing integers ----");
437   my_type = gras_datadesc_dynar(gras_datadesc_by_name("string"),&free_string);
438
439   i=xbt_dynar_new(sizeof(char*),&free_string);   
440   for (cpt=0; cpt< 64; cpt++) {
441     sprintf(buf,"%d",cpt);
442     s1=strdup(buf);
443     xbt_dynar_push(i,&s1);
444   }
445
446   write_read(my_type, &i,&j, sock, direction);
447   if (direction == READ || direction == RW) {
448      for (cpt=0; cpt< 64; cpt++) {
449         sprintf(buf,"%d",cpt);
450         xbt_dynar_shift(j,&s2);
451         xbt_assert2 (!strcmp(buf,s2),
452                      "The retrieved value is not the same than the injected one (%s!=%s)",
453                      buf,s2);
454         free(s2);
455      }
456      xbt_dynar_free(&j);
457   }
458   xbt_dynar_free(&i);
459 }
460
461
462 /**** PBIO *****/
463 GRAS_DEFINE_TYPE(s_pbio,
464 struct s_pbio{ /* structure presented in the IEEE article */
465   int Cnstatv;
466   double Cstatev[12];
467   int Cnprops;
468   double Cprops[110];
469   int Cndi[4];
470   int Cnshr;
471   int Cnpt;
472   double Cdtime;
473   double Ctime[2];
474   int Cntens;
475   double Cdfgrd0[373][3];
476   double Cdfgrd1[3][3];
477   double Cstress[106];
478   double Cddsdde[106][106];
479 };
480                  )
481 typedef struct s_pbio pbio_t;
482
483 void test_pbio(gras_socket_t sock, int direction) {
484   int cpt;
485   int cpt2;
486   gras_datadesc_type_t pbio_type;
487   pbio_t i, j;
488
489   INFO0("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
490   pbio_type = gras_datadesc_by_symbol(s_pbio);
491
492   /* Fill in that damn struct */
493   i.Cnstatv = 325115;
494   for (cpt=0; cpt<12; cpt++) 
495     i.Cstatev[cpt] = ((double) cpt) * -2361.11;
496   i.Cnprops = -37373;
497   for (cpt=0; cpt<110; cpt++)
498     i.Cprops[cpt] = cpt * 100.0;
499   for (cpt=0; cpt<4; cpt++)
500     i.Cndi[cpt] = cpt * 23262;
501   i.Cnshr = -4634;
502   i.Cnpt = 114142;
503   i.Cdtime = -11515.662;
504   i.Ctime[0] = 332523.226;
505   i.Ctime[1] = -26216.113;
506   i.Cntens = 235211411;
507   
508   for (cpt=0; cpt<3; cpt++) {
509     for (cpt2=0; cpt2<373; cpt2++)
510       i.Cdfgrd0[cpt2][cpt] = ((double)cpt) * ((double)cpt2);
511     for (cpt2=0; cpt2<3; cpt2++)
512       i.Cdfgrd1[cpt][cpt2] = -((double)cpt) * ((double)cpt2);
513   }
514   for (cpt=0; cpt<106; cpt++) {
515     i.Cstress[cpt]=(double)cpt * 22.113;
516     for (cpt2=0; cpt2<106; cpt2++) 
517       i.Cddsdde[cpt][cpt2] = ((double)cpt) * ((double)cpt2);
518   }
519   write_read(gras_datadesc_by_symbol(s_pbio),
520              &i,&j, sock,direction);
521   if (direction == READ || direction == RW) {
522     /* Check that the data match */
523     xbt_assert(i.Cnstatv == j.Cnstatv);
524     for (cpt=0; cpt<12; cpt++)
525       xbt_assert4(i.Cstatev[cpt] == j.Cstatev[cpt],
526                   "i.Cstatev[%d] (=%f) != j.Cstatev[%d] (=%f)",
527                   cpt,i.Cstatev[cpt],cpt,j.Cstatev[cpt]);
528     xbt_assert(i.Cnprops == j.Cnprops);
529     for (cpt=0; cpt<110; cpt++)
530       xbt_assert(i.Cprops[cpt] == j.Cprops[cpt]);
531     for (cpt=0; cpt<4; cpt++) 
532       xbt_assert(i.Cndi[cpt] == j.Cndi[cpt]);
533     xbt_assert(i.Cnshr == j.Cnshr);
534     xbt_assert(i.Cnpt == j.Cnpt);
535     xbt_assert(i.Cdtime == j.Cdtime);
536     xbt_assert(i.Ctime[0] == j.Ctime[0]);
537     xbt_assert(i.Ctime[1] == j.Ctime[1]);
538     xbt_assert(i.Cntens == j.Cntens);
539     for (cpt=0; cpt<3; cpt++) {
540       for (cpt2=0; cpt2<373; cpt2++)
541         xbt_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
542       for (cpt2=0; cpt2<3; cpt2++)
543         xbt_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
544     }
545     for (cpt=0; cpt<106; cpt++) {
546       xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]);
547       for (cpt2=0; cpt2<106; cpt2++) 
548         xbt_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
549                      "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
550                      i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
551     }
552   }
553 }
554
555 GRAS_DEFINE_TYPE(s_clause,
556 struct s_clause {
557    int num_lits;
558    int *literals GRAS_ANNOTE(size,num_lits); /* Tells GRAS where to find the size */
559 };)
560 typedef struct s_clause Clause;
561
562 void test_clause(gras_socket_t sock, int direction) {
563   gras_datadesc_type_t ddt;
564   Clause *i,*j;
565   int cpt;
566   
567   INFO0("---- Test on struct containing dynamic array and its size (cbps test) ----");
568
569   /* create and fill the struct */
570   i=xbt_new(Clause,1);
571
572   i->num_lits = 5432;
573   i->literals = xbt_new(int, i->num_lits);
574   for (cpt=0; cpt<i->num_lits; cpt++)
575     i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
576   DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
577   DEBUG1("created count=%d",i->num_lits);
578
579   /* create the damn type descriptor */
580   ddt = gras_datadesc_by_symbol(s_clause);
581 /*  gras_datadesc_type_dump(ddt); */
582
583   ddt=gras_datadesc_ref("Clause*",ddt);
584
585   write_read(ddt, &i,&j, sock,direction);
586   if (direction == READ || direction == RW) {
587     xbt_assert(i->num_lits == j->num_lits);
588     for (cpt=0; cpt<i->num_lits; cpt++)
589       xbt_assert(i->literals[cpt] == j->literals[cpt]);
590     
591     free(j->literals);
592     free(j);
593   }
594   free(i->literals);
595   free(i);
596 }
597
598 int main(int argc,char *argv[]) {
599   gras_socket_t sock;
600   int direction = RW;
601   int cpt;
602   char r_arch_char = gras_arch_selfid();
603
604   gras_init(&argc,argv);
605
606   for (cpt=1; cpt<argc; cpt++) {
607     if (!strcmp(argv[cpt], "--read")) {
608       direction = READ;
609     } else if (!strcmp(argv[cpt], "--write")) {
610       direction = WRITE;
611     } else {
612        filename=argv[cpt];
613     }
614   }
615     
616   if (direction == WRITE) {
617     sock = gras_socket_client_from_file(filename);
618     gras_datadesc_send(sock, gras_datadesc_by_name("char"),
619                        &r_arch_char);
620   }
621   if (direction == READ) {
622     sock = gras_socket_server_from_file(filename);
623     gras_datadesc_recv(sock, gras_datadesc_by_name("char"),
624                        gras_arch_selfid(), &r_arch_char);
625     INFO3("This datafile was generated on %s (%d), I'm %s.",
626           gras_datadesc_arch_name(r_arch_char),(int)r_arch_char,
627           gras_datadesc_arch_name(gras_arch_selfid()));
628   }
629   r_arch = (int)r_arch_char;
630
631   test_int(sock,direction);    
632   test_float(sock,direction);  
633   test_double(sock,direction);  
634   test_array(sock,direction);
635   test_dynar_scal(sock,direction);  
636   test_intref(sock,direction); 
637   
638   test_string(sock,direction); 
639
640   test_structures(sock,direction);
641
642   test_homostruct(sock,direction);
643   test_hetestruct(sock,direction);
644   test_nestedstruct(sock,direction);
645
646   declare_chained_list_type();
647   test_chain_list(sock,direction);
648   test_graph(sock,direction); 
649   test_dynar_ref(sock,direction);  
650
651   test_pbio(sock,direction);
652
653   test_clause(sock,direction);
654
655   if (direction != RW) 
656     gras_socket_close(sock);
657   gras_exit();
658   return 0;
659 }
660