Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
grades overrun in test_heap_mean_operation() test funtion, adds test_reset_heap...
[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 # Work around a libtool issue on solaris, making sure that it works even on sh older than tcsh
14 LD_LIBRARY_PATH=@top_srcdir@/src/.libs
15 if export LD_LIBRARY_PATH ; then 
16   :
17 else
18   setenv LD_LIBRARY_PATH @top_srcdir@/src/.libs
19 fi
20
21 ##
22 ## Args parsing (simplistic for now)
23 ##
24 if [ xvalgrind = "x$1" ] ; then
25   exenv="libtool --mode=execute valgrind --show-reachable=yes"
26 else
27   exenv=
28 fi
29
30 ##
31 ## Tests defintions
32 ##
33 xbt_TESTS=" \
34             xbt/log_usage@EXEEXT@;        \
35             xbt/context_usage@EXEEXT@;    \
36             xbt/graphxml_usage@EXEEXT@ @srcdir@/xbt/graph.xml;    \
37             xbt/heap_bench@EXEEXT@;"
38
39 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
40             surf/maxmin_bench@EXEEXT@;                                        \
41             surf/trace_usage@EXEEXT@ --surf-path=@srcdir@/surf/;              \
42             surf/surf_usage@EXEEXT@  --surf-path=@srcdir@/surf/ platform.xml; \
43             surf/surf_usage2@EXEEXT@ --surf-path=@srcdir@/surf/ platform.xml;"
44
45 gras_TESTS="gras/trp_tcp_usage;      gras/trp_file_usage;                        \
46             gras/datadesc_usage@EXEEXT@;                                         \
47             gras/datadesc_usage@EXEEXT@ --copy;                                  \
48             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32;  \
49             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32_4;\
50             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little64;  \
51             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32;     \
52             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_8_4; \
53             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_2;"     
54
55 # Data sets still to regenerate:
56 #
57 #           gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_4;   \
58 #           gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big64;"    
59
60 ##
61 ## Loop on all tests to run them
62 ##
63
64 # we split tests on ';' so that they can contain spaces (test=accumulator)
65 test=""
66
67 for testpart in $xbt_TESTS $gras_TESTS $surf_TESTS
68 do
69   test="$test $testpart"
70   if echo $test | grep  ';' >/dev/null ; then
71     # end of test declaration found.
72   
73     # we must have a space after the ;
74     if echo $test | egrep ';[^ ]' ; then
75       echo "$0.in broken: you should add a space after each ';'"
76       exit 1
77     fi
78     
79     # Cleanup test declaration, run it.
80     test=`echo $test | sed 's/;//'`
81     
82     if [ ".$1" = .windump ] ; then
83       test=`echo $test | sed 's|/home.*testsuite/|//10.0.2.4/qemu/testsuite/|'`
84       test=`echo $test | sed 's|/|\\\\|g'`
85       echo "\\\\10.0.2.4\\qemu\\testsuite\\$test"
86       echo "@if errorlevel 1 echo ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR"
87       test=""
88     else
89       tests_nb=`expr $tests_nb + 1`
90       echo "#### Test $test"
91       if [ x@EXEEXT@ = x ] ; then
92         :
93       else
94         # overwrites "valgrind" as a value, but should be exclusive.
95         exenv=wine  
96       fi
97       exenvsave=$exenv  
98       if [ "x$test" = "xxbt/dict_crash@EXEEXT@" ] ; then 
99         if echo $exenv | grep valgrind >/dev/null ; then
100           exenv=
101         fi
102         $exenv ./$test --xbt-log="root.thres=info" 2>&1
103         retval=$?
104       else 
105         if [ x@EXEEXT@ != x ] && [ x$exenv = xwine ] ; then 
106           if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
107             exenv=""
108           fi
109         fi
110         $exenv ./$test --xbt-log="root.thres=info" 2>&1
111         retval=$?
112       fi
113       exenv=$exenvsave
114       if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
115         echo "## failed" # . Rerun $test with full details."
116 #      if [ "x$test" = "xdict_crash" ] ; then
117 #      $exenv ./$test --xbt-log="root.thres=debug" 2>&1
118 #    else 
119 #      $exenv ./$test --xbt-log="root.thres=debug" 2>&1
120 #    fi
121         failed_nb=`expr $failed_nb + 1`
122         echo "  $test (returned $retval)" >> test.failed
123       else # retval == 77
124         echo "## Ignored since it returned 77"
125         ignored_nb=`expr $ignored_nb + 1`
126         echo "  $test" >> test.ignored
127       fi else
128         echo "## Success"
129         success_nb=`expr $success_nb + 1`
130         echo "  $test" >> test.success
131       fi
132       test=""
133     fi # end of ';' found in test declaration => run it
134   fi # end of run it only if not in windump mode
135 done
136
137 ###
138 ### Display summary
139 ###
140 if [ ".$1" = .windump ] ; then
141   echo pause
142   exit 0
143 fi
144
145 echo
146 echo "#### Summary"
147 echo "$success_nb tests of $tests_nb successfull:"
148 cat test.success
149
150 if [ $ignored_nb != 0 ] ; then
151   echo "$failed_nb tests of $tests_nb ignored:"
152   cat test.ignored
153   echo "  (they returned 77, meaning that they are not applicable)"
154 fi
155 if [ $failed_nb != 0 ] ; then
156   echo "$failed_nb tests of $tests_nb failed: "
157   cat test.failed
158   echo "Rerun the tests using the following command: script -c 'make check' simgrid.tests.log"
159   echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
160   echo "   - the file simgrid.tests.log produced by this command."
161   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
162   echo "   - the config.log produced by the compilation."
163 fi
164
165 rm -f test.success test.failed test.ignored
166 exit $failed_nb