Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Surf is not broken anymore. Those tests should be run.
[simgrid.git] / testsuite / run_tests.in
1 #! @BASH@
2
3 ##
4 ## Cleanups of previous executions
5 ##
6 failed_nb=0
7 success_nb=0
8 ignored_nb=0
9 tests_nb=0
10
11 rm -f test.failed test.success test.ignored
12
13 ##
14 ## Args parsing (simplistic for now)
15 ##
16 if [ xvalgrind = "x$1" ] ; then
17   valgrind="libtool --mode=execute valgrind --show-reachable=yes"
18 else
19   valgrind=
20 fi
21
22 ##
23 ## Tests defintions
24 ##
25 xbt_TESTS=" xbt/log_usage@EXEEXT@;        \
26             xbt/dynar_int@EXEEXT@;        \
27               xbt/dynar_double@EXEEXT@;   \
28               xbt/dynar_string@EXEEXT@;   \
29             xbt/dict_usage@EXEEXT@;       \
30               xbt/dict_crash@EXEEXT@;     \
31             xbt/config_usage@EXEEXT@;     \
32             xbt/heap_bench@EXEEXT@;"
33            
34 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
35             surf/maxmin_bench@EXEEXT@;                                        \
36             surf/trace_usage@EXEEXT@ --surf-path=@srcdir@/surf/;              \
37             surf/surf_usage@EXEEXT@  --surf-path=@srcdir@/surf/ platform.xml; \
38             surf/surf_usage2@EXEEXT@ --surf-path=@srcdir@/surf/ platform.xml;"
39
40 msg_TESTS=" msg/msg_test@EXEEXT@ --surf-path=@top_srcdir@/examples/msg/;"
41
42 gras_TESTS="gras/trp_tcp_usage;      gras/trp_file_usage;                       \
43             gras/datadesc_usage@EXEEXT@;                                        \
44            "
45            
46 gras_ignored="gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32; \
47             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little64; \
48             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32;    \
49             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big64;    \
50             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.aix;      \
51             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.win32;    \
52             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.g5;"      \
53             
54 ##
55 ## Loop on all tests to run them
56 ##
57
58 # we split tests on ';' so that they can contain spaces (test=accumulator)
59 test=""
60
61 for testpart in $xbt_TESTS $msg_TESTS $gras_TESTS $surf_TESTS # 
62 do
63   test="$test $testpart"
64   if echo $test | grep ';' ; then
65     # end of test declaration found.
66   
67     # we must have a space after the ;
68     if echo $test | egrep ';[^ ]' ; then
69       echo "$0.in broken: you should add a space after each ';'"
70       exit 1
71     fi
72     
73     # Cleanup test declaration, run it.
74     test=`echo $test | sed 's/;//'`
75     
76     tests_nb=`expr $tests_nb + 1`
77     echo "#### Test $test"
78     if [ x@EXEEXT@ = x ] ; then 
79       wine=
80     else
81       wine=wine
82     fi
83     if [ "x$test" = "xdict_crash@EXEEXT@" ] ; then
84       $wine ./$test --xbt-log="root.thres=info" 2>&1
85       retval=$?
86     else 
87       winesave=$wine
88       if [ x@EXEEXT@ != x ] ; then 
89         if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
90 #         echo "This is not a win32 binary, don't use wine"
91           wine=""
92         fi
93       fi
94         # if the user defines valgrind while cross-compiling, too bad
95         $wine $valgrind ./$test --xbt-log="root.thres=info" 2>&1
96         retval=$?
97       wine=$winesave
98     fi
99     if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
100       echo "## failed" # . Rerun $test with full details."
101 #      if [ "x$test" = "xdict_crash" ] ; then
102 #      $wine ./$test --xbt-log="root.thres=debug" 2>&1
103 #    else 
104 #      $wine $valgrind ./$test --xbt-log="root.thres=debug" 2>&1
105 #    fi
106       failed_nb=`expr $failed_nb + 1`
107       echo "  $test (returned $retval)" >> test.failed
108     else # retval == 77
109       echo "## Ignored since it returned 77"
110       ignored_nb=`expr $ignored_nb + 1`
111       echo "  $test" >> test.ignored
112     fi else
113       echo "## Success"
114       success_nb=`expr $success_nb + 1`
115       echo "  $test" >> test.success
116     fi
117     test=""
118   fi # end of ';' found in test declaration => run it
119 done
120
121 ###
122 ### Display summary
123 ###
124
125 echo
126 echo "#### Summary"
127 echo "$success_nb tests of $tests_nb successfull:"
128 cat test.success
129
130 if [ $ignored_nb != 0 ] ; then
131   echo "$failed_nb tests of $tests_nb ignored:"
132   cat test.ignored
133   echo "  (they returned 77, meaning that they are not applicable)"
134 fi
135 if [ $failed_nb != 0 ] ; then
136   echo "$failed_nb tests of $tests_nb failed: "
137   cat test.failed
138   echo "Rerun the tests using the following command: script -c 'make test' simgrid.tests.log"
139   echo " and send the following informations to simgrid2-users@listes.ens-lyon.fr:"
140   echo "   - the file simgrid.tests.log produced by this command."
141   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
142   echo "   - the config.log produced by the compilation."
143 fi
144
145 rm -f test.success test.failed test.ignored
146 exit $failed_nb