X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/01021da3b27c6a5704bfa08cd0ce07be6b925e8b..8c21191fcd55627affe27f4a74764991e17632f0:/testsuite/gras/mk_datadesc_structs.pl diff --git a/testsuite/gras/mk_datadesc_structs.pl b/testsuite/gras/mk_datadesc_structs.pl index bfc0b9cc95..8e62de0362 100755 --- a/testsuite/gras/mk_datadesc_structs.pl +++ b/testsuite/gras/mk_datadesc_structs.pl @@ -19,20 +19,24 @@ die 'scalar @types != scalar @abrev' unless (scalar @types == scalar @abrev); print "/* This file is perl-generated, of course */\n\n"; -print "#include \n"; -print "#include \n\n"; +print "#include \"gras.h\"\n\n"; -print "GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(structs,test,\"Logs about the gigantic struct test\");\n\n"; +print "XBT_LOG_NEW_DEFAULT_SUBCATEGORY(structs,test,\"Logs about the gigantic struct test\");\n\n"; print "#define READ 0\n#define WRITE 1\n#define RW 2\n\n"; -print "gras_error_t write_read(gras_datadesc_type_t type,void *src, void *dst, gras_socket_t *sock, int direction);\n\n"; +print "void write_read(gras_datadesc_type_t type,void *src, void *dst, gras_socket_t *sock, int direction);\n\n"; my ($i,$j,$k,$l); my $max=scalar @types; -my $maxl=0; # set it to "$max-1" to do 2401 tests (takes for ever to compile) -for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) { +# Those max variables can be used to tune how much test you are ready to do. +# But WARNING! changing them naturally invalidate any existing data file. +my $max_i=$max-1; +my $max_j=0; +my $max_k=$max-1; +my $max_l=0; +for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) { print "GRAS_DEFINE_TYPE(".$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l].",". "struct ".$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l]." { ". $types[$i]." a; ". @@ -43,12 +47,11 @@ for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) }}}} # print "\n#define test(a) do {if (!(a)) { failed = 1; ERROR1(\"%s failed\",#a);}} while (0)\n"; - print "\n#define test(a) gras_assert(a)\n"; + print "\n#define test(a) xbt_assert(a)\n"; -print "\ngras_error_t test_structures(gras_socket_t *sock, int direction);\n"; -print "\ngras_error_t test_structures(gras_socket_t *sock, int direction) {\n"; -print " gras_error_t errcode;\n"; -for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) { +print "void test_structures(gras_socket_t *sock, int direction);\n"; +print "void test_structures(gras_socket_t *sock, int direction) {\n"; +for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) { my $struct=$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l]; print " struct $struct my_$struct = {".$val[$i]."+(".$types[$i].")1," .$val[$j]."+(".$types[$j].")2," @@ -56,10 +59,10 @@ for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) .$val[$l]."+(".$types[$l].")4}, my_${struct}2;\n"; }}}} -print " INFO0(\"---- Test on all possible struct having 3 fields (".($max*$max*$max*($maxl+1))." structs) ----\");\n"; -for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) { +print " INFO0(\"---- Test on all possible struct having 3 fields (".(($max_i+1)*($max_j+1)*($max_k+1)*($max_l+1))." structs) ----\");\n"; +for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) { my $struct=$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l]; - print " TRY(write_read(gras_datadesc_by_symbol($struct), &my_$struct, &my_${struct}2, sock,direction));\n"; + print " write_read(gras_datadesc_by_symbol($struct), &my_$struct, &my_${struct}2, sock,direction);\n"; print " if (direction == READ || direction == RW) {\n"; print " int failed = 0;\n"; print " test(my_$struct.a == my_${struct}2.a);\n"; @@ -69,6 +72,5 @@ for $i (0..$max-1) { for $j (0..$max-1) { for $k (0..$max-1) { for $l (0..$maxl) print " if (!failed) VERB0(\"Passed $struct\");\n"; print " }\n"; }}}} - print " return no_error;\n"; print "}\n"; ;