Logo AND Algorithmique Numérique Distribuée

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