Logo AND Algorithmique Numérique Distribuée

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